Posts

Showing posts from April, 2014

security - What's the bare minimum permission set for Sql Server 2005 services? -

best practices recommend not installing sql server run system. bare minumum need give user account create it? by default, sql server 2005 installation create security group called sqlserver2005mssqluser$computername$mssqlserver correct rights. need create domain user or local user , make member of group. more details available in sql server books online: reviewing windows nt rights , privileges granted sql server service accounts

c# - How did my process exit? -

from c# on windows box, there way find out how process stopped? i've had @ process class, managed nice friendly callback exited event once set enableraisingevents = true; have not managed find out whether process killed or whether exited naturally? fire process monitor (from sysinternals, part of microsoft), run process , let die, filter process monitor results process name -- able see did, including exit codes.

string - How can I replace newline characters using JSP and JSTL? -

i have list of bean objects passed jsp page, , 1 of them comment field. field may contain newlines, , want replace them semicolons using jstl, field can displayed in text input. have found 1 solution, it's not elegant. i'll post below possibility. here solution found. doesn't seem elegant, though: <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <% pagecontext.setattribute("newlinechar", "\n"); %> ${fn:replace(item.comments, newlinechar, "; ")}

Access to Result sets from within Stored procedures Transact-SQL SQL Server -

i'm using sql server 2005, , know how access different result sets within transact-sql. following stored procedure returns 2 result sets, how access them from, example, stored procedure? create procedure getorder (@orderid numeric) begin select order_address, order_number order_table order_id = @orderid select item, number_of_items, cost order_line order_id = @orderid end i need able iterate through both result sets individually. edit: clarify question, want test stored procedures. have set of stored procedures used vb.net client, return multiple result sets. these not going changed table valued function, can't in fact change procedures @ all. changing procedure not option. the result sets returned procedures not same data types or number of columns. the short answer is: can't it. from t-sql there no way access multiple results of nested stored procedure call, without changing stored procedure others have suggested. to complete, if proced...

javascript - Watermark text in asp.net? -

in web application using javascript water mark text in textboxes working fine textbox if textmode property set multiline water mark text not displaying there particular reason. code... <textbox id="txtone" runat="server" tooltip="enter comments" onblur="if(this.value=='') this.value='enter text,150 characters only';" onfocus="if(this.value == 'enter text,150 characters only') this.value='';" value="enter text,150 characters only"> </textbox> when textbox in multiline mode, it's rendered textarea instead of input element. textarea element doesn't use value attribute, code fails set initial value. use text property of server control instead of value argument of client control: <textbox id="txtone" runat="server" tooltip="enter comments" onblur="if(this.value=='') this.value='enter text,150 character...

java - Slowing down the playback of an audio file without changing its pitch? -

i working on application college music majors. feature considering slowing down music playback without changing pitch. have seen done in commercial software, cannot find libraries or open source apps this. are there libraries out there? how done scratch various file formats? note: working in java not oppossed changing languages. timestretching quite hard. more slow down or speed sound more artifacts get. if want know sound listen "the rockafeller skank" fat boy slim. there lot of ways have own strengths , weaknesses. math can complex. that's why there many proprietary algorithms. this page explains things bit clearer can , links dirac library. http://www.dspdimension.com/admin/time-pitch-overview/ i found link java code pitch shifting/timestretching http://www.adetorres.com/keychanger/keychangerreadme.html

javascript - How to track iPhone orientation in google analytics? -

we're getting ready deploy mobile version of our website , we'd track iphone orientation within google analytics. i'm guessing should custom variable because don't see pre-defined way track under mobile tab analytics reports. i'm not sure how detect current orientation of iphone when page loads, however. when searching answer detect see lot of suggestions apps, none safari when viewing web pages. did miss question, or know how detect iphone orientation within safari? thanks in advance! edit: mobile safari orientation events coupled analytics track js events i'm pretty sure iphone browser reports same display width (javascript:screen.width) regardless of orientation. makes impossible track such data in mobilesafari. i'm looking somewhere can confirm test on own device or emulator or emulator .

actionscript 3 - Accessing .NET Web Service securely from Flex 3 -

we can consume .net 2.0 web service flex/as3 application. aside ssl, how else can make security more robust (i.e., authentication)? you can leverage asp.net's built in session management decorating webmethods <enablesession()> then, inside method, can check user still has valid session.

.net - Problem accessing AppSettings via configSource in Windows Server 2003 -

according msdn documentation , configsource supported on windows server 2003 sp2. however, when try access setting using following syntax: system.configuration.configurationmanager.appsettings["settingname"]; then null returned. however, same app works on windows 7 , windows xp (i.e. appsettings["settingname"] returns expected value when using configsource ). the file configsource points exists sure, since copied entire application directory windows 7 server 2003 testing. any ideas? you have incomplete application manifest file. need add "assemblyidentity" element. details here . there ms connect bug here .

How do I get a particular labeled version of a folder in Borland StarTeam? -

i'm perform bunch of folder moving operations in starteam (including new nesting levels) , set label can roll in case of issues. figured out how set label on folder , children, couldn't figure out how version of folder corresponding particular label. seems labels tied files , not folders/folder structure. i've switched subversion , fogbugz rusty on starteam. think need view label. from view menu, select labels... open labels dialog. on view tab, click new... button open view label dialog. type in label name "release 1.2.3.4", check frozen , , hit ok . to state, from view menu, select select configuration... open select view configuration dialog. select labeled configuration , , pick "release 1.2.3.4" you can create new view view label branch off want to. see file > working starteam > managing views . here's quote configuring view : by default, view has current configuration – is, displays latest r...

ruby on rails - Date and Time in ROR -

in app want time/date display month/year (e.g. 7/10). problem class date , class time wind following code in application controller ... class date def as_month_and_year self.strftime("%m").to_i.to_s + self.strftime("/%y") end end class time def as_month_and_year self.strftime("%m").to_i.to_s + self.strftime("/%y") end end what's best way dry up? imho more elegant solution: module datetimeextensions def as_months_and_year self.strftime('%m/%y').sub(/^0/,'') end [time, date, datetime].each{ |o| o.send :include, self } end

Text editor in Windows with real time update? -

what's text editor in windows automatically updates view whenever opened file has been modified process? need watch output of program. if using mouse, notepad++ great if you're happier keyboard, me, has emacs . here's download windows. to use feature in emacs, add following .emacs: (global-auto-revert-mode t) there lots of people @ work textpad don't understand why, doesn't have column editing.

python - Getting random row through SQLAlchemy -

how select a(or some) random row(s) table using sqlalchemy? this database-specific issue. i know postgresql , mysql have ability order random function, can use in sqlalchemy: from sqlalchemy.sql.expression import func, select select.order_by(func.random()) # postgresql, sqlite select.order_by(func.rand()) # mysql select.order_by('dbms_random.value') # oracle next, need limit query number of records need (for example using .limit() ). bear in mind @ least in postgresql, selecting random record has severe perfomance issues; here article it.

python - How do you retrieve items from a dictionary in the order that they're inserted? -

is possible retrieve items python dictionary in order inserted? the standard python dict isn't able this. there proposal ( pep 372 ) add "ordered dictionary" (that keeps track of order of insertion) collections module in standard library. includes links various implementations of ordered dictionaries (see these two recipes in python cookbook). you might want stick reference implementation in pep if want code compatible "official" version (if proposal accepted). edit: pep accepted , added in python 2.7 , 3.1. see the docs .

javascript - What are the CSS secrets to a flexible/fluid HTML form? -

the below html/css/javascript (jquery) code displays #makes select box. selecting option displays #models select box relevant options. #makes select box sits off-center , #models select box fills empty space when displayed. how style form #makes select box centered when form element displayed, when both select boxes displayed, both centered within container? var cars = [ { "makes" : "honda", "models" : ['accord','crv','pilot'] }, { "makes" :"toyota", "models" : ['prius','camry','corolla'] } ]; $(function() { vehicles = [] ; for(var = 0; < cars.length; i++) { vehicles[cars[i].makes] = cars[i].models ; } var options = ''; (var = 0; < cars.length; i++) { options += '<option value="' + cars[i].makes + '">' + cars[i].makes + '</option>'; } ...

Is there a sample MySQL database? -

i learn sql creating , running queries. however, not seem great idea build bogus data, so, know free sample database download? see theses links mysql documentation: other mysql documentation - example databases mysql sample database any sample mysql databases can download?

layout - What is the best way to position a div in css? -

i'm trying place menu: <div class="left-menu" style="left: 123px; top: 355px"> <ul> <li> categories </li> <li> weapons </li> <li> armor </li> <li> manuals </li> <li> sustenance </li> <li> test </li> </ul> </div> on left hand side of page. problem if use absolute or fixed values. different screen sizes render navigation bar differently. have second div contains main content needs moved right, far i'm using relative values seems work no matter screen size. float indeed right property achieve this. however, example given bmatthews68 can improved. important thing floating boxes must specify explicit width. can rather inconvenient way css works. however, notice px unit of measure has no place in world of html/css, @ least not specify widths. always resort measures work diff...

language agnostic - What Makes a Good Unit Test? -

i'm sure of writing lots of automated tests , have run common pitfalls when unit testing. my question follow rules of conduct writing tests in order avoid problems in future? more specific: properties of unit tests or how write tests? language agnostic suggestions encouraged. let me begin plugging sources - pragmatic unit testing in java junit (there's version c#-nunit too.. have one.. agnostic part. recommended.) good tests should a trip (the acronymn isn't sticky enough - have printout of cheatsheet in book had pull out make sure got right..) automatic : invoking of tests checking results pass/fail should automatic thorough : coverage; although bugs tend cluster around regions in code, ensure test key paths , scenarios.. use tools if must know untested regions repeatable : tests should produce same results each time.. every time. tests should not rely on uncontrollable params. independent : important. tests should test 1 thing @ time. mult...

openfire - Google Wave Server Installation -

i trying install google wave server on linux virtual machine local host. followed instructions given on wave-protocol installation wiki http://code.google.com/p/wave-protocol/wiki/installation i'm getting error when run run-server.sh script. $ ./run-server.sh jul 23, 2010 10:02:24 org.waveprotocol.wave.examples.fedone.waveserver.waveserverimpl info: wave server configured host local domains: [muranaka-desktop] jul 23, 2010 10:02:24 org.waveprotocol.wave.examples.fedone.waveserver.waveserverimpl severe: failed add our own signer info certificate store org.waveprotocol.wave.crypto.signatureexception: certificate validation failure couldn't connect xmpp server:org.xmpp.component.componentexception: conflict jul 23, 2010 10:02:25 org.waveprotocol.wave.examples.fedone.servermain run info: starting server jul 23, 2010 10:02:25 org.waveprotocol.wave.examples.fedone.servermain main severe: ioexception when running server: address in use in run-config.sh script set hostn...

oop - What are the pros and cons of object databases? -

there lot of information out there on object-relational mappers , how best avoid impedance mismatch, of seem moot points if 1 use object database. question why isn't used more frequently? because of performance reasons or because object databases cause data become proprietary application or due else? familiarity. administrators of databases know relational concepts; object ones, not much. performance. relational databases have been proven scale far better. maturity. sql powerful, long-developed language. vendor support. can pick between many more first-party (sql servers) , third-party (administrative interfaces, mappings , other kinds of integration) tools case oodbmss. naturally, object-oriented model more familiar developer , and, point out, spare 1 of orm. far, relational model has proven more workable option. see recent question, object orientated vs relational databases .

javascript - Preventing the loss of keystrokes between pages in a web application -

my current project write web application equivalent of existing desktop application. in desktop app @ points in workflow user might click on button , shown form fill in. if takes little time app display form, expert users know form , start typing, knowing app "catch them". in web application doesn't happen: when user clicks link keystrokes lost until form on following page dispayed. have tricks preventing this? have move away using separate pages , use ajax embed form in page using gwt , or still have problem of lost keystrokes? keystrokes won't have effect until page has loaded, javascript has been processed , text field focused. basically asking is; how speed web application increase response times? anwser ajax! carefully think common actions in application , use ajax minimise reloading of webpages. remember, don't over-use ajax. using javascript can hinder usability as can improve it. related reading material: response times: 3 i...

http - Apache find the sender of get request -

what's easiest way find sender of request apache? keep seeing error logs imply page/application sending request favicon file, nonexistent. grep'd entire webhost directory not single file in there referencing nonexistent favicon file. is there way find out or sending request file? apache 2 on centos. nevermind, modern browsers request favicon files regardless.

css - How to make a DIV take up the remainder of the page? -

i have following html: <html> <body> <h2>title</h2> <div id='large_div'> blah.. blah.. blah.. </div> </body> </html> how can make large_div take rest of page height? here css page: html { height: 100%; } body { height: 100%; } #large_div { /* ??? */ } you try setting negative margin on #large_div equal height of h2. unfortunately not solid code since h2 height change depending on text length , browser: #large_div { height: 100%; margin-top: -1em; /* adjust height of h2 */ } a bit of jquery sort out though: $(document).ready(function(){ $('#large_div').css({height: $(window).height() - $('h2').height()}); });

SQL injection hacks and django -

coming jsp , servlet background interested know how django copes sql injection hacks. servlet , jsp developer use prepared statements gives me form of protection. how django cope custom queries, example custom search field. if use querysets, django escape variables automatically. if use raw queries or things .extra method you'll have take care , example use parameter binding. more information whole thing can found here (also resource other security concerns).

Should you design websites that require JavaScript in this day & age? -

it's fall of 2008, , still hear developers should not design site requires javascript. i understand should develop sites degrade gracefully when js not present/on. @ point not include funcitonality can powered js? i guess question comes down demographics. there numbers out there of how many folks browsing without js? 5% according these statistics: http://www.w3schools.com/browsers/browsers_stats.asp

svn - VisualSVN Server wants a username and password -

i've renamed server , trying visualsvn server repository via tortoisesvn. in this post gordon helped me find right command - gordon. now visualsvn server asking me username , password. don't recall setting 1 , if did i've forgotten it. idea how reset username / password? it depends on how visual svn server set up. if using native windows authentication, enter domain username , password. otherwise, have log machine running visual svn server , reset password there. visual svn server provides convenient tool managing users, passwords, permissions, etc. tool should available start menu on server.

web applications - javascript webapp development -

i confused web application development. read w3 , apple choose , recommend javascript developing web apps heard developing web apps need create back-ends java. can learn html5/css3/javascript , develop complete webapps using technologies? thanks think of circle. backend language, php, asp (.net) java, etc exists backend build frontend. html, javascript, css frontend. sure, can website solely in html , css, without backend code, we'd building pages static. user interacts application, goes server , processed , on , forth....hence circle. html can't talk directly database, essential apps out there. hence reason it's near impossible away back-end development. i've worked in java shop before...the reason many big operations use because it's considered in many circles "enterprise grade" government, banks, perhaps apple rely on power corporate apps , websites in many cases. java basis other languages, , structure , nuances copied in many...

osx - What is the best way to log out another user from their session on macOS? -

in other words: log on bert (who administrator) using fast user switching, log on ernie (bert remains logged on) switch bert bert logs ernie off what best way achieve step 4? this forum post has bash script osx should trick. takes username argument , logs off user. i've not tried it, mileage may vary. looks suits needs. trying achieve?

Generating sequence number in C# -

i working on asp.net using c# want generate sequence id should this: elg0001 , elg0002, ... elg prefix , 0001 should in sequence i using sql server 2005 this id generated , added database. how can this? can me coding? here's simple id generator sql server: create table idseed ( id int identity(10001,1) ) go create procedure newsequenceid ( @newid char(7) out ) begin insert idseed default values select @newid = 'elg' + right(cast(scope_identity() nvarchar(5)), 4) end go /* * test newsequenceid proc */ declare @testid char(7) exec newsequenceid @testid out select @testid the idseed table continue accumulate rows. not issue, if problem can purge table script on regular basis. part left call procedure c# code , retrieve value of @testid parameter. this example based on question: sequence not expected exceed 9999 elements. have modify code support larger sequence ids. note transaction not necessary in procedure newseque...

java - Panel not shown for 2D Animation -

i trying create 2d animation in java of moving line on panel(a line moving 1 point in panel). hope possible. here's code used. private void movingline(int length) throws interruptedexception { for(int = 0; + length < width; i++){ for(int j = 0; j + length < height; j++){ eraseline(); drawline(color.cyan, i, j, i+length, j+length); erase = true; } } } private void eraseline() { if(erase){ fillcanvas(color.blue); } } on running code, panel doesn't show up. here's code draw line. public void drawline(color c, int x1, int y1, int x2, int y2) { int pix = c.getrgb(); int dx = x2 - x1; int dy = y2 - y1; canvas.setrgb(x1, y1, pix); if (dx != 0) { float m = (float) dy / (float) dx; float b = y1 - m*x1; dx = (x2 > x1) ? 1 : -1; while (x1 != x2) ...

Sending Email in C# WinForms VS ASP.NET C# -

i wondering if else has had same problem me. i trying send emails simple form using asp.net (vb/c# don't care), , head in severely fact seems harder send email using asp.net in winforms! in winforms, can write code send email in 2 minutes. after reading tutorial after tutorial on asp.net cannot figure out how it! it's weird. one thing don't none of examples demonstrate use of mail.username = ""; or mail.password = ""; (for example). don't seem use usernames or passwords when connecting server. how can send email in asp.net in c# winforms, or atleast if not same way, there simple way? thank you using username/password: http://www.aspnettutorials.com/tutorials/email/email-auth-aspnet2-csharp.aspx

c - Is this hack valid according to standard? -

this struct hack. valid according standard c? // error check omitted! typedef struct foo { void *data; char *comment; size_t num_foo; }foo; foo *new_foo(size_t num, blah blah) { foo *f; f = malloc(num + sizeof(foo) + max_comment_size ); f->data = f + 1; // ok? f->comment = f + 1 + num; f->num_foo = num; ... return f; } yes, it's valid. , encourage doing when allows avoid unnecessary additional allocations (and error handling , memory fragmentation entail). others may have different opinions. by way, if data isn't void * can access directly, it's easier (and more efficient because saves space , avoids indirection) declare structure as: struct foo { size_t num_foo; type data[]; }; and allocate space amount of data need. [] syntax valid in c99, c89-compatibility should use [1] instead, may waste few bytes.

javascript - jQuery question about looping through an array -

i have array this: var gridarray = [ 1,2,0,1,2,3,2,1,2,3,4,4,3,2,2,2,0 ] and jquery each() function this: $('li.node').each(function() { loop through array var rndtile = current array digit $(this).css({ 'background-image': 'url(images/'+arraydigit+'.jpg' }); }); how implement this? you need pass parameters each callback. $(gridarray).each(function (i, val) { // index in loop. // val value @ gridarray[i] in loop. });

c++ - Best way to implement performing actions on tree nodes, preferably without using visitors -

i have user interface tree view on left, , viewer on right (a bit email client). viewer on right displays detail of whatever have selected in tree on left. the user interface has "add", "edit" , "delete" buttons. these buttons act differently depending on "node" in tree selected. if have node of particular type selected, , user clicks "edit", need open appropriate edit dialog particular type of node, details of node. now, there's lot of different types of node , implementing visitor class feels bit messy (currenty visitor has 48 entries....). work nicely though - editing have openeditdialog class inherits visitor, , opens appropriate edit dialog: abstracttreenode->accept(openeditdialog()); the problem have implement abstract visitor class every "action" want perform on node , reason can't thinking i'm missing trick. the other way of been implement functions in nodes themselves: abstracttreen...

Where to download GlassFish plugins for Eclipse 3.6 (Helios) -

would please me download glassfish plugins eclipse 3.6 (helios). i tried ' https://ajax.dev.java.net/eclipse ' url in new software install in eclipse, doesn't work , show me 'cannot complete install because 1 or more required items not found.' error regards as of january 2011 easiest way install through eclipse marketplace. select "eclipse marketplace..." (found in menu under windows). choose "eclipse marketplace" catalog on search pane enter "glassfish" in "find" textbox. locate "glassfish tools bundle eclipse" (not older plugin), , click "install" button. the rest normal plugin installation. the distribution being changed. there new update site. full details in official announcement: http://blogs.oracle.com/theaquarium/entry/eclipse_3_6_helios_glassfish while earlier versions of eclipse developers had choice of using glassfish tools bundle eclipse (an all-in-one bundle)...

c# - Get List of connected USB Devices -

how can list of connected usb devices on windows computer? add reference system.management project, try this: namespace consoleapplication1 { using system; using system.collections.generic; using system.management; // need add system.management project references. class program { static void main(string[] args) { var usbdevices = getusbdevices(); foreach (var usbdevice in usbdevices) { console.writeline("device id: {0}, pnp device id: {1}, description: {2}", usbdevice.deviceid, usbdevice.pnpdeviceid, usbdevice.description); } console.read(); } static list<usbdeviceinfo> getusbdevices() { list<usbdeviceinfo> devices = new list<usbdeviceinfo>(); managementobjectcollection collection; using (var searcher = new managementobjectsearcher(@"select * win32_usbhub")) collection = searcher.get(); foreach (var device in co...

How do you find the namespace/module name programmatically in Ruby on Rails? -

how find name of namespace or module 'foo' in filter below? class applicationcontroller < actioncontroller::base def get_module_name @module_name = ??? end end class foo::barcontroller < applicationcontroller before_filter :get_module_name end none of these solutions consider constant multiple parent modules. instance: a::b::c as of rails 3.2.x can simply: "a::b::c".deconstantize #=> "a::b" as of rails 3.1.x can: constant_name = "a::b::c" constant_name.gsub( "::#{constant_name.demodulize}", '' ) this because #demodulize opposite of #deconstantize: "a::b::c".demodulize #=> "c" if need manually, try this: constant_name = "a::b::c" constant_name.split( '::' )[0,constant_name.split( '::' ).length-1]

c# - ASP.NET & Facebook Connect - How To Post To User's Wall Using Graph API? -

i've integrated website facebook connect, authorization/single-sign on working great. now im trying post user's wall, im having problems with. first of all, im using "old" javascript api (featureloader.js). these graph api url's im using: private const string userdetails_url = @"https://graph.facebook.com/{0}?access_token={1}"; private const string feed_url = @"https://graph.facebook.com/{0}/feed?access_token={1}"; private const string tokenexchange_url = @"https://graph.facebook.com/oauth/access_token?{0}"; i'm using tokenexchange_url url receive unique user oauth token make calls with. this working fine, because a) receive token back, , b) can issue http requests graph api (i.e userdetails_url ) , works fine. but, cannot post user's wall using feed_url . i'm pretty sure issue haven't got appropriate user permissions post wall (i.e facebook-side setting). now, realise can use fbpublish api meth...

Visual Studio keyboard shortcut to automatically add the needed 'using' statement -

what keyboard shortcut expand little red line gives menu can choose have necessary using statement added top of file? ctrl + . shows menu. find easier type alternative, alt + shift + f10 . this can re-bound more familiar going tools > options > environment > keyboard > visual c# > view.quickactions

multithreading - which one to use windows services or threading -

we having web application build using asp.net 3.5 & sql server database quite big , used around 300 super users managing around 5000 staffs. implementing sms functionality application means users able send , receive sms. every 2 minute sms server of third party pinged check whether there new messages. sms hold in queue , send every time interval of 15 30 minutes. i want checking , sending process run in background of application time, if user closes browser window. need advice on how do this? will using thread achieve or need create windows service or there other options? more information: i want execute task in timer, happen if close browser window, task wont completed isn't so. for example saving 10 records database in time interval of 5 minutes, means every 5 minutes when timer tick event fires, record inserted database. how run task if close browser window? i tried looking @ windows service how pass generic collection of data processing. there ...

sql server - How do you truncate all tables in a database using TSQL? -

i have test environment database want reload new data @ start of testing cycle. not interested in rebuilding entire database- "re-setting" data. what best way remove data tables using tsql? there system stored procedures, views, etc. can used? not want manually create , maintain truncate table statements each table- prefer dynamic. for sql 2005, exec sp_msforeachtable 'truncate table ?' couple more links 2000 , 2005/2008 ..

sql server - SQL Join Retrieves more rows than expected -

suppose have following tables students (studentid int pk, studentname nvarchar) lectures (lectureid pk, startdate, enddate) enrollment (studentid, lectureid) when execute following query: select studentid students i 8 rows.. , when execute: select s.studentid students s join enrollment en on s.studentid = en.studentid i 11 rows why that, , how use join without retrieving rows? your join fine. this means there more 1 enrollment per student - e.g. students have enrolled in more 1 lecture / series of lectures assuming student can register 1 lecture @ time, need join lecture , use date fields also, if student not enrolled in anything, need consider left outer join. so query might like select s.studentid students s left outer join enrollment en on s.studentid = en.studentid inner join lectures l on en.lectureid = l.lecture id getdate() between l.startdate , l.enddate but need have rules in place ensure student cannot concurrently register more 1 lectu...

introspection - Finding what list a class instance is in, in Python -

this problem thus: have instance of class, want know list part of, i.e. : class test_class() : def test() : print 'i member of list', parent_list foo = [test_class(), 52, 63] bar = ['spam', 'eggs'] foo[0].test() i print out member of list foo. there arbitrary number of lists given instance of test_class() belong to. first of all, don't know use-case it, because ideally while putting objects in list, can track them via dict or if have list of lists can check objects in them, better design wouldn't need such search. so lets suppose fun want know lists object in. can utilize fact gc knows objects , refers it, here which_list function tells lists refer ( doesn't mean contains it) import gc class a(object): pass class b(a): pass def which_list(self): lists_referring_to_me = [] obj in gc.get_referrers(self): if isinstance(obj, list): lists_referring_to_me.append(obj) return lists_referr...

How to set Tomcat or JBOSS or Glassfish as App-Server for GWT Web Project in eclipse -

how create , run gwt web project in eclipse tomcat or app-server? i created gwt project , when run or debug it, eclise did use gwt hosted mode server. can not find , configuration in project properties select tomcat or server project/ regards in gwt run/debug configuration of project want run/debug, tab main, deselect "run built-in server" option. after that, it's responsibility generate html/js/images of gwt module want run, , place them somewhere tomcat or jboss can see them. means deploying war @ least.

javascript - Reloading a page via AJAX when window.location=self.location doesn't work -

on homepage got: <ul id="login"> <li> <a id="loginswitch" href="./login-page">log-in</a> | </li> <li> <a id="signupswitch" href="./signup-page">sign-up</a> </li> </ul> via mootools, these anchor elements id once they're clicked, flashy div popup below them contains login or signup form (with methods stop propagation of events of course) , upon filling-up fields ajax call kicks in - that's supposed create session , reload page user have visual logged in , user-level-controls appears etc.. the ajax call initiated mootools ajax class , evalscripts option set true. ajax page returns script code: <script type="text/javascript">window.location = self.location;</script> this system works - i'm wondering why if change anchors' href values href="#" scripts won't work anymore? does have window? did change proper...

How do I start PowerShell from Windows Explorer? -

is there way start powershell in specific folder windows explorer, e.g. right-click in folder , have option "open powershell in folder"? it's annoying have change directories project folder first time run msbuild every day. in windows explorer, go address bar @ top (keyboard shortcuts: alt + d or ctrl + l ) , type powershell or powershell_ise , press enter . powershell command window opens current directory.

c++ - How to paralleize search for a string in a file with a help of fork? (GNU Linux/g++) -

i got text file couple of lines , looking string in file. need pass following command line parameters program: - file path - string looking for - maximum number of processes program allowed "fork" in order complete task. how such program should constructed? a couple of thoughts. you have open file separately each process, otherwise share single file descriptor , have shared position in file (or not, see comments, may system specific...). you may not see speed increase hoping due disk access and/or cache miss patterns. you might able beat both issues memory mapping file (well still risk increased cache miss rate)... how badly need this? runs real risk of being premature optimization. recommend against touching problem without compelling need. really.

How can I get the date and version of drivers in C#? -

this code, can name, description... managementclass mgmtclass = new managementclass("win32_systemdriver"); foreach (managementobject mo in mgmtclass.getinstances()) { name=mo["name"]; dis=mo["description"]; ... } how can date , version of drivers? you should start researching win32_pnpsigneddriver class , win32_pnpentity class example managementobjectsearcher searcher = new managementobjectsearcher("root\\cimv2", "select * win32_pnpsigneddriver"); managementobjectcollection moc = searcher.get(); foreach (var manobj in moc) { console.writeline("device name: {0}\r\ndeviceid: {1}\r\ndriverdate: {2}\r\ndriverversion: {3}\r\n==============================\r\n", manobj["friendlyname"], manobj["deviceid"], manobj["driverdate"], manobj["driverversio...

asp.net - structuremap objectfactory life time -

i've been using structuremap since couple of months. use objectfactory.getinstance take right instance of object i've use. actually, need understand default objectfactory's instancescope. threadlocal? do u know can read it? first result on google "structuremap lifecycle": http://structuremap.github.com/structuremap/scoping.htm "perrequest" default lifecycle if didnt specify 1 in registry

ruby - syslog output for log4r example -

can 1 post example of using syslog outputter log4r, using stdout want log syslog. mylog = logger.new 'mylog' mylog.outputters = outputter.stdout mylog.info "starting up." raj thanks following blog posts. angrez's blog: log4r - usage , examples programmingstuff: log4r kind of lame answering own question, found answer , adding later searches. for reason need require log4r/outputter/syslogoutputter explicitly other wise syslogoutputter cause "uninitialized constant syslogoutputter (nameerror)" error. other outputters not seem have problem. require 'rubygems' require 'log4r' require 'log4r/outputter/syslogoutputter' mylog = logger.new 'mylog' mylog.outputters = syslogoutputter.new("f1", :ident => "myscript") mylog.info "starting up." raj

linux - Is raw socket on loopback interface possible? -

we trying communicate server listening on linux loopback interface via raw socket , seems server not single packet us. packets send visible in wireshark. is raw socket on loopback possible @ all? (please, don't ask why need it: it's complicated explain here) edit: how open it _i_rawsocket = socket( pf_packet, sock_raw, htons(eth_p_all))) memset( &ifr, 0, sizeof( ifr ) ); strcpy( ifr.ifr_ifrn.ifrn_name, _interfacename); ioctl( _i_rawsocket, siocgifindex, &ifr ) memset( &sll, 0, sizeof( sll ) ); sll.sll_family = af_packet; sll.sll_ifindex = ifr.ifr_ifindex; sll.sll_protocol = htons( eth_p_all ); bind( _i_rawsocket, (struct sockaddr *) &sll, sizeof( sll )) the server lighttpd , it's reachable via normal socket on localhost. netstat --raw prints empty table i'm absolutely sure have 2 functional raw sockets on normal eth devices. raw sockets behave particularly fizzy bind() , connect(), can't confirm issue lies them. suggest fo...

video - Windows (ideally .NET callable) API to join MP4 and/or 3GP files? -

i'm working on our back-end encoder service awful lot of video transcoding, , small amount of joining of video files. the transcoding done using on2 flix engine windows works well, unfortunately isn't able join files (at least far can ascertain - neither nor support informative). i'm happy now. the joining, @ moment, done using leadtools multimedia software is, franky, dreadful. it's single threaded , requires sta uses message pump isn't desirable server application. in addition installation overwrites our working codecs load of own eval ones, , there no way avoid this. ideally i'm looking api replace leadtools multimedia one, can join 3gp and/or mp4 files. cost isn't of problem. have recommendations? i know ideal solution write our own tool here, we're intending in wmf , haven't quite transitioned win2008 yet need temporary solution couple of months. update: i should point out encoding no means area of expertise, , i've never had...

MAC OSX MySQL Query Log not writing -

i have my.cnf setting [mysqld] general_log =1 general_log_file = /var/log/mysqld.log query_cache_type=1 query_cache_size=64m also had before set [mysqld] log = /var/log/mysqld.log query_cache_type=1 query_cache_size=64m i know had working @ 1 point when went go tail today noticed wasn't working. have file in /var/log , permissions -rw-r--r-- 1 _mysql wheel 0 jul 26 10:27 mysqld.log it -rw-r--r-- 1 root wheel 0 jul 26 10:27 mysqld.log the problem might version of mysql - general_log_file works on versions 5.1.29 , above. if have lesser version (5.1.28 or lower, 5.0), have use "log" not "general_log_file." if isn't it, let know here , we'll take run @ it.

c++ - Set an icon for a file type -

i have used qt creator , created my.exe file , new extension ".newext" , have manually associated .newext files my.exe like this . the exe file has icon square figure , named myicon.ico. have described in myapp.rc file icon this: idi_icon1 icon discardable "myicon.ico" also in .pro file have added line: rc_file = myapp.rc now when set .newext extension in registry value of defaulticon key equal c:\path\to\my.exe,0 then see squere icon file have associated my.exe when set c:\path\to\my.exe,1 then there no icon recognized. what set value in order see icon white paper (wrapped @ top-right corner) , on square icon - little bit made smaller? p.s. know should possible without specifying new resource in .exe file because when vista "open my.exe always", puts icon described above (of course without changing .exe). i don't know if possible @ all. haven't seen application doing that. have discover how...

.net - Parse filename from full path using regular expressions in C# -

how pull out filename full path using regular expressions in c#? say have full path c:\cooldirectory\coolsubdirectory\coolfile.txt . how out coolfile.txt using .net flavor of regular expressions? i'm not regular expressions, , regex buddy , me couldn't figure 1 out. also, in course of trying solve problem, realized can use system.io.path.getfilename , fact couldn't figure out regular expression making me unhappy , it's going bother me until know answer is. // using system.text.regularexpressions; /// <summary> /// regular expression built c# on: tue, oct 21, 2008, 02:34:30 pm /// using expresso version: 3.0.2766, http://www.ultrapico.com /// /// description of regular expression: /// /// character not in class: [\\], number of repetitions /// end of line or string /// /// /// </summary> public static regex regex = new regex( @"[^\\]*$", regexoptions.ignorecase | regexoptions.cultureinvariant | rege...

java - External Iterator vs Internal Iterator -

what external , internal iterator in java ? external iterator when iterator , step on it, external iterator for (iterator iter = var.iterator(); iter.hasnext(); ) { object obj = iter.next(); // operate on obj } internal iterator when pass function object method run on list, internal iterator var.each( new functor() { public void operate(object arg) { arg *= 2; } }); edit (nov 14, 2016) removed google search link reformatted

Wordpress media manager > Force image overwrite? -

i'm looking setting or filter can set in functions.php file force wordpress media manager overwrite images uploaded exact same filename image resides in uploads folder? currently, creates duplicates of images same filename, , adds number end of newly uploaded image. i released plugin called overwrite uploads lets this.

c# - How to implement an interface explicitly with a virtual method? -

i can't this interface interfacea { void methoda(); } class classa : interfacea { virtual void interfacea.methoda() // error: modifier 'virtual' not valid item { } } where following works class classa : interfacea { public virtual void methoda() { } } why? how circumvent this? i think because when member explicitly implemented, cannot accessed through class instance, through instance of interface. so making 'virtual' not make sense in case, since virtual means intend override in inherited class. implementing interface explicitly and making virtual contradictory. may why compiler disallows this. to work around think csharptest.net's or philip's answer sounds trick

bpm - Disadvantages of automating a business process? -

what disadvantages (if any) of automating business process enterprise/organization? loosing discretionary error checking, i.e. numbers out of line; potentially, knowledge of how process operated lost if automated not documented. more not, manual processes passed on; accountability process becomes muddled.

Troubleshooting Visual Studio 2008 crash when loading a solution -

i've downloaded source subsonic via svn. when try open project in visual studio 2008, converts solution, loads projects disappears without error message. subsequent loads of solution same. if run devenv /safemode , open project works fine, can't use add-ins. any ideas tracking down crash? edit: in event viewer: event type: error event source: .net runtime event category: none event id: 1023 date: 10/23/2008 time: 4:45:05 pm user: n/a computer: foo description: .net runtime version 2.0.50727.3053 - fatal execution engine error (7a035e00) (80131506) looks issue reported: http://code.msdn.microsoft.com/powercommands/workitem/view.aspx?workitemid=34

python - How do lexical closures work? -

while investigating problem had lexical closures in javascript code, came along problem in python: flist = [] in xrange(3): def func(x): return x * flist.append(func) f in flist: print f(2) note example mindfully avoids lambda . prints "4 4 4", surprising. i'd expect "0 2 4". this equivalent perl code right: my @flist = (); foreach $i (0 .. 2) { push(@flist, sub {$i * $_[0]}); } foreach $f (@flist) { print $f->(2), "\n"; } "0 2 4" printed. can please explain difference ? update: the problem is not i being global. displays same behavior: flist = [] def outer(): in xrange(3): def inner(x): return x * flist.append(inner) outer() #~ print # commented because causes error f in flist: print f(2) as commented line shows, i unknown @ point. still, prints "4 4 4". python behaving defined. three separate functions created, each have closure of envi...

Getting PHP Notice: Undefined index: password_clear in joomla when using plugin other then joomla login -

i getting php notice: undefined index: password_clear when use plugin other joomla's login plugin log-in user. in joomla database, not storing user's data. have got custom plugin, check user's credentials through web service call. the credentials checked good, , joomla show user has logged in, , rest of things working fine. logs filled above notices! any 1 faced such problem or hints or directions me? thanks in advance, tanmay you can 2 things: edit php.ini , set error_reporting e_compile_error|e_recoverable_error|e_error|e_core_error edit plugin code , test presence of password_clear before using it. here's example how testing part: $clear = $_post['password_clear']; /* old */ $clear = empty($_post['password_clear']) ? '' : $_post['password_clear']; /* fixed */ or: if ($_post['password_clear'] == 'x') {...} /* old */ if (! empty($_post['password_clear']) && $_post['...

python - Avoiding CannotSendRequest exceptions when re-using httplib.HTTPSConnection objects -

my code makes bunch of https calls using httplib. want re-use httplib.py connection object, if do, cannotsendrequest exceptions because connection ends in strange state because other bit of code blows mid-way through request. want way cache connection object such if it's in valid state re-use it, re-connect if it's not in valid state. don't see public method on httplib.httpsconnection tell me if connection in valid state or not. , it's not easy me catch cannotsendrequest exception because happen in lots of places in code. i'd this: connection_cache = none def get_connection(): global connection_cache if (not connection_cache) or (connection_cache.__state != httlib._cs_idle): connection_cache = httplib.httpsconnection(server) return connection_cache but fails because __state private. there way this? patch httplib expose is_in_valid_state() method, i'd rather avoid patching base python libraries if can. (touching...

performance - How do you measure page load speed? -

i trying quantify "site slowness". in olden days made sure html lightweight, images optimized , servers not overloaded. in high end sites built on top of modern content management systems there lot more variables: third party advertising, trackers , various other callouts, performance of cdn (interestingly enough content delivery networks make things worse), javascript execution, css overload, kinds of server side issues long queries. the obvious answer every developer clear cache , continuously @ "net" section of firebug plugin. other ways measure "site dragging ass" have used? yslow tool (browser extension) should you. yslow analyzes web pages , why they're slow based on yahoo!'s rules high performance web sites.

php - Which is better for encoding HTML for RSS? -

i introduced html rss feeds publish (which had plain text, no markup), , wondering method better: use character encoding (such htmlspecialchars) or encapsulate in cdata? it seems me cdata might easier, i'm unclear whether there might reasons (subtle or otherwise) choosing 1 approach versus other. (for starters, cdata approach easier read when viewing source...) cdata data should not parsed xml parser. tags not in cdata block will parsed xml parser , may take on different meaning. cdata can incur overhead parsers if there no need it. try avoid cdata blocks time know html (or otherwise) won't used, otherwise use it. that said, agree jamesh, in should prefer atom on rss. produce feed reader , when scraping feeds, prefer atom on rss.

.net - Passing Windows Token to WCF then from WCF to another server in the AD domain -

this may doozy, have idea how to: pass users windows token (authenticated domain) wcf service called - service perform action based on users windows credentials made call. ie: client -> wcf -> 3rd party repository integrates active directory. i have wcf data tier responsible returning of data - customer makes calls service. service retrieves documents repository. customer accomplish managing of accounts ad sincee repository supports ad integration. any appreciated - thank :-) ---------- update have followed jezell's article still have issues. i want use upn opposed spn (so account can locked down , more secure), im not sure i've got wrong. i have created spn's on ad server (tried every combination, no duplicates) here code snippet, maybe has idea of im doing wrong. dim binding new nettcpbinding() binding.security.mode = securitymode.message binding.security.message.algorithmsuite = system.servicemodel.security.securityalgorithmsuite.basic128 bi...

osx - Using Mac OS X Services-menu from a Java/Swing application -

i make java/swing application compatible services-menu available on mac os x. example, user select text in jtextarea , have converted speech services -> speech -> start speaking text . there simple way achieve that? (the application should still able run on platforms other mac os x.) have @ apple's osxadapter package (link requires free apple developer login) java development. samples included in package shows how integrate nicely os x application menu in way activated when application running under os x.

regex - URL routing process works on one web, not another. 100% processor usage -

i thought have url routing under control works on 1 website found out not working fine on another. both websites run same server, same iis 6.0, same asp_isapi.dll. setup 1: 1 works well: routes.mappageroute("article seo", "sid/{sid}", "~/ar.aspx", true, new routevaluedictionary { }, new routevaluedictionary { { "sid", @"^([a-za-z\-]*)+([a-za-z])+(.html)$" } } ); setup 2: one, similar not working well: routes.mappageroute("article", "page/{sid}", "~/page.aspx", true, new routevaluedictionary { }, new routevaluedictionary { { "sid", @"^([a-za-z0-9\-]*)+([a-za-z0-9])+(.html)$" } } ...