Posts

Showing posts from March, 2013

Understanding C# property syntax and getters/setters -

i coming on java world , construct driving me nuts: private static string _muiurl; private static string muiurl { { if (string.isnullorempty(_muiurl)) { using (var db = new intlmpdb()) { _muiurl = (from c in db.control c.controlkey == "mui_url" select c.controlvalue).firstordefault(); } } return _muiurl; } } when see in class , want use property in class itself, how should call it? simply follows: var result = typewithmuiurlproperty.muiurl; you can omit class name mentioned others, however, explicitness leave in example.

sharepoint - XLViewer not working for XLSX attachments -

i have users want open excel attachments list item sharepoint insists opens using xlviewer never works. there error says try again in few minutes. i want allow them download or open directly excel or associated application. make sure you're site collection admin. go site (not central admin) , go site settings go site collection features. in there find setting " open documents in client applications default " deactivated. active , you're go. users open attachments in windows assigned applications, not sharepoint web apps.

objective c - How do I Enable pasting a password into a NSSecureTextField? -

for reason users of application have paste content nssecuretextfield , because they're using tools manage/generate passwords , can't type them. i've been trying figure out way enable this, use component same behavior able accept pasting or other way allow this. hints welcome. it's interesting apple provided docs cut , copy not possible, doesn't pasting. in recent versions of mac os x (i believe in 10.5 forward) pasting is allowed. don't have available default. older versions of os x prohibited. if take @ the revision log documentation of nssecuretextfieldcell states: 2007-10-31 removed statement pasting not allowed

sql server - SqlClient.SqlException .Number = 3617 .State = 68 -

we receiving exception 1 of our sql select statements. cannot find error 3617 in sysmessages table. .class 25. there no message. we know getting on sql server 2005 servers. i know large select joins several tables , uses clr combine , order data. what causing error or find out error code means? take @ this: discussion on microsoft forums , see answer moderator last in post. updated : (added text forum post): error code 3617 system attention. system attention occurs when client cancels running request. can happen if command times out example. error not sent client however. there special case can occur may hitting. when re-use pooled connection, first outbound request sends special bit flag on request tell server reset connection state prior executing request. bit causes server first clear connection state, execute command. if sql server under heavy load, , bit set, , takes long time reset connection state, client may timeout , s...

winforms - How to change the behaviour of the DataGridViewComboBoxColumn in C#? -

i'm working data grid contains combo box column, editing combo box (by clicking on it) gets annoying sometimes, since 1 must click @ least twice change value of field. want change behaviour, thought simple: create onmouseover event make mouse-overed combo box selected, available event disposed one. is there way change behaviour? i dealt same problem, , solved setting datagridview.editmode editonenter . if don't behaviour other columns, found this suggestion placing in cellenter event: if (datagridview1.columns[e.columnindex] datagridviewcomboboxcolumn) { ((datagridviewcomboboxeditingcontrol)datagridview1.editingcontrol).droppeddown = true; } i haven't tried it, looks promising. same technique discussed on this question .

Size of HTML5 Canvas via CSS versus element attributes -

i don't why following pieces of code produce different results, because css scale canvas zoomed in, <style> #canvas { width: 800px; height: 600px; } </style> <canvas id="canvas"></canvas> in contrast approach (that works expected): <canvas id="canvas" width="800px" height="600px"></canvas> the explanation here: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#attr-canvas-width seen in post, thanks! the intrinsic dimensions of canvas element equal size of coordinate space, numbers interpreted in css pixels. however, element can sized arbitrarily style sheet. during rendering, image scaled fit layout size .

actionscript 3 - Is this statement about the following condition correct? -

look @ code: var a:number = 1; var b:string = "hello"; if (a == 1 && b == "goodbye") { trace("options , b"); } the book reading says: "in example, test evaluate true, because 1 of 2 conditions (the first) true. result, “option or b” traced." isn't above statement incorrect? if statement me reads "if 1 , b goodbye output it" you correct , book reading wrong. eric comments should || in code, indicated text result should "option or b" (the code wrong here well...). /az

android - Keeping Widget Applications Main Activity in BACKGROUND -

my widget deployed in applications launches main activity. of time want main activity in background when click on widget comes foreground , rather user seeing widget change application main activity displays. can't rid of main activity because want allow users launch application contains widget. wondering how situation can managed. thanks. setting android:launchmode="singleinstance" seems keep main activity coming foreground. not sure if there might downsides however.

mysql - Datasets with different information - single table or 1 per set? -

i'm in group other classmates designing software allow user upload historical data area, , filter data based on other column information. column information can different per set of data. example, have large csv containing information people living in philadelphia late 1700's, including columns like: occupation, widow, african, address, comments addresses common attribute across sets. i thought should create new table each dataset, since can't know future columns or how many there be. can upload file tomorrow information chicken farmers, , columns like had chickens brown eggs, wheat, address, apples i know i've taught myself, i've since been told other classmates new tables per set dirty in philosophical sense. competing design single table multiple generic "attribute" columns, kept separated-by-set meta information/another table describing attributes. i'm having difficulty seeing downsides making new table each set, i'm no...

authorize.net - recurring billing /w cvv2 -

i'm implementing payment system , i'm not sure how deal cvv2 codes. our service offers 2 week free trial. require user enter in billing information , auth card $1. 2 weeks later separate auth & capture (we can't prior_auth_capture because user can upgrade plan during trial). bill them each month on. how supposed use cvv2 code in our situation? we're not supposed store cvv2 code, can use auth do. worthing doing on auth still? don't want first auth succeed (because has cvv2) , prior auth + captures fail because don't keep around. long story short i'm new @ company , i'm trying fix billing problems. international customers in particular getting payments declined (some, not all). current system doesn't pass along name on card auth.net nor sort of address verification, suspect what's giving international customers trouble. i think using cvv2 (if it'll work in our situation) , sending actual name on card should remedy issue in...

wxpython gui documentation -

has got idea can detailed documentation on wx.grid module. demo doesnt explaining how module works , finding documentation online proving impossible. http://www.blog.pythonlibrary.org/2010/12/05/wxpython-documentation/ http://xoomer.virgilio.it/infinity77/wxpython/grid/wx.grid.html

c# - Linq to Entities Distinct Clause -

i want add distinct code below. cannot figure out exact syntax. in advance. var testdates = (from o in db.fmcsa_me_test_data orderby o.date select new { requestdate = o.date }); use distinct() extension method. note distinct() may negate existing orderby (i've noticed in linq sql), may want use orderby() method afterwards. var testdates = (from o in db.fmcsa_me_test_data select new { requestdate = o.date }).distinct().orderby(x => x.requestdate);

WPF, Nhibernate v2 Session Persistence -

i have wpf application loads modules application via prism / mef. each module reference assembly created house nhibernate functionality (unit of work & repository pattern). started on first module, following questions came up: is common place have nhibernate session open lifetime of wpf / windows application? would idea share nhibernate session amongst modules or have each module create own session? it's understanding session lightweight, opening , closing session not problem... however, if close session lose change tracking... when call save, , object same when retrieve, not want query executed. do not have session open lifetime of wpf/windows application. have performance , memory problems if do. it depends how these modules interact. separate systems, or need work in tandem work. if it's former, shouldn't share sessions. if it's latter, use kind of session manager can pass out current session.

php appending array -

ok have changed code more have suggested, actual append still not happen. changes single value in array new value being passed in instead of actual append. if(isset($_post['addtag']) && isset($_post['tagname'])) { if(isset($_post['tags'])) { $_post['tags'][] = $_post['tagname']; } else { $_post['tags'] = array($_post['tagname']); } } the reason check see if 'tags' variable has been set because there's no guarantee array yet don't take chance of using 1 until initialize array value. here's happens: 1. visit page first time. 2. add tag ('tag1') 3. page refreshes , reflects 'tags' variable has size of 1 , displays 'tag1' 4. add tag ('tag2') 5. page refreshes , reflects 'tags' variable has size of 1 , displays 'tag2' "refreshes" because term know specifies action of form points page located on. regarding u...

Poor shading problem in Android OpenGL ES -

Image
i set diffuse lighting: private float[] lightambient = { 0.5f, 0.5f, 0.5f, 1.0f }; private float[] lightdiffuse = { 1.0f, 1.0f, 1.0f, 1.0f }; private float[] lightposition = { 0.0f, 0.0f, 2.0f, 1.0f }; gl.gllightfv(gl10.gl_light0, gl10.gl_ambient, lightambientbuffer); gl.gllightfv(gl10.gl_light0, gl10.gl_diffuse, lightdiffusebuffer); gl.gllightfv(gl10.gl_light0, gl10.gl_position, lightpositionbuffer); gl.glenable(gl10.gl_light0); gl.glshademodel(gl10.gl_smooth); but triangulated shading or flat color on cube located @ origin ( center) , rotated 45 deg around x , y. cube directly in front of light. reasons why getting such poor results? attached cube image. opengl es calculates colors @ vertices of each triangle. color interpolated across triangle, ideally vertices should calculate same colors between 2 triangles variety of situations cause not to. it appears though cube edges modeled 2 triangles. decompose cube side more triangles, adds more memory storage , slo...

c# - Code contract ensures not proven for loop -

i'm starting play around .net code contracts (in vs2010 ultimate .net 4), try idea of static checker can , can't prove. i'm trying following example :- public int mult(int num1, int num2) { contract.requires(num2 >= 0); contract.ensures(contract.result<int>() == (num1 * num2)); int result = 0; (int = 0; < num2; i++) { result = result + num1; } return result; } ie, simple implementation of multiply function, repeated adding. the static checker can't verify postcondition met :- codecontracts: ensures unproven: contract.result<int>() == (num1 * num2) is function not computing product correctly.. or there reason why static checker can't verify requires ? presence of loop cause difficulty ? if it's difficult static checker verify things when loops present, can imagine quite annoying have lot of warnings time. i don't option of putting in assumes tell ...

c# - Failsafe disposal in an async world -

in synchronous world, c# makes management of things disposable rather easy: using(idisposable somedisposable=bla.bla()) { //do our bidding } //don't worry however, when go async, no longer have convenience of using block. 1 of best strategies i've encountered ccr iterator allows use async code "as if synchronous". means can keep our using block in iterator handler , not bogged down in complex decision of when dispose , catching cases disposal required. however, in many cases, invoking ccr can seem overkill, , honest, although i'm quite comfortable ccr, uninitiated can double-dutch. so question is: other strategies exist management of one's idisposable's, when disposable objects must persist beyond immediate scope? one approach have methods not able coexist disposal method take lock while run, , check queue objects needing disposal when finish. disposal method add queue, use tryenter try acquire lock, dispose object , delete qu...

php - Remove duplicate items from an array -

i use line of code below loop through table in database: $items_thread = $connection -> fetch_all($sql); and if print array out: print_r($items_thread); i this: array ( [0] => array ( [recipientid] => 3 [recipientscreenname] => tom l [recipientfirstname] => thomas [recipientemail] => info@xx.com ) [1] => array ( [recipientid] => 3 [recipientscreenname] => tom l [recipientfirstname] => thomas [recipientemail] => info@xx.com ) [2] => array ( [recipientid] => 1 [recipientscreenname] => lau t [recipientfirstname] => tk [recipientemail] => lau@xx.co.uk ) ) but want rid of duplicate items in array, use array_unique print_r(array_unique($items_thread)); i weird result below not quite looking for: array ( [0] => ar...

Ruby equivalent of C# Linq Aggregate method -

whats ruby equivalent of linq aggregate method. works this var factorial = new[] { 1, 2, 3, 4, 5 }.aggregate((acc, i) => acc * i); the variable acc getting accumulated every time value array sequence passed lambda.. this called fold in mathematics pretty programming language. it's instance of more general concept of catamorphism . ruby inherits name feature smalltalk, called inject:into: (used acollection inject: astartvalue into: ablock. ) so, in ruby, called inject . aliased reduce , unfortunate, since means different. your c# example in ruby: factorial = [1, 2, 3, 4, 5].reduce(:*) although 1 of these more idiomatic: factorial = (1..5).reduce(:*) factorial = 1.upto(5).reduce(:*)

java - Release an Eclipse project -

i'm ready send out betas of eclipse project friends. have tried make executable jar, worked on computer. when sent friends (who use ubuntu , mac osx), couldn't execute jar. how can send out full copy of current project works on oss? use java web start launch project off web server. work os java (1.4.2+) installed, , earlier jres well.

objective c - send current location on iPhone GPS at specific time -

so obtain current gps location , send @ specific time in day web service. how can this? there way automatically turn on current location gps service? you can run application in background receive location change notifications. in case, application keep getting notifications on location changes . by "on location changes" , mean can't check location in regular schedule. example, if phone not move @ all, 7 days, application not have chance send out location there no way (yet) let application run in background @ fixed time.

XML parsing java using JAXB -

i looking source code that, creates java classes using, jaxb. have schemas, , xml file. or tutorial on jaxb if possible. thx um, http://jaxb.java.net/tutorial/ .

ios - Running OS X in Virtual PC in a Windows 7 machine? -

just wondering, has tried run os x in vm environment running in windows 7? what's performance like? issues in regards development of ios software? i have emphasize software development, don't mind if minor video playback or adobe photoshop doesn't run in vm, long relevant tools , apis connectivity ios device runs fine. unfortunately, , mean that, violation of os x software license virtualize version of os x client on hardware. os x server snow leopard , later may virtualized on apple hardware , support exists in both vmware fusion , parallels , virtualbox doing so. none of them virtualize os x client. there hacks around checks, still violation of os x client license. i have seen os x client , server virtualized using virtualbox on both apple , non-apple hardware, doable. the fact cannot virtualize os x client on apple hardware major pain engaged in testing software run on os x. while can on single system - , in fact use macs - exercise full range of ...

Message box in C in Linux -

i want display "successful" pop-up message after executing program in c in linux. it should run on both kde , gnome. how can this? you looking desktop notifications . believe both kde , gnome support them. here (gtk+-based) library can use program's end.

json - ajax problem in fetching value from response -

i have function in controller, getjson . works fine; ajax response. code def getjson = { // billingcontroller obj= new billingcontroller() // resultset results = obj.showbillingperiod() def c= billingperiod.createcriteria() def results = c{ and{ max("billingstartdate") max("billingenddate") } maxresults(1) order("billingstartdate", "desc") } render results json } ajax var baseurl = "${createlink(controller:'billingperiod', action:'getjson')}" new ajax.request(baseurl, { method: 'get', asynchronous: true, onsuccess: function(req) {update(req)} }); [{"class":"com.indivar.cmcs.master.billingperiod","id":53,"billingenddate":"25-02-2011","billingstartdate":"28-02-2011","datecreated":"17-02-2011","ent...

dependency injection - Entity Framework 4 and Repository Pattern -

could explain benefits of using pattern? i mean isn't ef repository in sense already? can't query container , return objects? i see lot of talk poco's, automapper, dependency injection, service layers, ioc. mixing bunch of stuff together, or relate? can explain me? also, how fit mvc.net, viewmodels vs datamodels? thanks, sam there bunch of random question's there, i'll give bunch of random answers: a repository defined (by martin fowler) "mediates between domain , data mapping layers using collection-like interface accessing domain objects" ef orm, data mapping layer yes, can query ef container , return objects, consumer "knows much" underlying persistence mechanism, when shouldn't know/care - hence repository pattern poco's technique used free objects persistence meta data (used default ef code gen). allow poco's double domain models. viewmodels used mvc views. automapper used translate viewmodels domai...

layout - Image alignment issues in databound Pivot control -

i'm using pivot control , binding collection of images it. i'm having problem alignment of photos. if photos landscape, align @ top, , unable use gesture control anywhere below photo. if mix of portrait/landscape, images appear ok, until rotate device. portrait images extremely zoomed in, , landscape images located half way down screen. i'm new wp7 development , layout still pretty foreign me. assistance appreciated. i'm sure has have created basic photo viewer this.... <controls:pivot name="photopivot" loaded="photopivot_loaded" itemssource="{binding _photos}"> <controls:pivot.headertemplate> <datatemplate> <grid height="1" width="1"/> </datatemplate> </controls:pivot.headertemplate> <controls:pivot.itemtemplate> <datatemplate> ...

android scrollview and scrollbar position -

i have scrollview contain linearlayout ,my problem need give little margin on right of scrollbar of scrollview ,ie scroll should visible inside linearlayout not @ border. <scrollview android:fillviewport="true" android:orientation="vertical" android:layout_width="match_parent" android:scrollbarstyle="outsideoverlay" android:scrollbaralwaysdrawverticaltrack="true" android:scrollbartrackvertical="@drawable/scrollbattrack" android:scrollbarthumbvertical="@drawable/scrollbarthumb" android:fadescrollbars="false" android:layout_height="match_parent"> <linearlayout android:id="@+id/listview" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent...

WCF Dataservice hosting issue with vs2010 -

i have created wcf data service , hosted in visual studio asp.net development server.my problem service run when build application through vs2010, if try running exe using debug/release folder dataservice not launching. should run when click on application exe file. below code sinnpet describe how starting data service. webservicehost dbservicehost= new webservicehost(typeof(mydataservice)); dbservicehost.open(); any appreciated you need use dataservicehost (in assembly system.data.services ; descends webservicehost ) host wcf data service: using system.data.services; uri[] baseaddresses = new uri[1]; baseaddresses[0] = new uri(baseaddress); using(dataservicehost host = new dataservicehost(typeof(yourdataservice), baseaddresses)) { host.open(); console.writeline("dataservice , running....."); console.readline(); host.close(); }

Error:java.lang.NullPointerException in android -

[2011-02-18 23:41:16 - ddms]null java.lang.nullpointerexception at com.android.ddmlib.client.sendandconsume(client.java:571) @ com.android.ddmlib.handlehello.sendhelo(handlehello.java:142) @ com.android.ddmlib.handlehello.sendhellocommands(handlehello.java:65) @ com.android.ddmlib.client.getjdwppacket(client.java:670) @ com.android.ddmlib.monitorthread.processclientactivity(monitorthread.java:317) @ com.android.ddmlib.monitorthread.run(monitorthread.java:263) what kind of error this..all xml files having error below.. multiple annotations found @ line: - premature end of file. - error: error parsing xml: no element found thank you, the first group of errors mean there's problem in communication between ddms , emulator have fired up. i've found errors harmless. the xml errors sound should restart eclipse (if that's you're using), or else clean project. got out of sync. (if problem persists, post example of xml that's generating errors.) ...

SQL Tables: Store references to an unknown number of rows in table A in a single record in table B -

i have table of people, , table of service tickets. service tickets refer 1+ people, , on time people associated multiple tickets. best way represent relationship in sql database? it seems 2 options create 'enough' columns contain person id's should need, or single huge string column processed csv style after being fetched database. both of these options have maximum capacity, seems bad design, , second design means can't join using person id's. a little background - i'm implementing small database part of backend class project. i've never worked sql , know self taught. i feel has duplicate question, i'm unable find similar. no, if si many many relation ship, creat table accordingly. create table, like peopleservicelink: personid, servieticketid, primary key (personid, servieticketid) have read hear @ understanding sql: many many relationships

oop - What are the disadvantages/flaws/faults of Object Orientation in general? -

object orientation dominant programming paradigm today. people say, there disadvantages, flaws or faults paradigm. consider complete failure. concrete reasons/arguments that? what found biggest flaw of oop prominent frameworks/methods encourage writing not object-oriented code. if developing service , dao layer no state @ (just business methods passing arguments layer layer) , have domain model no logic @ (just bunch of fields , maybe getters/setters/properties), no longer oop. of enterprise projects, considered written, aren't object oriented. have collection of functions grouped in logical namespaces (called classes ) , collection of data structures, having private fields annoy programmers (called domain ). domain not have operations. imho oop model sacrificed in enterprise applications because not handle concurrency (or maybe because people prefer have stable set of objects rather creating new instance per request ?!?). reason why functional languages (and immut...

How to parse a Crystal Report in .NET and display all its objects? -

i have crystal report. want read report object when provide path vb.net application , able read object properties. i tried find apis couldn't succeed. , new vb.net though have worked on crystal reports using tool. any appreciated. kindly me. best regards gowtham see rpttoxml

java - Input and Display unicode characters in jTextField -

i have java gui program input , display text in database keep on getting question marks non-english characters in jtextfield when retrieve database. for input can copy/paste non english characters textfield , displays correctly (when pasted). database insert goes fine without error. since java unicode based, expecting go smoothly. other information might help development environment os: windows xp non-english character support installed java jdk 1.6 update23 backend mysql 5.5 encoding: utf8 collation: utf8_general_ci though application in english, want able input , display utf8 characters in fields. need suggestion. i had similar problem. insert unicode chars insert query when type in jtextfield , press add button inserted db corrupted. editing connection string solved problem. jdbc:mysql://localhost:3306/databasename?useunicode=true&characterencoding=utf8

sql - How to check for details of subquery output? -

i have query this: update t3 set somevalue = (select t2.id table1 t1 join table2 t2 on t1.fk_table2_id = t2.id t3.id = t1.fk_table3_id) table3 t3 the subquery select t2.id table1 t1 join table2 t2 ... returns 2+ values @ place in sql server 20008 db. there easy way figure out fails? or there way update column in 1 table values another? thanks in advance assuming ts.id unique, can find out returning more 1 row, use select (omit table3 query if t1.fk_table3_id foreign key constraint): select t3.id, count(*) table1 t1 join table2 t2 on t1.fk_table2_id = t2.id join table3 t3 on t3.id = t1.fk_table3_id group t3.id having count(*) > 1

c - How do I track variable changes in gcc -

is possible track when , how variable change? coding in c using gcc on linux if want put code inside program run when variable changes, no - standard c doesn't provide way that. have find places in program try change variable value , put logging code in each , every one. can make more reliable renaming variable fixing points compilation breaks, works if can recompile "client" code using variable: if variable in library lots of other peoples' applications using it, might not practical. using get/set functions access... it's idea not write code directly uses variable, instead provide functions , set value: can put checks or logging inside functions if becomes useful day. but, don't want everywhere or code verbose , slower run. polling checks changes variable... if it's enough check every , then, can write code triggered timer/alarm signal, or runs in thread, checks on variable periodically see if it's changed, won't find o...

how to change CATALINA_BASE in /var/lib/tomcat6 in ubuntu 10.4 -

i install tomcat6 on ubuntu 10.4 want save projects in different directory catalina_base in /var/lib/tomcat6 1 can me in maybe can you: http://www.udel.edu/cis/474/pconrad/06s/topics/tomcat/generalinstalladvice/sharedinstall.txt try change env variables like setenv catalina_base /home/path/to/dir i didn't try myself, tell me if doesn't work

c# - How to substitute at runtime the WaitHandle that a thread should wait on -

i'm wondering how safely change @ runtime eventwaithandle thread should wait on. suppose instance there 2 threads (a , c) synchronized through eventwaithandles. job cyclically , c waits until receives notification can start doing job (e.g. autoresetevent). pattern a-c-a-c... later on new thread (b) launched (e.g. user action) , job should executed in between 2 preexistent threads in way: makes job, signals b , once b finishes signals c. pattern a-b-c-a-b-c... so before thread c waiting on eventwaithandle shared , later there should safe mechanism makes c waiting on eventwaithandle shared b. seems me tricky part substituting eventwaithandle used c, since once done should able launch b use eventwaithandle wait on job , eventwaithandle signal c job. mechanism should provide way safely unmount thread b , go initial situation thread , c working. is there safe way accomplish eventwaithandle ? if not, other suggestion appreciated. if task knows change, have task c own...

asp.net mvc 2 - Disable form validation in MVC2 -

is possible programatically disable form validation in mvc2? i'm hoping there kind of command can put in custom actionmethodselectorattribute, making possible prefix actionresults want form validation disabled. the reason have form multiple buttons, 1 button adds new row child object of model - consequently creates new row on form. this works fine, validation fired form each time "add" pressed, , new fields flag validation errors before user has chance enter data. i've found alternative solution this. rather use multiple form buttons, i've used custom html helper produces "add" link. helper places current model in tempdata , produces link add/{id}. i'm not sure cleanest solution, allows child elements added without validation firing. tidy things bit, specified form such: html.beginform(view, controller, new { id = model.id })

javascript - How to fetch id of video from embed code -

i have 2 div want fetch video id embed tag of(div id="main)) through javascript.after want replace id embed code of (div container) <div id ="container"> <object width="550" height="550"> <param value="http://www.youtube.com/v/sifypqjyhv8&amp;rel=0&amp;color1=0x2b405b&amp;color2=0x6b8ab6&amp;border=1" name="movie"> <param value="transparent" name="wmode"> <embed width="550" height="550" wmode="transparent" type="application/x-shockwave-flash" src="http://www.youtube.com/v/sifypqjyhv8&amp;rel=0&amp;color1=0x2b405b&amp;color2=0x6b8ab6&amp;border=1"> </object> < /div> <div id="main"> <a id="displaytext"> <object width="150" height="150"> <param value="http://www.youtube.com/v/s...

Android phone is disconnected when adb is started -

i trying debug android phone adb tool. when run adb command on command prompt, connected phone disconnected system. want use adb logcat on phone. using following command: adb -s <device_id> logcat after entering command on command line, says: adb server out of date. killing... , after phone gets disconnected , command line shows waiting device... any idea how solve problem? want run logcat on android device. using htc wildfire phone. thanks i updated phone software, , using adb logcat command in place of adb -s<decive_id> logcat command. it worked fine me.

windows - Which HRESULT to return when a buffer provided is too small? -

i have function in iunknown -derived com interface: hresult getpassword( [in] long bufferlength, [out] wchar* buffer ); and contract implementation should check whether buffer large enough store string being retrieved. if buffer large enough string copied , s_ok returned, otherwise function return error indication. however can't find suitable hresult value that. e_unexpected seems quite dumb , unhelpful. closest found disp_e_buffertoosmall looks idispatch -derived interfaces only. which hresult should returned if buffer provided small? you can't return disp_e_* errors, not implementing idispatch. e_invalidarg correct here, unambiguous doesn't happen often. implement isupporterrorinfo generate error messages, atl makes trivial error() method.

python - Scrapy: skip item and continue with exectuion -

i'm doing rss spider. want continue execution of spider ignoring current node if there isn't match in current item... far i've got this: if info.startswith('foo'): item['foo'] = info.split(':')[1] else: return none (info string that's sanitized xpath before...) but i'm getting exception: exceptions.typeerror: cannot return "nonetype" object spider so how can ignore node , continue execution? parse(response): #make manipulations if info.startswith('foo'): item['foo'] = info.split(':')[1] return [item] else: return [] but better not use return, use yield or nothing parse(response): #make manipulations if info.startswith('foo'): item['foo'] = info.split(':')[1] yield item else: return

android - How to detect which 3d object has been touched? -

assume have 3 cubes in random location/rotation visible in viewport. want able detect if of cube has been touched if touch ( or click on emulator) specific cube. if touch empty space instead of cube, should detected. know there ontouchevent callback over-ride on view gives me x,y coordinate of touch occurred. looking opengl-es based solution , more java based android application. there several objects (or none) on x / y coordinate. should find them all, , if there any, check z-coordinate see 1 closest viewport (and 1 touched).

sql - How do I select employees most profitable case's? -

in ms sql i've run across query need can't wrap head around it. i've simplified employee case can apply situation. employee: [empid, name] case : [caseid, employeeid, casename, profit] how select employees profitable case against name? i'd result like, result : [empid, name, caseid, casename, profit] select * employee e inner join case c on c.employeeid = e.empid inner join ( select employeeid, max(profit) profit case group employeeid ) pmax on pmax.employeeid = c.employeeid , pmax.profit = c.profit note not complete if have cases employees identical profits. cases, add join mix

windows - Application Virtualization: How application streaming can be done via internet? -

i know packing software virtual application through application virtualization products. dont understand, how can offer streaming services of package centralized server clients. they call application streaming. can explain how can done. basically it's virtualization, bits delivered on-demand in optimal way possible.

javascript: how to call variable instance inside variable? -

i trying make this: var test = { a:function() { array = new array(); array[0] = new array("1","2","3"); array[1] = new array("name","age","blabla"); }, b: function() { var c = new this.a(); alert(c); //output:: object object alert(c.array[1]); // output:: undefined alert(c.array[1][0]); // output undefined } } how can alerted example alert(c.array[1][0]) output "name". in other languages possible use methodes inherited classes in javascript. think(hope) it's possible, how? painkiller you'd have change a: a:function() { this.array = new array(); this.array[0] = new array("1","2","3"); this.array[1] = new array("name","age","blabla"); }, if change it, you'd better this: a:function() { this.array = [ [ "1", "2", "3" ], [...

command line - Halt PHP CLI script to give the user possibility to exit with CTRL-C -

how pause execution of command line script give user possibility exit ctrl + c ? for example have script deleting user id number of tables, halt script before doing it: <?php define('dbhost', '/tmp'); define('dbname', 'xxx'); define('dbuser', 'yyy'); define('dbpass', 'zzz'); $tables = array('pref_game', 'pref_hand', 'pref_luck', 'pref_match', 'pref_misere', 'pref_money', 'pref_pass', 'pref_rep', 'pref_status', 'pref_users' ); if ($argc != 2) exit("missing user id\n"); if (!preg_match('/^([a-z]{2}[0-9]+)$/', $argv[1], $matches)) exit("invalid user id\n"); $id = $matches[1]; printf("deleting user %s press ctrl-c abort\n\n", $id)...

objective c - in iphone apps,,about web service -

hii every one, in iphone apps can use soap protocal accessing web service, should pass data in xml format,,is there protocol can used on iphone in data should not passed in form of xml,,,,,thanx in advance have heard asi? check out: http://allseeing-i.com/asihttprequest/ using wrapper can send post data in nsdictionary . there plenty of other useful wraps.

PHP MySQL counter/loop query -

i'm doing mysql query search items in database. i've pulled variables out of search form i'm having problems clause. don't want search on fields haven't been input in form. code have @ minute is: $query = " select requestid, clients.clientname, clients.username, requestassignee, requests.statusid, requests.priorityid, statusname, priorityname requests inner join clients on requests.clientid = clients.clientid inner join statuses on requests.statusid = statuses.statusid inner join priorities on requests.priorityid = priorities.priorityid "; if(!empty($requestid)) { $query2 .= "requestid = '" . $requestid . "' or "; ...

cocoa - NSPredicate for 2-level drill-down? -

a core data entity has to-many relationship entity b, has to-many relationship entity c, has 2 attributes:type , value. a =>> b =>> c (so: a.bs.cs.type, a.bs.cs.value) whats nsarray filter predicate a's have b has c has (type=='test1' && value=='test2')? the subquery samples i've seen go 1 level deep. i tried [nscompoundpredicate andpredicatewithsubpredicates:] subpredicate 1) "any bs.cs.type=='test1'" , subpredicate 2) "any bs.cs.value=='test2'", nothing returned. yes, i've looked @ nspredicate & friends docs, can't find multi-level drilldowns. you need use nsexpression +expressionforsubquery:usingiteratorvariable:predicate: or expression syntax documented there. i think case like (subquery(bs, $b, subquery($b.cs, $c, $c.type=='text1' && $c.value='test2').@count != 0 ).@count != 0)

apache - mod_rewrite infite loop -

i have apache 2.2 , 3 virtual hosts on , mod_rewrite infinite lopp isssue cannot resolve. apache in company lan on 192.168.1.228 ip address. 2 virtual hosts work perfectly. third makes problems. network admin created subdomain point 192.168.1.228. virtual host configured way: <virtualhost 192.168.1.228> documentroot "c:/apache/htdocs/stansrodowiska" servername giostube.mycompany.local limitinternalrecursion 1000 <directory "c:/apache/htdocs/stansrodowiska"> options indexes followsymlinks includes allowoverride none order allow,deny allow rewriteengine on rewritecond $1 !^(index\.php|images|upload|css|download|assets|js|nfos|robots\.txt) rewriterule ^(.*)$ /stansrodowiska/index.php/$1 [l] </directory> </virtualhost> if access website lan on address: http://giostube.mycompany.local/ 403 forbidden don't have permission access /stansrodowiska/index.php/stansrodowiska/ind...

java - How do I append data all into one dialog box? -

i have problem address book program. view entries address book, displayed in different dialog boxes. first entry displayed in first dialog box , if click "ok" next entry shown in dialog box. want entries shown in 1 dialog box. here's getter method: public string getinfo(){ string info = "name\taddress\tphone no.\te-mail add\n" + name +"\t " + add +"\t "+ phoneno +"\t "+ email +"\n"; return info; } here's how display information: public void viewall() { (int = 0; < counter; i++) { joptionpane.showmessagedialog(null, new jtextarea(entry[i].getinfo())); } } hope can me... in advance :) in order view entries inside 1 dialog box, can try creating string add entries. see code below: public string getinfo() { string content = "\t" + name + "\t"+ address + "\t\t" + telno + "\t" + em...

= and , operators in Perl -

please explain apparently inconsistent behaviour: $a = b, c; print $a; # prints: b $a = (b, c); print $a; # prints: c as eugene's answer seems leave questions op try explain based on that: $a = "b", "c"; print $a; here left argument $a = "b" because = has higher precedence , evaluated first. after $a contains "b" . the right argument "c" , returned show soon. at point when print $a printing b screen. $a = ("b", "c"); print $a; here term ("b","c") evaluated first because of higher precedence of parentheses. returns "c" , assigned $a . so here print "c" . $var = ($a = "b","c"); print $var; print $a; here $a contains "b" , $var contains "c". once precedence rules perfectly consistent

BlackBerry browser caching even with no-cache meta tags -

okay so, firstly website user sees list of tasks uncomplete. should work user clicks complete button , item no longer shows, seems not though! when click 'complete' item have onclick function executes sql update statement , response.redirect page, sql statement executes correctly, page redirect list item still there! if user exits page , comes list item has disappeared, makes me think page caching, have put following in place stop this: <meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0" /> <meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="expires" content="-1" /> which fine on blackberry bold running os 5.0, not work customers blackberry bold running os 4.x any ideas of appreciated. try this: <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <meta ht...

Mercurial Clone Error -

everytime try clone repo local laptop testing server (using ssh), .hg directory thing clones, , source never gets copied. im not sure causing this, since unusual behavior. ideas? thanks local app sys .hg clone command hg clone repo ssh://user@host/repo server after clone .hg that's expected. see hg clone : it possible specify "ssh://" url destination, no .hg/hgrc , working directory created on remote side. please see "hg urls" important details "ssh://" urls. if log server after clone, should able run hg update in remote repository create working directory.

discrete math arrays and binary relations -

given 2 arrays , b both of length m . given binary relation r. specify formally program determine whether corresponding elements of , b related relation r. assuming testing whether a[i] r b[i] : for i=1..m: if not (a[i] r b[i]): return false return true

Parsing an XML navigation sitemap with PHP -

i implementing php sitemap parser xml file. doing relatively well. however, need parser more dynamic. need implement recursive function continue looping every child_node found. node can contain many child_nodes within child_node. did till implement seperate foreach loop different variable names every child_node not acceptable not flexible. this xml file: <sitemap> <node> <id>rootnode</id> <link>home.html</link> </node> <node> <id>about</id> <link>about.html</link> </node> <node> <id>contact</id> <link>contact.html</link> <child_node> <id>contact_uk</id> <link>contact_uk.html</link> <child_node> <id>customer_support_uk</id> <link>customer_support_uk.html</link> ...

java - ServerSocket reuseAddress allow bind to an already bound port? -

when using netty , surprised if use reuseaddress option, allows serversocket bind same address without raising "already bind exception" serverbootstrap bootstrap = new serverbootstrap( new nioserversocketchannelfactory(executors .newcachedthreadpool(), executors.newcachedthreadpool())); bootstrap.setpipelinefactory(new channelpipelinefactory() { @override public channelpipeline getpipeline() throws exception { channelpipeline p = pipeline(); p.addlast("handler", new dummyhandler()); return p; } }); bootstrap.setoption("reuseaddress", true); bootstrap.bind(new inetsocketaddress(2000)); bootstrap.bind(new inetsocketaddress(2000)); i thought reuseaddress allows new socket reuse close-wait socket, different. following result of netstat command c:\users\secmask>netstat -a -n|gr...

c# - Questions about IoC -

i studying high coupling between classes, ioc. ask questions: i using ninject; layer should put dlls ninject when create setup send client, dlls ninject go customer? i've been studying internet , came following conclusion: a. inversion of control when changed classes , not instance them within own class, passing parameters or using tools ninject b. dependency injection when add project interfaces rather concrete classes. ad2. have add ninject dlls setup. ad3. inversion of control (ioc) has nothing interfaces , classes. can have highly coupled code inversion of control. class godclass { void dosth(int param) { switch (param) { case 0: console.writeline("param 0"); break; case 1: console.writeline("param 1"); break; } } } and ioc like: class goodclass { dictionary<int, baseclass> _consolewriters; public goodclass( ienumerable<baseclass> writers ) { ...

ssh tunnel - SSH two computers behind firewalls through external server -

i own 2 computers @ university. both of them behind sort of firewall etc. disallows me directly connect them on network. can both ssh public computers, can't figure out how ssh 1 other. run small website. question is, can use public address of website somehow connect 2 computers without information flowing through website , eating bandwidth? ideally i'd create ssh tunnel between 2 computers. i've tried hamachi, doesn't play macs anymore , i'd more control on connection. let's assume want ssh machinea machineb (both @ university) going through serverc (your public server). you need run sshd on serverc , on machineb. run following commands, assuming sshd listening on port 22 on machineb , serverc : # forward incoming connections serverc:22000 machineb:22 (on machineb) ssh -r22000:127.0.0.1:22 -n user@serverc # forward incoming connections 127.0.0.1:22000 serverc:22000 (on machinea) ssh -l22000:127.0.0.1:22000 -n user@serverc # establish l...

mapreduce - Hadoop, hardware and bioinformatics -

we're buy new hardware run our analyses , wondering if we're making right decisions. the setting: we're bioinformatics lab handling dna sequencing data. biggest issue our field has amount of data, rather compute. single experiment go 10s-100s of gb, , typically run different experiments @ same time. obviously, mapreduce approaches interesting (see http://abhishek-tiwari.com/2010/08/mapreduce-and-hadoop-algorithms-in-bioinformatics-papers.html ), not our software use paradigm. also, software uses ascii files in/output while other software works binary files. what might buying: machine might buying server 32 cores , 192gb of ram, linked nas storage (>20tb). seems interesting setup many of our (non-mapreduce) applications, such configuration prevent implementing hadoop/mapreduce/hdfs in meaningful way? many thanks, jan. you have interesting configuration. disk io nas storage used you? make decision based on following: map reduce paradigm used solve p...

asp.net - Adding C# Web Form to VB Web Application -

is there way add c# web form asp.net 4.0 web application written in vb.net? had asp.net 2.0 web site converted asp.net 4.0 web application . written in vb.net couple pages had c# code behinds. i've read following article (the end section mulitple languages): http://msdn.microsoft.com/en-us/library/t990ks23.aspx but not seem following 2 reasons 1) when converted site application, didn't seem add app_code folder @ 2) i'm not looking write simple class, want able add web form c# code behind when try add new item , select type of item want add, given option add visual basic web form. i have workaround right now. if need new web form c# code behind, take 1 of old c# web forms , copy , paste form , c# code behind project , rename , change class name well. make changes , need do. seems work, wondering if there easier way. you might wonder why want put c# forms in vb app. wrote app in vb (not versed in c# can read it). have programmer working me more efficient c#...

android - Discovering URI of intents -

i have been reading quite bit intents , like, , have been trying avoid having post question. believe happens set uri , passes data intent (please correct me if i'm wrong), interested in using calculator app on phone, don't know how determine uri's available of given package (assuming uri correct terminology). (i'd happy android native apps or "open" apps). the intents list: google apps has think you're asking for.

.net - Will using MTOM for small size xml data affect performance? -

i have few services hosted on server. 1 service transfers zip file client ~2kb. 1 transmits xml representation of dataset ~ 10kb. others transfer small amounts data ~<1kb. file transfer service , data set service potentially grow in size in future. will harm if use 1 binding 3 of these services 1 binding using mtom encoding? wcf/mtom smart enough know when optimize? if mtom enabled, wcf won't use unless message being sent on size. yes, can enable without impacting small messages. haven't found documentation says size is. it's worth noting mtom applies binary data (ie: byte array). if you're returning class gets xml serialized instead, mtom unlikely you. in experience returning array of 1000 of custom class still sent xml text. you're returning i'm not sure you'll gain anything. marc gravell's answer talks how around turning dataset byte array.

python - Raw MySQL with SQLAlchemy using Pyramid framework -

i have made decision start using pyramid (python web framework) projects on. i have decided use sqlalchemy, , want use raw mysql (personal reasons) still keep orm features. the first part of code in models.py reads: dbsession = scoped_session(sessionmaker(extension=zopetransactionextension())) base = declarative_base() now here how exectue query create table using raw mysql. the traditional sqlalchemy way be: class page(base): __tablename__ = 'pages' id = column(integer, primary_key=true) name = column(text, unique=true) data = column(text) def __init__(self, name, data): self.name = name self.data = data dbsession.execute('create table ....') have @ sqlalchemy.text() parametrized queries.

How to sequentially rename files (in PHP) that carry on from a sequence of already existing files? -

say have source folder bunch of files in this 0_0.jpg 0_1.jpg 0_2.jpg 0_3.jpg 1_0.jpg 1_1.jpg 1_2.jpg 1_3.jpg 2_0.jpg 2_1.jpg 2_2.jpg 2_3.jpg and have target folder has exact same filenames in it. how can add files source folder target folder filenames come out this: 0_0.jpg 0_1.jpg 0_2.jpg 0_3.jpg 1_0.jpg 1_1.jpg 1_2.jpg 1_3.jpg 2_0.jpg 2_1.jpg 2_2.jpg 2_3.jpg ---------- files source folder 3_0.jpg 3_1.jpg 3_2.jpg 3_3.jpg 4_0.jpg 4_1.jpg 4_2.jpg 4_3.jpg 5_0.jpg 5_1.jpg 5_2.jpg 5_3.jpg is there reasonable way to in php ? use scandir ( http://php.net/scandir ) loop through files , last file in first directory. parse out numbers determine starting path second directory. loop through files in second directory , rename ( http://php.net/rename ). edit: as suggested @toby in comments, split('_',$var) return array of items in string divided on _ allowing easy access 2 numbers in filename

algebra - Define a connectivity graph in Prolog -

i'm continuing researches in lattices , semilattices , having question. basically, have relationlist of [a,b] pairs, means (a,b) edge. should know, graph formed relationlist 1-connectivity or not. way, have ordered graph, order of (a,b) important. clear_link(x, y, relationlist) :- (member([x,y], relationlist) ; member([y,x], relationlist)), x =\= y. linked(x, y, relationlist) :- clear_link(x, y, relationlist), !. linked(x, y, relationlist) :- clear_link(x, z, relationlist), linked(z, y, relationlist). simple_connect(relationlist, e) :- forall((member(x, e), member(y, e), x < y), linked(x, y, relationlist)). but, 6-element graph have stackoverflow. ?- simple_connect([[2,1],[2,3],[4,3],[4,5],[6,5]],[1,2,3,4,5,6]). error: out of local stack am defining wrong? i've correct some. it's fine clear_link(x, y, relationlist) :- member([x,y], relationlist), x =\= y. linked(x, y, relationlist) :- cl...

css - Personal Google search bar blocking jQuery underneath -

Image
i added google search bar website. how found blocking navigation underneath when search not active. if bring navigation z-index displayed on search results. how make buttons "clickable" when search bar not rolled down. view page here http://etterengineering.com/sampleindex.html here html: <div id="cse-search-form" style= "z-index:999999; top:0px;"></div> <div id="cse-search-form" style="width: 100%;"></div> <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load('search', '1', {language : 'en', style : google.loader.themes.shiny}); google.setonloadcallback(function() { var customsearchcontrol = new google.search.customsearchcontrol('012677673255316824096:sean13fvlei'); customsearchcontrol.setresultsetsize(google.search.search.filtered_cse_resultset); ...

Rails - Acts as nested - Enforcing a Max Level -

i'm using gem 'nested_set' comment threading. what want prevent comment level going more 2 levels deep. tired doing this: class comment < activerecord::base .... before_save :ensure_max_nestedset_level private # don't want comments go more 2 levels deep. that's overkill def ensure_max_nestedset_level if self.level > 2 self.level = 2 end end end but looks cant set level obtain objects level. goal being enforce max of 2 levels deep comment threading. can suggest way enforce happening? the use case being: comment main (level 0) comment reply (level 1) comment reply xxxx (level 2) when user replies last 1 (about xxxx) don't want comment set level of 3, want cap @ 2. ideas? thanks this seems work, though there might better solution. class comment < activerecord::base acts_as_nested_set after_save :check_level def check_level if level > 2 move_to_child_of(par...

sniffer - How to sniff / monitor SVN protocol messages? (or any TCP messages from an application) -

i monitor incomming svn protocol requests / repsonses svn server (1.6, using collabnet edge 1.3.1). or option, monitor svn trafic comming client (.net app) i don't mind writing code it, i'm sure there should straight forward way this if using apache webdav frontend subversion; can view apache access logs.

iphone - Crash Error Help NSString -

i have code looks this: nsstring *_parse = [nsstring stringwithformat:@"//%@",_user]; nsstring *_status = [parser parse:_parse:@"status"]; //parses xml if ([_status isequaltostring:@"1"]) { //error here } the application crashes when checks if strings equal. however, works fine when replace first line of code this: nsstring *_parse = [nsstring stringwithformat:@"//user1"]; but not use "user" ivar need used because value can different. ivar "user" nsstring declared earlier [self setuser:@"userx"]; should fix this? thanks edit: here code parses xml: + (nsstring *)datafilepath:(bool)forsave { nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nsstring *documentspath = [documentsdirectory stringbyappendingpathcomponent:@"hangout.xml"]; return documentspath; ...

Does Visual Studio have a setting for saving the swap panes when viewing xaml? -

i swapping panes when viewing xaml (xaml on top, design on bottom or not showing @ all). there place in visual studio can set default how want view xaml files? my google powers haven't revealed anything... there not default setting xaml on top/bottom. however, there default setting open document in full xaml view: tools > options > text editor > xaml > miscellaneous: open document full xaml view

cocoa - Autoselect, focus and highlight a new NSOutlineView row -

Image
this lack of experience nsoutlineview can't see way this. have nsoutlineview (implemented excellent pxsourcelist ) add button totally functional in aspect save/write/insert/delete rows correctly. not use nstreecontroller , , don't use bindings. add entity using following code: - (void)addentity:(nsnotification *)notification { // create core data representation, , add child parent node uabasenode *node = [[uamodelcontroller defaultmodelcontroller] createbasenode]; [sourcelist reloaddata]; (int = 0; < [sourcelist numberofrows]; i++) { if (node == [sourcelist itematrow:i]) { [sourcelist selectrowindexes:[nsindexset indexsetwithindex:i] byextendingselection:no]; [sourcelist editcolumn:0 row:i withevent:nil select:no]; break; } } } when add button pressed, new row inserted this: if click away, select row , press enter edit it, looks this: my question is: how can programmatically same state (...