Posts

Showing posts from September, 2015

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

i'm working on installer (using wise installer, older version 1999). i'm creating shortcut in programs group exe. i'm creating shortcut on desktop. if install run admin account, create shortcut on common desktop , common program group (i.e., read hkey_local_machine\explorer\shellfor users). if it's installed nonadmin account, install hkey_current_user's desktop , program group. behavior install on: xp nonadmin - desktop , program shortcuts install ok. vista admin - desktop & program shortcuts install ok. vista non-admin, uac off - desktop shortcut installs, program shortcut not . however, program group folder they're supposed installed does created. at end of install, launch program group has shorcut. launches in of above. can manually drag shortcut folder , works fine. i'm bloody baffled. i've tried installing other commercial apps (opera, foxit, firefox) firefox install under nonadmin (and if select other program files,...

Is there a standard ReSharper code style definition that matches all the StyleCop requirements? -

the resharper reformat code feature handy , flexible, particularly new code layout templating flexibility jetbrains have added in version 3.0. is there standard set of code style settings resharper match rules enforced microsoft stylecop , stylecop compliance can easy running resharper "reformat code" feature? try resharper stylecop plugin at: http://www.codeplex.com/stylecopforresharper

Nested master pages in ASP.NET MVC 2 -

i know how make nested master pages in webforms possible in mvc2? know how markup though. i set code depending on criteria. possible code in controller define nested master page , master page? " is possible code in controller define nested master page , master page? " nope. default view engine lets define 1 level of masterpages. see: http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.view.aspx

winapi - Windows CDROM Eject -

does know method programmatically close cd tray on windows 2000 or higher? open cd tray exists, can't seem make close under w2k. i looking method batch file, if possible, api calls ok. here easy way using win32 api: [dllimport("winmm.dll", entrypoint = "mcisendstringa", charset = charset.ansi)] protected static extern int mcisendstring(string lpstrcommand,stringbuilder lpstrreturnstring,int ureturnlength,intptr hwndcallback); public void openclosecd(bool open) { if (open) { mcisendstring("set cdaudio door open", null, 0, intptr.zero); } else { mcisendstring("set cdaudio door closed", null, 0, intptr.zero); } }

design - Example of modern text editor architecutre -

i'm looking design\architectual guidance modern text editors. modern text editor means that: it has support syntax highlighting it has auto-completion (something intellisense) it has advanced navigation capabilities (incremental search, etc.) following properties plus: implemented in managed language (java, .net language) modular architecutre add-in support i'm interested in text editor related design\architecure documents\articles, links open source projects. i'm not interested in general recommendations, oop/design patterns books advertisement. currently i'm analyzing sharpdevelop code editor source code. links similar projects appreciated. the ultimate text editor is, of course, emacs. found the craft of text editing, or, emacs modern world excellent self-study guide basics of writing editor. examples in plain old c, , text might bit dated (it 1991), basic ideas still valid, , thoroughly understand why editor works way does....

objective c - Advanced iPad programming -

i finished learning big nerd ranch guide iphone programming need more advanced book advanced concepts particularly ipad app dev. could please recommend one? the pragmatic ipad book coming out soon. main author, daniel steinberg, writer. can download sample chapters too. there's not know. need learn split-view controllers , popovers. if absolutely must have book now, wrox: beginning ipad seems pretty good, you'll go on lot of info you've learned apress has 1 iphone converts too: beginning ipad development iphone developers . jack nutting (very writer, author of apress cocoa book) second author.

How do I get raw logs from Google Analytics? -

is possible obtain raw logs google analytic? there tool can generate raw logs ga? no can't raw logs, there's nothing stopping getting exact same data logged own web server logs. have @ urchin code , borrow that, changing following 2 lines point web server instead. var _ugifpath2="http://www.google-analytics.com/__utm.gif"; if (_udl.protocol=="https:") _ugifpath2="https://ssl.google-analytics.com/__utm.gif"; you'll want create __utm.gif file don't show in logs 404s. obviously you'll need parse variables out of hits web server logs. log line in apache looks this. you'll have lots of "fun" parsing out various stuff want that, google analytics gets basic javascript tagging comes in this. 127.0.0.1 - - [02/oct/2008:10:17:18 +1000] "get /__utm.gif?utmwv=1.3&utmn=172543292&utmcs=iso-8859-1&utmsr=1280x1024&utmsc=32-bit&utmul=en-us&utmje=1&utmfl=9.0%20%20r124&utmdt=my%2...

c# - How can you create a collection based on multiple IEnumerables -

a class want operate on provides getters of type ienumerable<x> , ienumerable<y> x & y subclasses of base type t. want iterate on contents of both treating them type t. there handy way concatenate both can seen ienumerable<t> ? example: ienumerable<headerpart> headers = templatefile.maindocumentpart.headerparts; ienumerable<footerpart> footers = templatefile.maindocumentpart.footerparts; list<openxmlpart> result = new list<openxmlpart>(); result.concat<openxmlpart>(footers); headerpart , footerpart both subclasses of openxmlpart 3rd line fails: 'system.collections.generic.ienumerable' not contain definition 'concat' , best extension method overload 'system.linq.enumerable.concat(system.collections.generic.ienumerable, system.collections.generic.ienumerable)' has invalid arguments note, can't change either of source data, need create new collect...

java - What is the reasoning behind the Interface Segregation Principle? -

the interface segregation principle (isp) says many client specific interfaces better 1 general purpose interface. why important? isp states that: clients should not forced depend on methods not use. isp relates important characteristics - cohesion , coupling . ideally components must highly tailored. improves code robustness , maintainability. enforcing isp gives following bonuses: high cohesion - better understandability, robustness low coupling - better maintainability, high resistance changes if want learn more software design principles, copy of agile software development, principles, patterns, , practices book.

.net - C# Property Access Optimization -

in c# (or vb .net), compiler make attempts optimize property accesses? eg., public viewclass view { { ... computed here .... } } if (view != null) view.something = somethingelse; i imagine if compiler somehow detect view remains constant between 2 accesses, can refrain computing value twice. these kind of optimizations performed? i understand if view has intensive computations, should refactored function ( getview() ). in particular case, view involves climbing visual tree looking element of particular type. related: references on workings of (microsoft) c# compiler? not in general, no. steven mentioned there numerous factors consider regarding multithreading, if computing might change, you're correct should refactored away property. if won't change, should lazy-load (check if private member null, if calculate, return value). if won't change , depends on parameter, can use dictionary or hashtable cac...

Silverlight c# adding tooltip to textblock -

i generating textblock in c# , want add tooptip displays image , text. how can without xaml? use code this:- textblock txt = new textblock(); txt.text = "hello world"; tooltipservice.settooltip(txt, "some content"); note can replace "some content" uielement containing pretty content wish.

c# - Getting the array key in a 'foreach' loop -

how key of current element in foreach loop in c#? for example: php foreach ($array $key => $value) { echo("$value assigned key: $key"); } what i'm trying in c#: int[] values = { 5, 14, 29, 49, 99, 150, 999 }; foreach (int val in values) { if(search <= val && !stop) { // set key variable } } grauenwolf's way straightforward , performant way of doing array: either use loop or create temp variable increment on each pass. which of course this: int[] values = { 5, 14, 29, 49, 99, 150, 999 }; (int key = 0; key < values.length; ++key) if (search <= values[key] && !stop) { // set key variable } with .net 3.5 can take more functional approach well, little more verbose @ site, , rely on couple support functions visiting elements in ienumerable. overkill if need for, handy if tend lot of collection processing.

regex - How to escape text for regular expression in Java -

does java have built-in way escape arbitrary text can included in regular expression? example, if users enter "$5", i'd match rather "5" after end of input. since java 1.5, yes : pattern.quote("$5");

css - Can I change the appearance of an html image during hover without a second image? -

is there way change appearance of icon (ie. contrast / luminosity) when hover cursor, without requiring second image file (or without requiring hidden portion of image)? here's information image opacity , transparency css . so make image opacity 50%, you'd this: <img src="image.png" style="opacity: 0.5; filter: alpha(opacity=50)" /> the opacity: part how firefox it, , it's value between 0.0 , 1.0. filter: how ie it, , it's value 0 100.

design - Self Testing Systems -

i had idea mulling on colleagues. none of knew whether or not exists currently. basic premise have system has 100% uptime can become more efficient dynamically. here scenario: * hash out system specified set of interfaces, has 0 optimizations, yet confident 100% stable though (dubious, sake of scenario please play along) * profile original classes, , start program replacements bottlenecks. * original , replacement initiated simultaneously , synchronized. * original allowed run completion: if replacement hasn´t completed vetoed system replacement original. * replacement must return same value original, specified number of times, , specific range of values, before adopted replacement original. * if exception occurs after replacement adopted, system automatically tries same operation class superseded it. have seen similar concept in practise? critique please ... below comments written after initial question in r...

java - To prevent a memory leak, the JDBC Driver has been forcibly unregistered -

i getting message when run web application. runs fine message during shutdown. severe: web application registered jbdc driver [oracle.jdbc.driver.oracledriver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. any appreciated. since version 6.0.24, tomcat ships memory leak detection feature, in turn can lead kind of warning messages when there's jdbc 4.0 compatible driver in webapp's /web-inf/lib auto- registers during webapp's startup using serviceloader api , did not auto- deregister during webapp's shutdown. message purely informal, tomcat has taken memory leak prevention action accordingly. what can do? ignore warnings. tomcat doing job right. actual bug in else's code (the jdbc driver in question), not in yours. happy tomcat did job , wait until jdbc driver vendor fixed can upgrade driver. on other hand, aren't supposed drop jdbc driver in webapp's /web-inf/lib...

webserver - How do I write a python HTTP server to listen on multiple ports? -

i'm writing small web server in python, using basehttpserver , custom subclass of basehttpserver.basehttprequesthandler. possible make listen on more 1 port? what i'm doing now: class myrequesthandler(basehttpserver.basehttprequesthandler): def doget [...] class threadinghttpserver(threadingmixin, httpserver): pass server = threadinghttpserver(('localhost', 80), myrequesthandler) server.serve_forever() sure; start 2 different servers on 2 different ports in 2 different threads each use same handler. here's complete, working example wrote , tested. if run code you'll able hello world webpage @ both http://localhost:1111/ , http://localhost:2222/ from threading import thread socketserver import threadingmixin basehttpserver import httpserver, basehttprequesthandler class handler(basehttprequesthandler): def do_get(self): self.send_response(200) self.send_header("content-type", "text/plain") ...

language agnostic - Is help file (or user manual) dead? -

back in days of unix, couldn't close software without reading man page first. came mac , windows consistent menu layout , keyboard shortcuts, still saw paper user manuals shipped in shrinkwrap box, described each , every single operation possible in app. after internet, files became html documents. nowadays web 2.0 applications, hardly see help. if it's there , describe specific tasks. in other words, apps relying more on common sense or don't-make-me-think factor of user base. years ago microsoft came concept called inductive user interface , tells programmers put in instructions on apps itself, not sure how popular idea is. are files, user manuals, , context sensitive online f1 key dead? have failed if user not find out ui? if not, degree of should provide? (both desktop , web app) edit: how documentation/help file mesh agile development methods? example, should developers think twice before ui changes may obsolete bunch of screenshots? have fa...

Jquery closing dialog and removing div -

please help! have designed dashboard uses gadgets. 1 of gadgets creates dialog every time gadget refreshed, creates dialog same id. dialog contains form, there issues getting , submitting value of inputbox since there identical id's on page. what best way destroy newly created dialogs , removing div dom without affecting created dialog? add dialog call: close: function (ev, ui) { $(this).dialog("destroy"); $(this).remove(); }, this destroy dialog , remove div when it's closed.

c - What's the difference between hard and soft floating point numbers? -

when compile c code cross toolchain, linker prints pages of warnings saying executable uses hard floats libc uses soft floats. what's difference? hard floats use on-chip floating point unit. soft floats emulate 1 in software. difference speed. it's strange see both used on same target architecture, since chip either has fpu or doesn't. can enable soft floating point in gcc -msoft-float. may want recompile libc use hardware floating point if use it.

asp.net mvc - MVC.net JQuery Validation -

after trying avoid javascript years, iv started using jquery validation in mvc asp.net, there not seem official way of doing validation, iv been surprised how jquery is. firstly there way intellisense working jquery , validation plugin, don have learn api? secondly how create validation summary this, appends error right of text box.: <script type="text/javascript"> $().ready(function() { $("#createlog").validate({ rules: { username: { required: true, minlength: 2, } }, messages: { username: { required: "please enter username", minlength: "your username must consist of @ least 2 characters", } } }); }); </script> <form id="createlog" action="create" method="post" /> <label>username</label><br /> ...

c# - Web Control Properties -

i make web control more readable in design mode, want tag declaration like: <cc1:ctrl id="value1" runat="server"> <values>string value 1</value> <values>string value 2</value> </cc1:ctrl> lets have private variable in code behind: list<string> values = new list<string>(); so how can make user control fill out private variable values declared in markup? sorry should have been more explicit. functionality itemplate provides ( http://msdn.microsoft.com/en-us/library/aa719834.aspx ) but in case need know @ runtime how many templates can instansitated, i.e. void page_init() { if (messagetemplate != null) { (int i=0; i<5; i++) { messagecontainer container = new messagecontainer(i); messagetemplate.instantiatein(container); msgholder.controls.add(container); } } } in given example markup looks like: <acme:test runat=server> <messagetemp...

regex - Auto-clean Log Formats -

i've run several different situations need implement "log cleanup" regex. i've had re-implement couple times, basic variant this: the original (23:59:59) username says: user inputted text (00:00:13) username user inputted action (00:01:42) username says: user inputted text (00:02:13) username says: user inputted text i'm looking lookahead/lookbehind regex converts to: (23:59:59) username says: user inputted text (00:00:13) username user inputted action (00:01:42) username says: user inputted text (00:02:13) username says: user inputted text what's angle of attack, , why? unless regex absolutely necessary, awk '/^\(/{print ""}{printf "%s ",$0}' file the logic behind print lines without newline, except when "(" encountered first character. can implemented in language. bash #!/bin/bash while read -r line case "$line" in "("* ) echo esac printf "%s " $line d...

sql server - Is there a way to loop through a table variable in TSQL without using a cursor? -

let's have following simple table variable: declare @databases table ( databaseid int, name varchar(15), server varchar(15) ) -- insert bunch rows @databases is declaring , using cursor option if wanted iterate through rows? there way? first of should absolutely sure need iterate through each row - set based operations perform faster in every case can think of , use simpler code. depending on data may possible loop using select statements shown below: declare @id int while (select count(*) atable processed = 0) > 0 begin select top 1 @id = id atable processed = 0 --do processing here update atable set processed = 1 id = @id end another alternative use temporary table: select * #temp atable declare @id int while (select count(*) #temp) > 0 begin select top 1 @id = id #temp --do processing here delete #temp id = @id end the option should choose depends on structure , volume of data. ...

html - Set Div Width to Background Image Width Css? -

is there pure css way of setting div width width of background image using div? for instance right i'm doing this... #homenav{ background-image:url(../images/navpieces/home.jpg); width:165px; text-align:right; } #aboutnav{ background-image:url(../images/navpieces/about.jpg); width:81px; text-align:center; } #competitorsnav{ background-image:url(../images/navpieces/competitors.jpg); width:117px; text-align:center; } i'd love not have write in width of every div. any suggestions? unfortunately no, there isn't. css doesn't know width of specified background images. bit of javascript preloaded images , set div widths.

blackberry - How to draw a route between two locations on CloudMade -

i'm trying use cloudmade's route service. i want display route between 2 locations in standalone application, there isn't tutorial in cloudmade's website handle this. how can display route? appreciate help. for blackberry/j2me cloudmade gives own tiles, libraries nutiteq. here examples including routing: http://www.nutiteq.com/lib-application-samples .

Databinder.Eval and Substring -

im using repeater control , databinder display data database website. example: databinder.eval(container, "dataitem.title") sometimes text long use substring display preferred string in length. how do databinder , if text long (> 20 characters) want truncate , leave 3 dots behind. how ? i'd suggest extension method heavy lifting, in order make markup simple possible: public static string evaltrimmed(this repeateritem container, string expression, int maxlength) { string value = databinder.eval(container, expression) string; if ( value != null ) return null; if (value.length > maxlength) value = value.substring(0,maxlength) + "..."; return value; } then use in markup as: <%# container.evaltrimmed("dataitem.title", 20) %>

java - Adding signature to jar file prevents it from being loaded -

i having problem adding second signature .jar file causes trouble in combination code has 1 of them. background: have application signed expired certificate. has starter can update downloading new versions of .jar files , placing them in front of existing ones onto classpath. we got new certificate , sign new starter , updates both keys. unfortunately old applications refusing startup: the starter (signed old cert) builds classpath. then calls method class ("stendhal") jar signed both certs this method loads class ("loguncaughtexceptionhandler") jar signed old cert. securityexception: class "games.stendhal.client.loguncaughtexceptionhandler"'s signer information not match signer information of other classes in same package could not arrange download new version of jar loguncaughtexceptionhandler , signed new cert? if not, don't think you're going find suitable resolution issue.

z80 - What are your favourite ZX Spectrum development tools? -

what favourite assemblers, compilers, environments, interpreters old zx spectrum ? i used use roybot assembler - had enter program using basic editor , rem statements. comes decent debugger/disassembler lets single-step machine code too. the hisoft gens , mons assembler , disassembler (aka devpak) popular. for high-level compiling, mira modula-2 compiler good.

c# - Slow performance in reading from stream .NET -

i have monitoring system , want save snapshot camera when alarm trigger. have tried many methods that…and it’s working fine , stream snapshot camera save jpg in pc…. picture (jpg format,1280*1024,140kb)..that’s fine problem in application performance... app need 20 ~30 seconds read steam, that’s not acceptable coz method called every 2 second .i need know wrong code , how can faster that. ? many in advance code: string sourceurl = "http://192.168.0.211/cgi-bin/cmd/encoder?snapshot"; byte[] buffer = new byte[200000]; int read, total = 0; webrequest req = (webrequest)webrequest.create(sourceurl); req.credentials = new networkcredential("admin", "123456"); webresponse resp = req.getresponse(); stream stream = resp.getresponsestream(); while ((read = stream.read(buffer, total, 1000)) != 0) { total += read; } bitmap bmp = (bitmap)bitmap.fromstream(new memorystream(buffer, 0,total)); string path = jpgname.text+".jpg"; bmp.save(path)...

c# - Why there is no ForEach extension method on IEnumerable? -

inspired question asking missing zip function: why there no foreach extension method in enumerable class? or anywhere? class gets foreach method list<> . there reason why it's missing (performance)? there foreach statement included in language job of time. i'd hate see following: list.foreach( item => { item.dosomething(); } ); instead of: foreach(item item in list) { item.dosomething(); } the latter clearer , easier read in situation , although maybe bit longer type. however, must admit changed stance on issue; foreach() extension method indeed useful in situations. here major differences between statement , method: type checking: foreach done @ runtime, foreach() @ compile time (big plus!) the syntax call delegate indeed simpler: objects.foreach(dosomething); foreach() chained: although evilness/usefulness of such feature open discussion. those great points made many people here , can see why people missing function. ...

tsql - Transact Sql LEFT function weird output -

select replace(stuff('123456',2,2,'abcd'),'1',' ') select left('abcd456',4) select left(replace(stuff('123456',2,2,'abcd'),'1',' '),4) ok first select outputs 'abcd456', series of functions evaluates first parameter left function in second select second select returns 'abcd' expected third select returns 'abc' why? shouldn't output 'abcd'? know? in advance. it clearer if do select '[' + left(replace(stuff('123456',2,2,'abcd'),'1',' '),4) + ']' which returns [ abc] there leading space! select stuff('123456',2,2,'abcd') gives 1abcd456 then replace 1 space

sharepoint - What are some decent ways to prevent users from creating meeting workspaces? -

i have events list in sharepoint , need disallow users having ability create meeting workspaces in new event form. shy of customizing new event form (which breaks attachment support), how can done? by default, in order users create meeting workspace, need administrator or site owner (specifically need create sites permission). if don't give them permission, won't able create meeting workspace. this disallow user create site under site these permissions set. i'm not aware of way restrict access specific site definition still allow users create different one.

asp.net mvc - View strongly-typed with ViewModel doesn't generate fields automatically -

when create view , bind directly 1 class has properties want show on view, fields (textboxes, etc.) created automatically. when create viewmodel encapsulate more 1 object data, doesn't happen. there way working specific object inside viewmodel? thanks. thanks commenters teasing out answer details. mvc's default editorfor "master" template, object.ascx, has if statement in place prevent happening. to change behavior need replace base /editortemplates/object.ascx template own. replica of template baked mvc: <%@ control language="c#" inherits="system.web.mvc.viewusercontrol" %> <% if (model == null) { %> <%= viewdata.modelmetadata.nulldisplaytext %> <% } else if (viewdata.templateinfo.templatedepth > 1) { %> <%= viewdata.modelmetadata.simpledisplaytext %> <% } else { %> <table cellpadding="0" cellspacing="0" border="0"> <% foreach (var p...

Ajax autocomplete extender populated from SQL -

ok, first let me state have never used control , first attempt @ using web service. my dilemma follows. need query database column , use autocomplete. don't want query run every time user types word in textbox, best guess run query once use dataset, array, list or whatever filter autocomplete extender... i kinda lost suggestions?? why not keep track of query executed user in session variable, use filter further results? the trick preventing database overloading think limit how auto updater allowed update, once per 2 seconds seems reasonable me. what this: store current list returned query word server side , tie session variable. should entire list think. then, each new word typed, long original word exists, can filter session info , spit filtered results out without having query again. basically, query again when word changes. i'm using "session" in php sense, may using different language different terminology, concept should same.

bash script for copying files between directories -

i writing following script copy *.nzb files folder queue them download. i wrote following script #!/bin/bash #this script copies nzb files downloads folder hellanzb queue folder. ${down}="/home/user/downloads/" ${queue}="/home/user/.hellanzb/nzb/daemon.queue/" in $(find ${down} -name *.nzb) cp ${a} ${queue} rm *.nzb done it gives me following error saying: hellanzb.sh: line 5: =/home/user/downloads/: no such file or directory hellanzb.sh: line 6: =/home/user/.hellanzb/nzb/daemon.queue/: no such file or directory thing directories exsist, have right access them. any nice. please , thank you. variable names on left side of assignment should bare. foo="something" echo "$foo" here more improvements script: #!/bin/bash #this script copies nzb files downloads folder hellanzb queue folder. down="/home/myusuf3/downloads/" queue="/home/myusuf3/.hellanzb/nzb/daemon.queue/" find "${down}...

c++ - Track Data Execution Prevention (DEP) -

when running 1 of our software, tester faced data execution prevention dialog of windows. we try reproduce situation on developer computer debugging purposes : no success. does know how find may cause dep protection kill application? there existing tools available this? the dep dialog typically show when try execute code region you're not marking executable. might caused 'thunks' in library you're using, e.g. atl windowing. problem fixed in atl 8.0. a stack-trashing bug - example, buffer overrun - can cause problem, setting return address location isn't executable. might not cause access violation instead weird behaviour, if dep turned off process or not available on hardware. it might happen if throw c++ exception or raise seh exception, , structured exception handlers have been trashed buffer overrun.

objective c - Hidden Features of Xcode -

with huge influx of newbies xcode, i'm sure there lots of xcode tips , tricks shared. what yours? switch header/source file option ⌥ command ⌘ up arrow ↑ view > switch header/source file switches between .m , .h files. in xcode 4 ctrl command ⌘ up arrow ↑

Is D a credible alternative to Java and C++? -

is d language credible alternative java , c++? take become credible alternative? should bother learning it? deserve evangelizing? the main reason ask new c++ standard (c++0x) here, it's clear me language has gone past point of no return respect ever understanding it. know c/c++ never die @ point need move on. cobol had day , java has in many respects undone c++. what's next? d fill bill? what determines success , popularity of programming language real-world software development partially related quality of language itself. pure language, d arguably has many advantages on c++ , java. @ least credible alternative pure language, other things being equal. however, other things matter software development - more language itself: portability (how many platforms run on), debugger support, ide support, standard library quality, dynamic library support, bindings common apis, documentation, developer community, momentum, , commercial support, name few. in every 1 of...

java - What is the difference between @ManyToOne(optional=false) vs. @Column(nullable=false) -

in jpa, confused when use attribute optional=false , annotation @column(nullable=false) . difference? @column(nullable=false) instruction generating schema. database column generated off class marked not nullable in actual database. optional=false runtime instruction. primary functional thing related lazy loading. can't lazy load non-collection mapped entity unless remember set optional=false (because hibernate doesn't know if there should proxy there or null, unless tell nulls impossible, can generate proxy.)

date - PHP - linux/unix CTIME (inode change time) is being set when it's only being modified -

according to: http://www.php.net/manual/en/function.filectime.php "in unix filesystems, file considered changed when inode data changed; is, when permissions, owner, group, or other metadata inode updated." however, running debian linux (uname -r: 2.6.26-2-686) when access , write file, using php's $fh = fopen($file, 'a'); fwrite($fh, "hello world"); fclose($fh); both modified time (filemtime) , change time (filectime) updated. it's understanding ctime changed when file's preferences changed (permissions, ownership, name) , not content itself. clearstatcache(); echo "$file last changed: " . date("f d y h:i:s.", filectime($file)). "<br>"; echo "$file last modified: " . date("f d y h:i:s.", filemtime($file)). "<br>"; echo "$file last accessed: " . date("f d y h:i:s.", fileatime($file)). "<br>"; nevermind, after readi...

xml - find out if AS3's XMLList contains string as node value -

is there xmllist equivalent array.indexof? for example - var array:array = ['one','two']; trace(array.indexof('two')); // returns 1, since it's @ second position trace(array.indexof('three')); // returns -1, since isn't found ... right? if i've got - var xml:xml = <list><item>one</item><item>two</item><list> var xmllist:xmllist = list.item; there's got easier way check see if 1 of nodes in xmllist has particular value looping through of them, right? akin - xmllist.indexofchildbynodevalue('two'); // returns 1, because it's second child xmllist.indexofchildbynodevalue('three'); // returns -1, because doesn't match children make sense? i put demo of how can without looping. though call little more upfront work. though pays off if going checking values lot. <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="...

java - What is the difference between <% ... %> and <%! ... %> in jsp -

i adding more functionality page has 2 tags mentioned in title. noticed variable declare in <% ... %> cannot used in <%! ... %> , vice versa. difference between 2 , how can declare variables used in 2 tags <% ... %> used embed java code within main service() method of jsp. executed during rendering of page. <%! ... %> used define code outside of flow of page, , therefore outside main service() method. typically, used define utility methods called within <% ... %> block. both approaches obsolete, however. jsp el, jstl , tag classes preferred way of doing same thing.

asp.net - How to lazy load Infragistics UltraWebTree control? -

i cannot find examples of how lazy load infragistics ultrawebtree v6.3 i found docs on infragistics site tend limited latest version of controls, legacy app unable upgrade. has got example code or links demonstrate how lazy-load nodes in control? the current implementation have loads 1.35mb of html because populating entire tree!! yikes! it turnedout simple piece of jquery , webservice return rendered nodes. any node has sub-items initialised text "loading..." script knows attempt retrieve them. <script type="text/javascript" language="javascript"> var imagetypeexpression = "img[imgtype='exp'][src$='plus.gif']"; var maxretries = 5; jquery(document).ready(function() { jquery("#t_treelistctl " + imagetypeexpression).click(imageclick); jquery("#tdlists").show(); }); function imageclick() { var parentdivid = jquery(this).parent().attr('id...

javascript - Prototype vs jQuery: A specific problem regarding binding, events and values -

i'm looking @ transferring existing functionality (built prototypejs) jquery , have been working through couple of examples. one example i'm bit stuck on, regards binding functions (and values) event. example tries apply mouseover event, incremented value list of links. value alerted want same every time (so link 1 alerts "1", link 2 alert "2" etc etc) here's snippet of simple example. prototype: findlinks: function () { = 1; $$("#vertical-content-links ul li a").each(function (s) { event.observe(s, "mouseover", this.activatelink.bindaseventlistener(this, i)) i++ }.bind(this)) }, activatelink: function (e, i) { alert(i) } within example, when link 1 mouseovered, alert "1". link 2 alert "2" etc etc alerting value of when function applied event. however, similar code in jquery.... findlinks: function () { = 1; $("#vertical-content-links ul li a")....

c++ - Is CGI in any way better than Servlets? -

we have web reporting application built cgi (c/c++) 10 years back. due performance , security issues, needs rearchitectured. best technology solution re-engineer cgi based architecture? i suspect you'll many different answers there server-side frameworks, here's mine: @ things cgi needs do, how needs evolve, , other components might add in future, , base decision off that. example, there java libraries handle of need do? there python libraries? want optimize rapid development or catching errors @ compile-time versus test-time? make sense use framework rails or django? take step, if edit question , talk more cgi you're replacing (you don't have specific, more detail helps), suspect more valuable answers.

design patterns - Static factory methods vs Instance (normal) constructors? -

in language both available, prefer see instance constructor or static method returns instance? for example, if you're creating string char[] : string.fromcharacters(chars); new string(chars); in effective java, 2nd edition , joshua bloch recommends former. there few reasons can remember, , doubtless can't: you can give method meaningful name. if you've got 2 ways of constructing instance both of take int, have different meanings int, using normal method makes calling code more readable. a corollary of first - can have different factory methods same parameter list you can return null "potentially expected failure" cases whereas constructor always either return value or throw exception you can return type other declared (e.g. return derived class) you can use factory, potentially return reference same object several times the downsides: it's not idiomatic, - developers more used seeing "new" if see "new" kn...

jpeg - What is the difference between: image/x-citrix-pjpeg and image/pjpeg -

some files uploaded reported mime type: image/x-citrix-pjpeg they valid jpeg files , accept them such. i wondering however: why mime type different? there difference in format? or mimetype invented light bulb @ citrix no apparent reason? update: ok, did more searching , testing on question, , turns out they're lying mime-type (never trust any info send client, know). i've checked bunch of files different encodings (created libjpeg) official mime type jpeg files: image/jpeg but applications (most notably ms internet explores yahoo! mail) send jpeg files image/pjpeg i thought knew pjpeg stood 'progressive' jpeg. turns out progressive/standard encoding has nothing it. ms internet explorer send out all jpeg files pjpeg regardless of contents of file. the same goes citrix: all jpeg files send citrix client reported image/x-citrix-pjpeg mime type. the files untouched (identical before , after upload). turns out difference in mime t...

How to simulate a click to make the current input lose its focus with JavaScript -

i have input @ points happens have focus. if user click in "background" of page, input loses focus. trying simulate click on background following code, doesn't work (you notice input still has focus). suggestion on how write code simulates click on "background" of page? <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo/yahoo-min.js" ></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/event/event-min.js" ></script> <script type="text/javascri...

android - Dynamic markers on a map? -

how dynamically draw markers on mapview? i've got following code hardcode 1 point in. i'm looking pull values database.. //---translate geopoint screen pixels--- point screenpts = new point(); mapview.getprojection().topixels(p, screenpts); //---add marker--- bitmap bmp = bitmapfactory.decoderesource( getresources(), r.drawable.pushpin); canvas.drawbitmap(bmp, screenpts.x, screenpts.y-50, null); i've got locations in database. how not declare point variable etc. each point exists in database table of size n? thanks. write overlaycalss implements itemizedoverlay .this better method implementing multiple markers. can add amrkers fetched database : db = sqlitedatabase.opendatabase( "/data/data/<your project package>/databases/<databasename>", null, 0); cursor = db.query(<db table name>, new string[] { <values fetch> }, ...

xml - XPath query with PHP -

here's xml code i'm working with: <inventory> <drink> <lemonade supplier="mother" id="1"> <price>$2.50</price> <amount>20</amount> </lemonade> <lemonade supplier="mike" id="4"> <price>$3.00</price> <amount>20</amount> </lemonade> <pop supplier="store" id="2"> <price>$1.50</price> <amount>10</amount> </pop> </drink> </inventory> then wrote simple code practice working xpath: <?php $xmldoc = new domdocument(); $xmldoc->load('sample.xml'); $xpathvar = new domxpath($xmldoc); $queryresult = $xpathvar->query('//lemonade/price'); foreach($queryresult $result) { echo $result->textcontent; } ?> th...

.net - How to name nodes in a graph in the English language? -

i need define element linkedlist in object:      a   /    \ x     y how name entire object , components in english? à la: hand-body-leg object named body . or maybe somthing queue kernel hand treeobject ? ok, let's show example of railway: nodestation => station => station => station => nodestation => station => station => nodestation => ... i need have object ( nodestationandneighbourdstations ) following 3 elements: nodestation , leftneighbor , rightneighbor in more general manner. node node | | ------ parent ------ --- --- | | | | left child right child x y the whole object i'd call node.

flash - Problem with editing Template Monster .fla file -

i having worst luck this. bought template update our own website (don't have enough time start our own scratch!) when make simple changes in flash cs4 native file , re-export swf, doesn't work correctly! i wondering if has run across same problems template monster flash website template. thanks. please give more details mean "it doesn't work correctly!". text wrong size? buttons don't work? entire screen blank? etc etc one thing try check version of flash , version of actionscript exporting to, make sure same versions designed with. try downloading older version of flash , see if fixes problem (they have 30-day trials). , finally, did pay money product, if it's defective, contact people sold you.

syntax - What do curly braces in Java mean by themselves? -

i have java code uses curly braces in 2 ways // curly braces attached 'if' statement: if(node.getid() != null) { node.getid().apply(this); } // curly braces themselves: { list<pexp> copy = new arraylist<pexp>(node.getargs()); for(pexp e : copy) { e.apply(this); } } outamethodexp(node); what stand-alone curly braces after first if statement mean? the purpose of braces provide scope-limit. list<pexp> copy exist within braces, , have no scope outside of them. if generated code, assume code-generator can insert code (such this) without having worry how many times has inserted list<pexp> copy , without having worry possibly renaming variables if snippet inserted same method more once.

sql - automating decompile / recompile in ms-access -

my front end time time getting larger. building new reports , forms. i know remou suggests decompile , compile every make sure nothing corrupt. can automate decompile/ recompile process? what kind of automation have in mind? edit : if intend automate this, don't automate decompile in isolation; include backup , compact decompile. you try 1 line in bat file, changing paths match version of msaccess.exe , database file: "c:\program files\microsoft office\office\msaccess.exe" /decompile "c:\mypath\mydatabase.mdb" danny lesandrini discussed other options decompile , other maintenance type stuff in database journal article: microsoft access file backup , maintenance options i think mentioned method use ... decompile context menu option in windows explorer. can find more information including reg file @ getting decompile , compact context menu options

How do you count the rows in a SQL query which already used count, group by, and having before? -

for example, using answer question: how select users made more 10 submissions "how select users made more 10 submissions." select userid submission group userid having count(submissionguid) > 10 let's want know many rows sql statement outputted. how scalable solution counting rows of counting rows? slight error in posted example, need alias table name subquery: select count(*) (select userid submission group userid having count(submissionguid) > 10) t i'm not sure scalability, solution. if isn't scaling enough you, need consider major design changes, perhaps tracking submitted more 10 submissions in separate table update through applications populate submissions. or many other possible solutions.

java - Polymorphism in JAX-RPC web services -

i have jax-rpc (java) web service needs return complex polymorphic value. more specific, class structure this: abstract class child { } class question extends child { private string name; // other fields, getters, , setters } class section extends child { private string label; private child[] children; // getters , setters } class quiz { private child[] elements; // getter , setter } my web service has method returns quiz, of course may contain questions , sections may contain questions , other sections, , on , forth. however, when generate wsdl, child , quiz make in. when call web service, quiz element right number of children, they're child elements, , they're empty. is there way make work, short of returning xml string? before asks, due circumstances beyond control, cannot use jax-ws. i don't think jax-rpc supports polymorphism in way. had similar problem, , had work around creating class had 2 members - 1 each of 2...

java - Synchronising twice on the same object? -

i wondering if in java odd behaviour if synchronise twice on same object? the scenario follows pulbic class sillyclassname { object moo; ... public void method1(){ synchronized(moo) { .... method2(); .... } } public void method2(){ synchronized(moo) { dostuff(); } } } both methods use object , synchronised on it. second method when called first method stop because it's locked? i don't think because it's same thread i'm unsure of other odd results might occur. reentrant synchronized blocks use reentrant locks, means if thread holds lock, can re-aquire without problems. therefore code work expect. see bottom of java tutorial page intrinsic locks , synchronization . to quote of 2015-01… reentrant synchronization recall thread cannot acquire lock owned thread. thread can acquire lock owns. allowing thread acquire s...

c++ - Odd behavior from TinyXML++ -

hoping of tinyxml++ people can me out. really, since recomended me before think owe me ;) i have following code: //ticpp::iterator< ticpp::element > child( "setpiece" ); ticpp::iterator< ticpp::node > child("setpiece"); gluint lc_spieces = 0; for(child = child.begin( ); child != child.end(); child++ ) { lc_spieces++; } if use top declaration child error: unhandled exception @ 0x7c812aeb in drawing.exe: microsoft c++ exception: __non_rtti_object @ 0x0012f7b4. and in dbgheap.c @ line: pvblk = _heap_alloc_dbg(nsize, nblockuse, szfilename, nline); what's weird works node, , know there elements in there(i checked using tinyxml iteration methods). has run before? just poking in dark, don't know tinyxml, seems dynamic_cast went wrong. if dynamic_cast<> pointer, null-pointer on failure. however, if cast reference type, there no concept of null-reference, runtime throws exception ...

javascript - Regex - is there something I've done wrong? -

this javascript, virtually identical regex failing in php too, don't think it's language specific var r = new regexp( "^(:19|20)?[0-9][0-9]" // optional 19/20 start followed 2 numbers + "-" // hyphen + "(:0?[1-9]|1[0-2])" // optional 0 followed 1-9, or 10, 11, 12 + "-" // hyphen + "(:3[01]|[12][0-9]|0?[1-9])$" // idea. ); r.test("2008-07-01"); // == false what on earth missing? i think non-capturing blocks should e.g. (?:19|20) rather (:19|20)

css - Making a <button> that's a link in HTML -

basically, way <input type="submit"> styled, clickable button when add little css. however, regular buttons not styled such, have no such clickability without major css or js, , have use images. i made submit buttons links, using form action, requires me make new form each button. how can find happy medium? using multiple forms causing problems in styling can't seem fix unless find way make buttons links in html, have default style makes them have pressed state (and don't mean browser default settings). any ideas? <a href="#"><button>link text</button></a> you asked link looks button, use link , button :-) preserve default browser button styling. button nothing, clicking activates parent link. demo: <a href="http://stackoverflow.com"><button>link text</button></a>

iphone - how to get back in navigation view using timer -

hi using code getting previous view nstimer *thetimer = [nstimer scheduledtimerwithtimeinterval:3.0 target:self selector:@selector(picturetimerfired:) userinfo:nil repeats:no]; - (void) picturetimerfired:(nstimer*)thetimer { nslog(@"timer fired, closing picture"); } but happened directly quit application , displays icon how can resolve remove comma function name because if not passing argument timer no need comma , if passing argument use uersinfo @ function

ASP.net Session Destroy if he closes the browser -

i have website. when user logged session details loaded. when user logged out session details abandoned. (log out clicking logout menu) when user closes browser how destroy session. in next time logging same session data. need avoid this. as part of handling of logout, call session.clear() clear key/value pairs: http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.clear.aspx

objective c - autoresize of uiview -

i have uiview in uitabcontroller . , there uitableview in it. when toggling in call status bar doesn't , view not automatically resized. it assumes right size based on whether in call uistatusbar toggled when app starts if uistatusbar toggled whilst app running nothing changes. another tab view uinavigationcontroller seems resize fine. here code if ([indexpath indexatposition:0] == 0 || [indexpath indexatposition:0] == 1) { if (!airportchooser) { airportchooser = [[airportchoosercontroller alloc] init]; airportchooser.targetcontroller = self; airportchooser.view.autoresizessubviews = yes; airportchooser.view.autoresizingmask = uiviewautoresizingflexibleheight; [airportchooser.view setautoresizingmask:uiviewautoresizingflexiblewidth | uiviewautoresizingflexiblewidth]; } airportchooser.target = [indexpath indexatposition:0]; [self.parentviewcontroller.parentviewcontroller...

asp.net - ObjectDataSource and Collection of Objects -

i have gridview bind objectdatasource. have readonlycollection of business objects have many properties. need display 4 of these properties in gridview. haven't used objectdatasource control before, how can use display 4 properties of of business objects in readonlycollection? say had list of objects 2 properties: name & age: <asp:gridview id="gvwexample" runat="server" autogeneratecolumns="false" datasourceid="myobjectdatasource"> <columns> <asp:boundfield datafield="name" headertext="name" /> <asp:boundfield datafield="age" headertext="age" /> </columns> </asp:gridview> same thing if data binding against source , didn't want every value of each row of data.

iphone - Problem dealloc'ing memory used by UIImageViews with fairly large image in an UIScrollView -

i have large uiscrollview i'm placing 3-4 rather large (320x1500 pixels or so) uiimageview image tiles. i'm adding these uiimageviews scroll view inside of nib files. have 1 outlet on controller, , uiscrollview. i'm using property (nonatomic, retain) this, , sythesizing it. my question this: when observe in memory monitor, can see memory used goes quite bit when view these images loaded (as expected). when leave view, , controller dealloc'd, not seem give anywhere near memory had taken up. when cut 1 of these views (there several in app) down 1-3 images 320x460 , left else same, recaptures memory fine. is there issue using images large? doing wrong in code (pasted below)? this snippet viewcontroller causing problems. - (cgfloat)findheight { uiimageview *imageview = nil; nsarray *subviews = [self.scrollview subviews]; cgfloat maxyloc = 0; (imageview in subviews) { if ([imageview iskindofclass:[uiimageview class]]) ...

html - Full-height CSS layout, with multiple columns -

Image
i have layout working, has 1 annoying problem.. when content taller screen, background stops. this desired layout in bad-ascii-art format: _____________________ _ | | long |logo| | | | content | | | | | | | | | | | | | |grad| |grad| | viewport | | | | | | | | | | | | | | _| | | | | | | | | _____________________ |2em| <-20em->| 2em| ..or short content.. _____________________ _ | | short |logo| | | | content | | | | | | | | | | | | | |grad| |grad| | viewport | | | | | | | | | | | | | | | | | | | | _____________________ _| basically looks single column, glow column either side. on left-glow logo. when content short, still full-height. i have tried using css min-height hack , fixes middle column, gradients extend f...

java - How to reinitialize static finals while unit testing -

i writing unit tests class, has static final variable. however, since state of static final var modified in each test, need way reinitialize it. how possible? need use sort of custom classloader? variable initialized - static final countdownlatch latch = new countdownlatch(1); of course can hack around reflection or class loading, "if you, wouldn't starting form here." mutable statics evil (even called singletons). so, design code better "parameterisation above" - pass object need them, rather doing hardwired or using directory service.

php - Charting library that offers Linked line chart with dots -

i'm trying plot data several entities on time. each entity have own line, there several lines. each line connected, it's important dots drawn represent data. i'm aware of linked bar chart, @ initial inspection, can't seem find 1 offers me ability draw dots. knows library has this? i'm open php, flex, degrafa, whatever else gets job done. chartdirector it, not free. http://www.advsofteng.com/ i'm sure there others, 1 use. examples here: http://www.advsofteng.com/gallery_line.html

asp.net - HTML.DropDownList values from multiple sources? -

in asp.net mvc, possible fill list of values of html.dropdownlist multiple data sources along multiple manually entered values? basically, envision being formated below using along lines of optgroup: **group 1** manual item 1 manual item 2 **group 2** ds1 item 1 ds1 item 2 **group 3** ds2 item 1 ds2 item 2 i've thought using view on db , getting data that, however, i've not faintest how lay out above using helpers , pass data multiple sources. thanks in advance. as start model (actually start unit test no time here): public class mymodel { public string selecteditem { get; set; } public ienumerable<selectlistitem> items { get; set; } } then controller: public class homecontroller : controller { public actionresult index() { var items1 = new[] { new { value = "1", text = "manual item 1" }, new { value = "2", text = "manual item 2" }, }; ...