Posts

Showing posts from August, 2012

html - how to overlay elements over flash? -

possible duplicate: div z-index issue flash movie how can overlay html elements on flash ? use <param name="wmode" value="transparent"> see answer post.

netbeans & java, resourceMap.getString returning null -

product version: netbeans ide 6.8 (build 200912041610) java: 1.6.0_17; java hotspot(tm) client vm 14.3-b01 system: windows 7 version 6.1 running on x86; cp1252; en_gb (nb) hello, newbee java programmer here , wondering if can help, have been having problems updating gui desktop application in netbeans, here details: my current application gui works great, appearing correctly. when update gui adding new label netbeans toolbox onto form, , use netbeans preview function, looks great however when run application new label has disappeared.. to try , understand problem ran app in debug mode , stepped through auto-generated initcomponents() code from debugging believe problem comes line of code: test_lbl.settext(resourcemap.getstring("test_lbl.text")); // noi18n after line of code has executed test_lbl.settext equal null.. so label disappearing when run app because has no text value display... i opened resource map file in notepad (the .properties file) , c...

How to efficiently print huge data inside WPF datagrid? -

datagrid contains more 200 rows , 15 columns cell contains graph well. virtualization enable in datagrid datagrid doesnt have entire viusal. the wpf datagrid great @ things. haven't had luck using large data sets, bit slow , clunky. there other products such xceed grid large data sets, has drawbacks (its harder use). hoping (hope - 1 of tools in developers arsenal) fix issue in next release.

asp.net - Having troubles setting the appearance of a web control -

i'm trying set appearance of login web control, i'm having quite few problems. far can tell, i've set correctly, reason control still isn't displayed correctly: a) width of 2 textbox controls ( ids username , password ) should equal 70% of table's width, isn't, though i've set width attributes. idea why is? b) if table cells containing lblpassword , lblpassword controls have text-align property set center, lblpassword , lblpassword overflow. why that? <div id="loginbox"> <asp:login id="login1" runat="server" width="100%" failureaction="redirecttologinpage" remembermeset="false"> <layouttemplate> <table> <tr> <td style="padding:6px;text-align:center;"> <asp:label ...

iphone - How to start movie playback at a certain frame or position in time, using MPMoviePlayerController? -

the mpmediaplayback protocol seems not define helpful method this, , couldn't find 1 in mpmovieplayercontroller. guess there way it, because users must able drag slider point in time when playing movie. yesterday reading blog post claimed mpmoviecontroller that. unfortunately didn't bookmark it... for example, want start movie programmatically @ 20 seconds. does know how it? btw, it's non-streaming content! there's currentplaybacktime property accessible in mpmediaplayback protocol, set chosen position in movie (e.g. 20.0 20 seconds movie)

java - Is this how you go about calling your Dao's in your service layer? -

in service layer, have method xx, how reference dao classes? public class someserviceimpl implements someservice public void dosomething(int somethingid){ userdao userdao = this.daofactory().getuserdao(); salesdao salesdao = this.daofactory().getsalesdao(); .. .. .. } it gets bit this, , hoping if there easier more elegant way? i use springframework configure application. framework has nice feature enables me inject dependencies service layer. therefore service implementation looks that: @autowired private userdao userdao; public void dosomething(int somethingid) { userdao.findbyid(somethingid); ... }

python - Regex match even number of letters -

i need match expression in python regular expressions matches number of letter occurrences. example: aaa # no match aa # match fsfaaaasdf # match safa # match sdaaewasa # match aeaia # no match an number of should match. try regular expression: ^[^a]*((aa)+[^a]*)*$ and if a s don’t need consecutive: ^[^a]*(a[^a]*a[^a]*)*$

.net - How to delete certain characters of a word in c# -

i have a string word = "degree/nn"; what want remove "/nn" part of word , take word "degree" . i have following conditions: the length of word can different in different occasions. (can word therefore length not fixed) but word contain "/nn" part @ end always. how can in c# .net? implemented extension method: static class stringextension { public static string removetrailingtext(this string text, string texttoremove) { if (!text.endswith(texttoremove)) return text; return text.substring(0, text.length - texttoremove.length); } } usage: string whatever = "degree/nn".removetrailingtext("/nn"); this takes account unwanted part "/nn" removed end of word, specified. simple replace remove every occurrence of "/nn". however, might not problem in special case.

math - PHP Add up a series of minutes:seconds -

i have list of video segment durations need add total duration. the series this: 0:33 4:30 6:03 2:10 ...etc i need add minutes , seconds total video duration. here's modified function of accepted answer: function gettotalduration ($durations) { $total = 0; foreach ($durations $duration) { $duration = explode(':',$duration); $total += $duration[0] * 60; $total += $duration[1]; } $mins = floor($total / 60); $secs = str_pad ( $total % 60, '2', '0', str_pad_left); return $mins.':'.$secs; } just made sure output looks correct. give code shot: function gettotalduration ($durations) { $total = 0; foreach ($durations $duration) { $duration = explode(':',$duration); $total += $duration[0] * 60; $total += $duration[1]; } $mins = $total / 60; $secs = $total % 60; return $mins.':'.$secs; }

java - Regex for matching alternating sequences -

i'm working in java , having trouble matching repeated sequence. i'd match like: a.b.c.d.e.f.g. and able extract text between delimiters (e.g. return abcdefg) delimiter can multiple non-word characters , text can multiple word characters. here regex far: ([\\w]+([\\w]+)(?:[\\w]+\2)*) (doesn't work) i had intended delimiter in group 2 regex , use replaceall on group 1 exchange delimiter empty string giving me text only. delimiter, cannot text. thanks help! replace (\w+)(\w+|$) $1 . make sure global flag turned on. it replaces sequence of word chars followed sequence of non-word-chars or end-of-line sequence of words. string line = "am.$#%^ar.$#%^gho.$#%^sh"; line = line.replaceall("(\\w+)(\\w+|$)", "$1"); system.out.println(line);//prints name

html - Which is the easiest cloud for static web content -

i've got few html pages requisite images, css , other bits , pieces, static content no cgi required. host on amazon ec2 image need have , running different application. ideally i'd move hosting of static content off ec2 image it's independent of single ec2 instance. i'd host on 1 of free or @ least pay go cloud options. the options i've come across are: windows azure, in case haven't been able .html pages working , if possible mean i'd have update whole windows azure app everytime needed update image? or there easy way static web content served azure blobs? amazon's s3, think i'd have put qualified url's each html page each image, css etc. file wouldn't bad. seems reasonable option. google's app engine, spent 10 minutes looking @ seems work well. wordpress, incorporate html wordpress blog site find themes little bit restrictive, pages can wide etc. is there easier way? update: after further investigation 2 best ways fou...

sql server - How to concatenate row values for use in WHERE clause of T-SQL query -

i want write query in t-sql perform search on 2 concatenated columns. 2 columns fname , lname. here have far: select fname, lname, ... users join othertable on foo=bar fname+' '+lname '%query%' sql server doesn't syntax, though. how structure query can perform operation searches through 2 concatenated columns, allowing me search user's full name, rather first name , last name individually? i can suggest 1 of fname or lname null fails., (null concat null) try ... isnull(fname, '') + ' ' + isnull(lname, '') '%query%' however, use computed column , consider indexing because run awfully.

python - How to use a Django include tag for a separate HTML template? -

i trying use include django template tag, , inside reference template handles format of form. when reference though inside template outputs each of dynamic parts, each character per new line, strange. example here snippet of output: <form action="/admin/events/create_submit/" method="post"> <div class="fieldwrapper"> : &lt; </div> <div class="fieldwrapper"> : l </div> <div class="fieldwrapper"> : </div> <div class="fieldwrapper"> : &gt; </div> ... expected output <form action="/admin/events/create_submit/" method="post"> <div class="fieldwrapper"> <li><label>field</label><input type="text" /></li> </div> ... i realise markup on li inside div incorrect trying und...

webpage - What should be on the landing page of an open source project? -

the reason asking question idea how best present open source project own projects. how can 1 best make project attractive potential new users and/or developers? projects vary in nature , scope when answering may necessary qualify suggestions contingent on these factors. it interesting see examples of best presented projects out there! here things on landing page of open source project, in approximate order of priority elevator pitch: software do download link latest version latest news; what's new in new versions documentation link link discussion boards/mailing lists/bug tracker; how talk , report problems link source code/revision control system

I am looking for something similar to the drupal CCK, but in Java (in a Java CMS)? -

i have been using drupal, hitting limitations. drupal cck (and associated modules) cool module in drupal allow specify new "content types" , add fields them such images, text, check-boxes. drupal generates pages add/edit , display these content types on web. benefit of this, developer can specify content type , leave forms/validation, database back-end/sql, user permissions, , web display output drupal. i guessing lots of cms systems support user definable content types, rendered using form processing, editing , templates/blocks display - list of java cms on wikipedia , java-source.net; http://java-source.net/open-source/content-managment-systems but there many more hope meaningfully review, hoping suggest rad tools java cms, , prototyping custom "content types" thanks, tom ps of java cms systems looking are; onehippo.com/en/ondemand/hippo-service liferay.net/web/guest/home alfresco.com liferay has custom attributes seem same thing cck, though...

firebug - Intermittent JavaScript Issue -

i'm running javascript via eval (i know, shoot me), enumerates of properties on document object. issue while works in firebug, throws not implemented exception in firefox, when run script. link javascript script, exception thrown, , firebug command working. any suggestions what's going on here? for record, done on firefox 3.6.10 on ubuntu 10.04 64-bit, , chrome not have issue. the error here: console.log(result); remove line , should fine. the console object firebug thing (refers firebug console). safari/chrome happen implement console object (refers webkit js console). firefox, indeed other browsers don't have console object. throws error. btw: usual, evals unnecessary. equivalent code: for (key in document) { result[i] = typeof document[key]; result[i+1]="document."+key; i+=2; } if insist on calling request use reference: var request = window.document; (key in request) { result[i] = typeof request[key]; res...

object pascal - How to get a pointer to a method in a base class from a child class in Delphi? -

here code example: type tmybaseclass = class public procedure someproc; virtual; end; tmychildclass = class(tmybaseclass) public procedure someproc; override; end; var somedelegate: procedure of object; procedure tmybaseclass.someproc; begin showmessage('base proc'); end; procedure tmychildclass.someproc; begin showmessage('child proc'); // here want pointer tmybaseclass.someproc (not in class!): somedelegate := someproc; end; procedure tform1.button1click(sender: tobject); begin tmychildclass.create try // there "child proc" message: someproc; free; end; // there want "base proc" message, "child proc" again // (but destroyed anyway, how coud be?): somedelegate; end; the 1 way know is: procedure tmychildclass.basesomeproc; begin inherited someproc; end; procedure tmychildclass.someproc; begin showmessage('child proc'); somedelegate := basesomeproc;...

apache2 - PHP Write Permission - FC13 -

i have installed fc13 , attempting write mechanism in php code caches gathered data specific directory (for our purposes here, let's call /var/www/html/_php_resources/cache). i copy files on /var/www/html directory , run chown -r apache:apache /var/www/html/* , chmod a+w /var/www/html/_php_resources/cache on new data. right using global write permission convenience. tweak permissions later. when attempt use chmod or mkdir php functions wind with: warning: chmod(): permission denied in /var/www/html/_include/php/cacheinit.php or warning: mkdir(): permission denied in /var/www/html/_include/php/cacheinit.php now, when disable selinux works fine. problem prefer not disable selinux , permissions set correctly can port on servers not have such explicit control. as example: personal site host allows me set read/write permissions on directories not allow selinux policy changes. fyi: uname -r = 2.6.34.7-56.fc13 * php -version * = php 5.3.3 rpm -...

Problems rotating a sprite using drawtexture (OpenGl ES Android) -

i´m trying rotate sprite using drawtexture nothing happens. i´m using following code: gl.glrotatef(90, 0, 0, 1.0f); gl.glbindtexture(gl10.gl_texture_2d, textureid); (gl11ext) gl).gldrawtexfoes(x, y, z, width, height); the texture drawn screen not rotated... anyone? :) from oes_draw_texture extension : xs , ys given directly in window (viewport) coordinates. so passed in coordinates not transformed modelview , projection matrices, glrotatef changes. in short, extension not support rotated sprites. if want those, simplest draw standard rotated quads instead.

How to catch Django request.GET error? -

this view works when query in database. def search(request): if 'q' in request.get , request.get['q']: q = request.get['q'] q_school = lawyer.objects.filter(last__icontains=q).values_list('school', flat=true) q_year = lawyer.objects.filter(last__icontains=q).values_list('year_graduated', flat=true) lawyers = lawyer.objects.filter(school__icontains=q_school[0]).filter(year_graduated__icontains=q_year[0]).exclude(last__icontains=q) return render_to_response('search_results.html', {'lawyers': lawyers, 'query': q}) else: return httpresponse('please submit search term.') so, if q=delelle finds other lawyers in database graduated same school same year. if q=collins , collins in database there no other lawyers graduated same school same year gives appropriate error message "no lawyers matched search criteria." but if q=moritz , there ...

visual studio - Whats the best way to set up a VS project that uses mutiple external open source projects? -

i have large project replacing 2 parts of better open source alternatives. open source libraries pretty big stable , unchanging including source in vs project directly seems pointless me - more load, more compile etc. rather build 2 open source projects alone, @ fixed version , reference them main project. but gives me couple of problems. i want debug , release versions of libraries - vs has no way switch between references based on defines. debugging harder if want step code in other projects - not simple stepping through code - or it? something else i've not yet thought of... so while play around ideas thought ask how guys set up. the main project , 2 open source projects in different svn repositories. open source projects not getting new trunk every day, fixing on release. thanks 1) can switch between references different build configurations if manually editing .csproj file. the csproj file msbuild script xml. if browse down should find <itemgro...

javascript - Parse js arrays in ruby -

i've js file holds array objects , data assigns var a_1_val = new array(7); var b_1_txt = new array(7); a_1_val[0] = '111'; b_1_txt[0] = 'utf8_content'; a_1_val[1] = '222'; b_1_txt[1] = 'bar'; etc.. need these arrays in ruby. found http://github.com/jbarnette/johnson , can't correctly return array object another way eval js in ruby, similar to get name of arrays cut arrays initialize js ruby eval a_1_val[0] = '111' b_1_txt[0] = 'utf8_content' both ways sucks. maybe can suggests ideas thanks you can use json string marshal data between javascript , ruby: #!/usr/bin/env ruby require 'johnson' require 'open-uri' require 'yajl' # grab source javascript json implementation json_js = open('http://www.json.org/json2.js').read # strip silly alert @ top of file json_js.gsub!(/^(alert.*)$/, '/* \1 */') # javascript wanted some_js = <<-eof var ...

visual c++ - Memory management with HEAP arrays -

if create heap array inside loop, have delete @ end of each loop before reinitialize @ beginning of loop again or reinitializing exact same thing again overwrite old array , can skip delete command? do mean this? for (int = 0; < 5; i++) { char *array = new char[10]; // ... delete[] array; } in case: yes, need delete array. if had written instead, char *array = 0; (int = 0; < 5; i++) { if (!array) array = new char[10]; // ... } delete[] array; then no, can reuse array across multiple iterations of loop.

language agnostic - Group functions of similar functionality -

sometimes come across problem have set of functions belong same group. functions needed @ several places, , together. to give specific example: consider filemtime , fileatime , filectime functions. provide similar functionality. if building filemanager, you'll need call them 1 after info need. moment thinking wrapper. php provides stat , suppose don't have function. i looked @ php sourcecode find out how solved particular problem, can't find out what's going on. obviously, if have naive implementation of such grouping function, filetimes , this: function filetimes($file) { return array( 'filectime' => filectime($file) ,'fileatime' => fileatime($file) ,'filemtime' => filemtime($file) ); } this work, incurs overhead since have open file pointer each function call. (i don't know if it's necessary open file pointer, let's assume sake of example). another approach duplicate code of...

python - Serving up snippets of html and using urlfetch -

i'm trying "modularize" section of appengine website profile requested small hunk of pre-rendered html sending request /userinfo?id=4992 sends down html like: <div> (image of john) john information user </div> so, google appengine code, need able repeatedly fetch results url when displaying group of people. the way can send down collection of <iframes> like <iframe src="/userinfo?id=4992"></iframe> <iframe src="/userinfo?id=4993"></iframe> <iframe src="/userinfo?id=4994"></iframe> the iframes work request data. i tried using urlfetch.fetch() keeps timing out on me. am doing right? thought handy-dandy (url serves snippet of html) turns out looking design error. you're serializing urlfetch requests, ends summing wait times , may push beyond latency deadline. i'm afraid you'll need switch async urlfetch requests -- adv...

visual studio 2008 - How to create an advenced setup like those of MSOffice,Nero,Adobe etc -

i've completed windows project in c# , want build nice setup has following features: 1.shows popular agree/disagree page. 2.shows files being copied/updated. 3.any other custom activity want add. i've built 2-3 basic setups in vs2008(setup wizard) don't know if possible achieve above requirements in visual studio's setup wizard? any other third party software build nice windows setups welcome. thanks. i should start asking money giving answer :p wix toolkit looking for. done through xml formatted files , compiled msi's (or other formats) there. can design own dialogs, add progress messages/bars, custom actions galour, , more low low price of...nothing. free. little bit learn, main page has link amazing tutorial going in no time.

cocoa - How is NSCell displayed? -

an nscontrol's cell isn't in view hierarchy. correct? if isn't, how being drawn on view if it's not in view hierarchy? i ask because want have view/control subclass can drag out onto contentview, add buttons view, , have lowest component cell. cell can click events, something, pas them onto buttons. window ->contentview -> customview ->(button, button, button) nsresponder, thats thought. costique, check apple's docs first. looking clarification. read apple's docs . in nutshell, control's -drawrect: sends -drawinteriorwithframe:inview: and/or -drawwithframe:inview: cell actual drawing.

How do I register my Google Account in the android emulator running 2.2 api level 8? -

possible duplicate: android emulator - trouble creating user accounts i'm trying register google account android emulator running 2.2 api level 8. forums suggest can going settings -> accounts, me have option add "corporate" account, i.e. exchange account, not google account. i wish add google account test c2dm emulator. does know how associate google account emulator in build? thanks, eric turns out using image "android 2.2" instead of "google apis (google inc)". using android sdk , avd manager, create new virtual machine correct image.

php - Creating website using Zend Framework -

i have installed zend server on local system.i created 1 project folder using command line argument zf create project quickstart the project folder created on c:\program files\zend. how can run project in browser. http://localhost/zend/ if create simple zend framework zend studio (it creates necessary files). put in server folder (htdocs) und run localhost/project/public/index.php you don't need zend server build/run zend projects. just download mix or max zend framework package , can start.

iphone - Simulating keyboard tap -

is there way programmatically tap key, user key pop animation takes place? yes, it's possible amount of work. depends goal is. uispec place start looking. if interested in simulating clicks testing purposes, can use library. otherwise, contain source , pointers how can yourself.

Search Lucene with precise edit distances -

i search lucene index edit distances. example, say, there document field first_name; want documents first names 1 edit distance away from, say, 'john'. i know lucene supports fuzzy searches (first_name:john~) , takes number between 0 , 1 control fuzziness. problem (for me) number not directly translate edit distance. , when values in documents short strings (less 3 characters) fuzzy search has difficulty finding them. example if there document first_name 'j' , search first_name:i~0.0 don't back. in lucene's fuzzyquery, cannot specify extact distance. can specify value of "fuzziness" between 0 , 1 values closer 0 indicate broad match , values closer 1 indicate narrow match. formula "fuzziness" follows. (from lucene in action) http://bit.ly/9hdvuf from formula, can work approximate fuzziness given value of distance. so, stackoverflow matched stackunderflow , @ distance of 3, fuzziness required approximately 0.77.

What's a good, free source control system for eclipse android development? -

my app code starting unmanageable , want start source control, because need branch code. what systems have used in past , recommend me. requirements: must free must integrate eclipse must work android development plugin svn (subversion) , there support eclipse plug-in called subclipse .

c - Read certificate files from memory instead of a file using OpenSSL -

i have server listen on https using openssl. this, have provide certificate use. however, current implementation uses filename provided openssl api. i want certificate information read memory, don't have ship certificate file opening. tried google, didn't come options. is possible? if so, how read certificate files memory instead of file using openssl? edit : following moved comments question. // current void start_server() { const char *filename = "cert_and_key.pem"; set_server_ssl_file(filename); } set_server_ssl_file(const char *filename) { //initialize context ssl_ctx_use_certificate_file(ctx, pem, ssl_filetype_pem); ssl_ctx_use_privatekey_file(ctx, pem, ssl_filetype_pem); } //required void start_server() { const char *cert = "--begin certificate--............"; const char *key = "--begin rsa private key--......."; set_server_ssl_options(cert, key); } set_server_ssl_options(const char *cert, const...

c# - Assign work in backgroundworker_DoWork() according to condition -

in winform application,i want use single backgroundworker (or may 1 each form) different tasks on different events. eg: search, loading data in grid, opening new forms, sending emails, file transfer etc. how can manage in backgroundworker_dowork() , backgroundworker_runworkercompleted() events? what optimum way/ best practice this? usually, end caling worker parameter, this: backgroundworker.runworkerasync(<some argument here>); then inside dowork method, can retrieve argument e.argument , , according argument is, know want it. if don't need argument else, can make enum values need, search , load , forth , pass in, , check value inside dowork choose want do. remember have cast enum inside dowork since e.argument object. regarding runworkercompleted, can populate e.result value inside dowork, , retrieve inside runworkercompleted method well. this best way of doing it, , thread safe way.

Best way to handle multiple form validation in ASP.NET MVC -

overview i have payment page allow user select payment method, either credit card or check. have form each of these payment methods. did not want create separate page each of these methods ui purposes, use [div] each form , toggle display jquery. problem each of payment methods has own set of validation rules. want able apply model validation payment method selected , submitted user. in order validation, required post same controller action, submitting different actions not option. approaches i have considered following approaches: partial validation based on incoming values, described here: http://blog.stevensanderson.com/2010/02/19/partial-validation-in-aspnet-mvc-2/ . issue approach security implication, , relatively small app, don't have separate domain layer author of article suggests. create separate models each payment method, , overload controller [httppost] action different model parameter. tried compiler complains action ambiguous, though have this [ht...

c# - how do I subscribe to an event in raised in another assembly -

i have solution contains 3 project. 1 project handles asynchronous communinications. when has completed it's callback, raises event somethingcompleted. how subscribe event project in same solution? i have event handlers built in receiving project not see event in sending project. you need have reference class raising event register event handler. once have that, it's done registering other event handler: foo.somethingcompleted += (sender, e) => this.dosomething();

iphone - *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSMutableArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]' -

what meaning * terminating app due uncaught exception 'nsrangeexception', reason: '* -[nsmutablearray objectatindex:]: index 1 beyond bounds [0 .. 0]' so can solve problem thanks zero based addressing. if have 1 item in nsarray, first item in array @ index 0, not index 1.

c# - Different behaviors between XmlDocument.LoadXml and XDocument.Parse -

our project has been converted use xdocument xmldocument few days ago, found strange behavior while processing xml entity in attribute value xdocument.parse, sample code following: the xml string: string xml = @"<char symbol=""&#x0;"">"; the xmldocument.loadxml code , result: xmldocument xmldocument = new xmldocument(); xmldocument.loadxml(xml); console.writeline(xmldocument.outerxml); result: <char symbol="&#x0;" /> the xdocument.parse code , exception: xdocument xdocument = xdocument.parse(xml); console.writeline(xdocument.tostring()); exception: a first chance exception of type 'system.xml.xmlexception' occurred in system.xml.dll '.', hexadecimal value 0x00, invalid character. line 1, position 18. @ system.xml.xmltextreaderimpl.throw(exception e) @ system.xml.xmltextreaderimpl.throw(string res, string[] args) @ system.xml.xmltextreaderimpl.throw(int32 pos,...

python - Getting the module file path of a derived class via inheritance -

suppose have following: $ more a.py import os class a(object): def getfile(self): return os.path.abspath(__file__) - $ more b.py import class b(a.a): pass - >>> import b >>> x=b.b() >>> x.getfile() '/users/sbo/tmp/file/a.py' this clear. no surprise code. suppose want x.getfile() return path of b.py without having define copy of getfile() under class b. i did this import os import inspect class a(object): def getfile(self): return os.path.abspath(inspect.getfile(self.__class__)) i wondering if there's strategy (and in case, want write here can useful others) or potential issues solution present. cw it's more discussion question, or yes/no kind of question sys.modules[self.__class__.__module__].__file__

c# - Public class modifier for WPF control -

i'm creating windows application , class library. class library contains wpf control named "insertform.xaml" insertform contains textbox named eusername. i'm using following code show insertform. that's successful. can't access eusername. how set textbox modifiers public? using system.windows.forms.integration elementhost host = new elementhost(); iform= new extender.insertform(); host.child = iform; this.controls.add(host); would work? <textbox name="eusername" x:fieldmodifier="public"/>

r - Simplify ave() or aggregate() with several inputs -

how can write in 1 line? mydata "zoo" series, limit numeric vector of same size tmp <- ave(coredata(mydata), as.date(index(mydata)), fun = function(x) cummax(x)-x) tmp <- (tmp < limit) final <- ave(tmp, as.date(index(mydata)), fun = function(x) cumprod(x)) i've tried use 2 vectors argument ave(...) seems accept 1 if join them matrix. this example, other function use. here need compare value of cummax(mydata)-mydata numeric vector , once surpasses i'll keep zeros till end of day. cummax calculated beginning of each day. if limit single number instead of vector (with different possible numbers) write it: ave(coredata(mydata), as.date(index(mydata)), fun = function(x) cumprod((cummax(x) - x) < limit)) but can't introduce there vector longer x (it should have same length each day) , don't know how introduce argument in ave() . seems routine imposes intraday stoploss based on maxdrawdow...

c# - how do I? simple scramble/encrypt string in server (ASP.NET) and unscramble/decrypt in javascript -

platform: server - asp.net 3.5 / c#; client side - javascript/jquery this want do scramble string in asp.net webmethod (called through jquery ajax call) before sending client unscramble in javascript , display i'm not looking @ sort of heavy duty encryption aes sha whatever. i'm interested in simple obfuscation - if user wants persevere , decrypt strings (which display anyway in sequence, it's don't want them see of them in mark-up) can, doesn't matter. are there simple schemes this? for clarity: say want send pre-filled array client browser ["a'"b","c"] when opens source on browser, he/she should see, say. ["m","n","o"] but when display, recompute "a" , show it. that's all. what ever intention may be... why not implement simplest "encryption"-algorithm out there rot13

Running Python command-line utility from Java -

i developed command-line utility needs called java gui application. team in charge on java gui bind command-line application button in gui; python application such @ time have no time or interest in rewriting in java. i have no experience whatsoever in java, ask you: what best way bind command-line based python application button in java-based gui application? i concerned exception management (how tell java python failed). thanks. you should able execute spawned process java using runtime.exec() . here's examples . make sure capture stdout , stderr (concurrently - see this answer more details) can report on errors. can capture exit code of application, make sure application correctly reports errors. error code more reliable way of detecting errors (i suspect) thatn parsing output streams.

Why we using #ifdef DEBUG in iphone -

thanks sending me answer in advance....i m beginner in iphone. i excited why using #ifdef debug in iphone.also wanting information how use , limitation. a code in #ifdef debug //some code #endif is executed in debug builds. why use it? because can add logging debug builds in order information performance or else want know code.

ASP.NET with VS 2010: Web Site or Web Application? -

when start new asp.net project in visual studio 2010, can either create new asp.net web site or asp.net web application. what's difference between these 2 project types? why choose 1 on other? please note : question exact duplicate of this one , i'm asking visual studio 2010 (there no answers targeted @ vs 2010 in original question). answers of other question still valid or there changes vs2010 results in different answers? i want give example website means site can information. collection of websites in web application. example take company site. , coming web application best example gmail. application . use. general difference between these two. may contain collection of websites. depending on requirement.

c# - save string array in binary format -

string value1 , value1 ; int length1 , length2 ; system.collections.bitarray bitvalue1 = new system.collections.bitarray(length1); system.collections.bitarray bitvalue2 = new system.collections.bitarray(length2); i'm looking fastest way covert each string bitarray defined length each string (the string should trimmed if larger defined length , if strings size smaller remaining bits filled false) , put 2 strings , write in binary file . edit : @dtb : simple example can value1 = "a" ,value2 = "b" , length1 =8 , length2 = 16 , result 010000010000000001000010 first 8 bits "a" , next 16 bits "b" //source string string value1 = "t"; //length in bits int length1 = 2; //convert text array of ascii bytes byte[] bytes = system.text.encoding.ascii.getbytes(value1); //create temp bitarray bytes system.collections.bitarray tempbits = new system.collections.bitarray...

c# - what's the tricky to delete temp folder in the installer? -

i creating msi installer via vs 2008. try delete temp folder @ end of installation. temp folder created installer hold batch files database creation. show other process access , doesn't allow code delete it. have called close() of access process. have put sleep before code delete it. nothing helpful. do have idea how can delete @ end of installation? thanks, did try filemon see accessing temp folder when delete called on folder? better use system temp folder path system.environment.getenvironmentvariable("temp") you need not worry cleaning up.

How do I enumerate through Active Directory Schema attributes? -

Image
i'm trying enumerate through active directory schema , don't think i'm seeing attributes. take , tell me i'm going wrong? objroot = new directoryentry("ldap://" + servername + ":" + port + "/rootdse"); strschemanamingcontext = objroot.properties[ "schemanamingcontext"].value.tostring(); objschema = new directoryentry(string.concat("ldap://" + servername + ":" + port + "/", strschemanamingcontext)); foreach (directoryentry schemaobjecttotest in objschema.children) { var rest = schemaobjecttotest.properties["systemflags"].value; } you might want check out c# open source browser active directory: beavertail . with beavertail, can opt show schema container alongside "regular" ad tree, , when @ schema on windows 2003 server, see quite few schema classes!

How can I transfer a file using scp without a password from a Perl script? -

i writing perl script needs transfer files between computers using scp. know public key authentication, need script automated, can't visit machines set keys before script run. is there way either pass password scp perl script or set keys within perl script? this script run part of build script reimages hard drive need run script on. can't there set keys every time project built. you use perl expect module, see an example @ house consultants' forum . its documentation has telnet example changed ssh. net::ssh::expect perl module want. haven't used 1 previously, though.

iphone - Adding a UIView below the screen -

i have uiviewcontroller added using addsubview hanging out on top of uiviewcontroller. added view hang out below screen called nice animation when need it. is there way add subview screen @ location? you modify .frame property, e.g. [self.view addsubview:theview]; cgrect newframe = theview.frame; newframe.origin.y = self.view.bounds.size.height; theview.frame = newframe;

joomla1.5 - Joomla displaying blank page after login after moving the installation from one server to another -

i moved current office joomla 1.5.8 instalation server(linux) local machines (winxp) can work locally , upload changes. the thing after downloading files , installing backup of remote db on local machine found myself unable login administrator panel, can see frontpage not login :/ so far, have googled alot problem, people seem experiencing problem while upgrading joomla 1.0 to make sure problem not on permissions files,i did separate brand new joomla instalation on folder , worked fine, access website , login admin page, changed config file connect joomla i'm trying move , find myself again unable login :/ i think problem on db tried searching specific paths no luck does has idea? thanks in advance :) try change following variable in local configuration file local values. var $offline = '0'; var $log_path = 'your local joomla path\logs'; var $tmp_path = 'your local joomla path\tmp'; var $live_site = 'local url here'; var $d...

Java: Instantiating a generic class with no default constructor -

i trying this: public class basetable<t extends tableentry> { protected int mrows; protected int mcols; protected arraylist<t> mentries; public basetable(int rows, int cols) { mrows = rows; mcols = cols; mentries = new arraylist<t>(); (int = 0; < rows; i++) { mentries.add(new t(cols)); //this obv. doesn't work } } } instantiating generics hard enough is, makes harder t here not have default constructor, takes single int parameter in constructor. how can done? i have asked follow question here too. i'd grateful if answer well. this question related, relevant classes assumed have default constructor. it said, can't create instance of t new , use factory pattern or prototype pattern so constructor public basetable(int rows, int cols, linefactory factory) appropriate instance of factory. in case, prefer prototype pattern, because tableent...

iphone - How to check if ipod has music files -

i trying have app play music ipod using mpmusicplayercontroller there devices not have music in there ipod library. can tell me if there way check whether there music in ipod library or not before initializing ipod player. thanks in advance. if ([[[mpmediaquery songsquery] items] count] > 0) { // user has songs in or library. }

c# - No control created on page_load -

i have asp page containing 2 radio buttons , other textbox , labels. things have make of them disapear (not visible) when radio button selected. i thought using controlcollection , adding control need make invisible it. had them controlcollection, disapear web page. have no idea why. c# code : private void creategroup() { controlcollection cc = createcontrolcollection(); cc.add(txt1); cc.add(txt2); // , on... } if call function on page_load() event, no control on page. thanks have tried setting visible=false each control in radio button selection handler? void yourradiobutton_checkchanged(object sender, eventargs e) { txt1.visible = !yourradiobutton.checked; txt2.visible = !yourradiobutton.checked; // , on... } if want create collections of controls in page load ease manipulation, create list<webcontrol> . list<webcontrol> yourcontrols = new list<webcontrol>(); //... protected void page_load(object...

httpsession - How to find out what open sessions my servlet based application is handling at any given moment -

i need write servlet that, when called, gets information list of opened sessions. is there way this? implement httpsessionlistener , give static set<httpsession> property, add session during sessioncreated() method, remove session during sessiondestroyed() method, register listener <listener> in web.xml . you've class has open sessions in current jboss instance collected. here's basic example: public httpsessioncollector implements httpsessionlistener { private static final set<httpsession> sessions = concurrenthashmap.newkeyset(); public void sessioncreated(httpsessionevent event) { sessions.add(event.getsession()); } public void sessiondestroyed(httpsessionevent event) { sessions.remove(event.getsession()); } public static set<httpsession> getsessions() { return sessions; } } then in servlet do: set<httpsession> sessions = httpsessioncollector.getsessions(); if rath...

events - jQuery show / hide elements by select field -

i have select field shows different elements of form based on selected value, have 3 "classes" each show required portions of filed. have selects bound .click() , works fine except if want load page value preselected, won't show required parts of form because select field hasn't been clicked. i've looked around , don't see event allow me show information based on selected value, i'm not expert maybe i'm misunderstanding of functions. here's relevant portion of html: <select name="class"> <option value="vehicle" selected="selected">vehicle</option> <option value="part">part</option> <option value="project">project</option> <option value="vehicle">vehicle</option> </select><br /> <etc...> and current jquery switcher: $("select option[value='project']").click(funct...

nomenclature - Why "class" for class in Java? -

why did creators of java use name "class" classes in java? term come from? java didn't invent name class - used in languages prior, c++. i think name "class" refers class of objects, in classification (or type). , object instance of type. here first definition of "class" dictionary.com: a number of persons or things regarded forming group reason of common attributes, characteristics, qualities, or traits; kind; sort. so right in line know class in computer science - "characteristics/qualities/traits" being fields , methods.

c++ - const correctness problem with copy constructor? -

i trying wrap c structure in c++ class take advantage of memory management , such. have mad structure private member , provided public function provide access. return type constant, since functions take object argument have const in signature. #include <gsl/gsl_rng.h> class gslrand { gsl_rng* r_; // see links below public: gslrand() { gsl_rng_env_setup(); r_ = gsl_rng_alloc(gsl_rng_default); } ~gslrand() { gsl_rng_free(r_); } const gsl_rng* rng() { return r_; } }; that compiles nicely. problem occurs when clever , try add copy constructor. introducing class like... public: .... gslrand(const gslrand& r) { r_ = gsl_rng_alloc(gsl_rng_taus); gsl_rng_memcpy(r_, r.rng()); } .... i following compiler error: gslrand.h: in copy constructor ‘gslrand::gslrand(const gslrand&)’: gslrand.h:35: error: passing ‘const gslrand’ ‘this’ argument of ‘gsl_rng* gslrand::rng()’ discards qua...

php - Bulk Email Validator -

i wish either make use of freely available email validator (software, script or online service). if not exist, there free php classes can make use of validate email addresses? i have 100 emails , before send these emails check validity. don't want server blacklisted because of bounce backs. please note, not looking a syntax checker. talking dns , smtp validation. the ideal solution php script or can setup locally or on server. thanks help try running gethostbyname() on whatever after @ , if doesnt return ip, not valid dns

actionscript 3 - Using an API (JSON) with Flash (AS3) -

i want build application flash cs5 use api returns responces in json. how can in flash? another question can go in thread is... how can use ajax api google's transliteration flash? as3corelib features json de-/encoder: http://github.com/mikechambers/as3corelib/tree/master/src/com/adobe/serialization/json/

firefox3.6 - Native Drag + Drop file upload in Firefox 3.6 -

i've been told colleague firefox 3.6 supports native drag , drop file uploads + image resizing operating system without extensions or plugins required. can post code snippet or provide link demonstrates new functionality (as couldn't find on google search)? http://hacks.mozilla.org/2009/12/file-drag-and-drop-in-firefox-3-6/ edit: https://developer.mozilla.org/en/css/-moz-background-size if that's image resizing you're after

coding style - (Usage of Class Variables) Pythonic - or nasty habit learnt from java? -

hello pythoneers: following code mock of i'm trying do, should illustrate question. i know if dirty trick picked java programming, or valid , pythonic way of doing things: i'm creating load of instances, need track 'static' data of instances created. class myclass: counter=0 last_value=none def __init__(self,name): self.name=name myclass.counter+=1 myclass.last_value=name and output of using simple class , showing working expected: >>> x=myclass("hello") >>> print x.name hello >>> print myclass.last_value hello >>> y=myclass("goodbye") >>> print y.name goodbye >>> print x.name hello >>> print myclass.last_value goodbye so acceptable way of doing kind of thing, or anti-pattern ? [for instance, i'm not happy can apparently set counter both within class(good) , outside of it(bad); not keen on having u...

c# - LINQ - Association mapping - Null reference on InsertOnSubmit -

i've table role associated in 1-many relation table user in database. i've created linq mapping classes manually: [table(name="role")] public class role { private entityset<user> _users; [column(isprimarykey = true, isdbgenerated = true, autosync = autosync.oninsert)] public int roleid { get; set; } [column] public string name { get; set; } [association(name = "fk_user_role", storage = "_users", thiskey = "roleid", otherkey = "roleid")] public entityset<user> users { get{ return this._users; } set{ this._users.assign(value);} } } the problem entityset users can't nullable if later wish create new role: public override void createrole(string rolename) { try { role new_role = new role(); new_role.name = rolename; _rolesrepository.saverole(new_role); } catch { throw; } } i'm getting error message ...

mod rewrite - redirect an internal IP from HTTP to HTTPS with Apache -

hey all- have looked on here , google none of suggestions seem working me. i'm working on internal site @ point endpoints ips vs urls. accessing site via https works, http says "cannot establish connection". can't seem find in logs explains why. have warnings cert since self signed don't think causing it. have tried rewrite , redirect both separately no luck. have them both commented out below, have tried 1 or other on. #<virtualhost *:80> # rewriteengine on # rewritecond %{https} off # rewriterule (.*) https://%{http_host}%{request_uri} #</virtualhost> <virtualhost *:443> servername 192.168.xxx.xxx proxyrequests off proxypreservehost on sslengine on sslcertificatefile /etc/httpd/ssl/server.crt sslcertificatekeyfile /etc/httpd/ssl/server.key proxypass / http://localhost:8080/ proxypassreverse / http://localhost:8080/ <proxy *> order deny,allow allow </proxy> ...