Posts

Showing posts from May, 2010

authorization - Retrieving the Subject executing a java.security.PrivilegedAction at runtime -

i trying retrieve subject executing privileged action under jaas framework, in order able extract principals. basically, need verify @ run-time privileged action indeed executed principal has right so. or, put differently: possible current logincontext @ run-time kind of system property (and not creating new one)? allow extracting subject. are sure need logincontext? if need subject (with attached principals), can do subject activesubject = subject.getsubject(accesscontroller.getcontext());

c# - Report generator options for a Winforms app? -

i’m selecting report generator .net winforms app , it’s driving me crazy. i’m not familiar @ report generators so… does knows of report generator that: 1.- easy deploy in relation main app a. (least, least, least desirable) have separate scriptable/silent installer (i can make app installer call report generator installer) b. (i can live this) have “integrable” installer (an integrated installer both app , report generator can made easily) c. (most desirable) clickonce/xcopy installation possible (no installer @ all!!! yay!!!!). 2.- scriptable degree: a. (i can live this) possible change properties (image sources, colors, visibility, widths, etc.) @ runtime? b. (most desirable) possible –in addition previous item- add/remove elements report @ runtime? 3.- self-adjusts when resize page: a. (least desirable) have manually resize things dynamically accessing report structures (related 2a) b. (mos

Problem with Visual Studio menu entry event handler in PowerShell -

i try menu entry in visual studio using powershell in nuget console or power console. these powershell hosts run in context of visual studio. got somewhere, not far enough... menu entry appears (right-click on solution), can't event handler connected... my code: pm> $sol = $dte.commandbars | where-object { $_.name -like 'solution' } pm> $menuitem = $sol.controls.add([microsoft.visualstudio.commandbars.msocontroltype]::msocontrolbutton, 1, "", 1, $true) pm> $menuitem.caption = "action nuget" pm> $menuitemhandler = $dte.events.commandbarevents($menuitem) pm> $commandbarevents = get-interface $menuitemhandler ([envdte._dispcommandbarcontrolevents_event]) pm> $commandbarevents.add_click([envdte._dispcommandbarcontrolevents_clickeventhandler]{write-host “clicked”}) cannot convert value "write-host “clicked”" type "envdte._dispcommandbarcontrolevents_clickeventhandler". error: "the type 'system.boolean&

c++ - Will this result in a memory leak? -

my c++ pretty rusty started using hobby project got "level up"-again.. #include "stdafx.h" #include "stdlib.h" class { public: void call() { printf("call called\n"); } }; class b { public: b() { this->pointer = new a; } void call() { this->pointer->call(); } private: a* pointer; }; int _tmain(int argc, _tchar* argv[]) { b t; t.call(); system("pause"); return 0; } will result in memory leak? , how can delete pointers if program decides not need them anymore? would "delete t" enough or produces memory leak too? pointer in b allocated never deleted. you'll want define destructor b deletes a , otherwise leak a pointed pointer every time b goes out of scope: b::~b() { delete pointer; }

php - Letting an object decide its class -

i'm sorry not come more descriptive title. problem following. assume have 2 classes , b , know may happen code tries instantiate object of type when needed object of type b. point the code decide 1 right object naturally belongs class a , not client code. in javascript (ok, js doesn't have classes, makes point clear) can do function a() { if(some_condition) { return new b(); } //else proceed customize , return our object } i want similar in php. best thing can come is class { private function __construct() { //whatever need } public static function getinstance() { if(some_condition) { return new b(); } else { return new a(); } } } the problem client code have know special , have instantiate objects static method. is there way delegate choice of type of object return in seamless way? unfortunately no, best think can like: class decider { public st

Webdriver: java.net.BindException: Address already in use: connect -

while running webdriver, 3 minutes running, following exception , webdriver crashes. i using 1 webdriver instance , 1 firefoxdriver profile. exception in thread "main" org.openqa.selenium.webdriverexception: java.net.bindexception: address in use: connect system info: os.name: 'windows xp', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_18' driver info: driver.version: remote @ org.openqa.selenium.remote.remotewebdriver.execute(remotewebdriver.java: 341) @ org.openqa.selenium.firefox.firefoxdriver.execute(firefoxdriver.java: 234) @ org.openqa.selenium.remote.remotewebdriver.findelements(remotewebdriver.java: 173) @ org.openqa.selenium.remote.remotewebdriver.findelementsbyxpath(remotewebdriver.java: 231) @ org.openqa.selenium.by$6.findelements(by.java:200) @ org.openqa.selenium.remote.remotewebdriver.findelements(remotewebdriver.java: 158) caused by: java.net.bindexception: addres

java me - how to Download different mobile phone simulators? -

i have created application.it works correctly in default simulator of wtk (sun java wirless toolkit).but not correctly in phone (which used testing purpose).so friend suggest me download different phone simulators web & test there. but deos not know site used downloading freely mobile phone simulators.suggest me sites,or other source. you can download emulator following sites, sprint sdk sony ericsson sdk samsung sdk motorola sdk nokia sdk and can test application on nokia rda devices. see site. nokia rda devices

iOS: Audio: Code needed for reading, processing, writing sound files + MIDI Processing -

what think need create code lets me read in bunch of raw sound files (ie complete sound font guitar), processes these files (to construct chords), , outputs result set of files. my question: can point me code close task, save me having scratch? edit: answer below have suggested use garage band have had at. looks great tool. can construct 24 chords on garage band. need save midi, , write own code process midi file, adjusting volumes of individual notes, save it, feed through garage band recording sound. can point me code me started processing midi thus? sam ps if of interest, working on: http://imagebin.org/125562 the difficulty face how voice chords... if {c4 e4 g4} c major chord, , {g4 b5 d5} g, etc, going sound horrible a pianist doesn't move c g that. there art voicing, each note attempts move minimal distance new resolution. and can't see formula depicting in way key agnostic. so attempting instead play cs es , gs, create sound texture 

winforms - C#: easiest way to populate a ListBox from a List -

if have list of strings, eg: list<string> mylist = new list<string>(); mylist.add("hello"); mylist.add("world"); is there easy way populate listbox using contents of mylist? try list<string> mylist = new list<string>(); mylist.add("hello"); mylist.add("world"); listbox1.datasource = mylist; have @ listcontrol.datasource property

iphone - How to reload splitview after second logIn? -

in application , have simple login screen. after login, splitview appears on screen adding splitviewcontroller on window subview. till works fine , i'm able navigate through different screens whenever tried login user2 after loging out user1. still shows data of user1. know happens because i'm unable reload splitview. can me, how reload splitview?? on successful log in, need (re)set datasource, remove detail view, , reload data on tableview in navigation controller. without seeing how pulling in data, cant tell code need call.

javascript - is there compability problem between document.location.href with document.URL? -

what different between document.location.href document.url? there compability problem? from the mozilla docs : url replacement dom level 0 document.location.href property. however, document.location.href settable, , document.url not. document.location not part of standard (dom level 0) though browsers support it. document.url part of w3c dom level 2 specification.

javascript - How to insert a newline character after every 200 characters with jQuery -

i have textbox use insert information. want insert newline character after every 200 characters using jquery or javascript. for instance: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa in example, want insert newline chracter after every 200 characters. how can this? break string after every 200 characters, add newline, , repeat process remaining string: function addnewlines(str) { var result = ''; while (str.length > 0) { result += str.substring(0, 200) + '\n'; str = str.substring(200); } return result; }

jquery uploadify -

i want upload multiple file title , link. getting following error invalid property id $('#divupload').uploadifysettings('scriptdata',{,'txttitle1':'title1','tbxlink1':'link1','1':'image1.png'},'1'); my code : <script type="text/javascript" language="javascript"> var divmsg ='<%= divmsg.clientid %>'; var errcnt=0; $(document).ready(function() { $('#divupload').uploadify({ 'uploader': websiteurl + 'admin/fileupload/uploadify.swf', 'script': websiteurl + 'admin/banner-image-upload.aspx?type=fileupload', 'multi' : 'true', 'method' : 'post', 'cancelimg' : websiteurl + 'admin/images/cancel.png', 'folder': '../source/bannerimage', 'queuesizelimit' : '20',

HTML/CGI: When linking, append variable/value pair instead of replacing? -

if on page foo.php have link <a href=?bar=baz>click</a> , link bring user foo.php?bar=baz. if user on foo.php?bar=baz, , want link them foo.php?bar=baz&qux=derp, there way express in href attribute of tag? if tag <a href=?qux=derp>click</a> user directed foo.php?qux=derp instead of foo.php?bar=baz&qux=derp. thanks! i tagged cgi because think ?bar=baz part of url more related towards that, please correct me if wrong. there no way so. need parse current url , add new parameter appropriately.

c# - Sql Exception was caught -

i have method public static dataset getalldatabasenames() { //instance of connection created sqlconnection sconnection = new sqlconnection(configurationsettings.appsettings["connectionstring"]); //to open connection. sconnection.open(); string selectdatabase = @"select [name] [master..sysdatabases]"; //instance of command created. sqlcommand scommand = new sqlcommand(selectdatabase, sconnection); try { //create dataset. dataset dslistofdatabases = new dataset("master..sysdatabases"); //create dataadapter object. sqldataadapter da = new sqldataadapter(selectdatabase, sconnection); //provides master mapping between sourcr table , system.data.datatable da.tablemap

jsp - Writing contents of form to a text file -

i have written code want contents of form , write same textfile. code doesn't write text file. problem following code? <%@ page import="java.io.*" %> <html> <head> <script type="text/javascript"> function mysave() { var fo=fopen("d:\\t.txt",3); if(fo!=-1) { var q=document.getelementbyname("qn").value; var a=document.getelementbyname("a").value; var b=document.getelementbyname("b").value; var c=document.getelementbyname("c").value; var d=document.getelementbyname("d").value; fwrite(fo,q); fclose(fo); } else { return false; } </script> <body> <form method="post" action="text.jsp" onsubmit="mysave()"> <center> <table> <tr><td> question :</td><td><input type="text" size="75" name="qn"/></td></tr><tr><td>

jquery - Struts 2.0 not working in IE -

i have website uses struts 2.0 ajax tags..the website displaying/working fine in mozilla firefox when tried view in internet explorer not working tags , not supporting json.. dont know how solve it..i need make application browser independent..is there difference in coding struts 2 in ie , mozilla? how can solve problem? and when tried use in windows struts2 buttons , tab not working.. working correct in linux.. how solve this.. thanks in advance help. i don't think related struts 2.0, server side technology. it's custom tags translated @ server side. possible ajax/javascript features using, non ie compliant.

java - How to identify whether a web server supports Web Services or not? -

i not aware details web servers support web services written in java. would know following 3 things: 1) required have support web services : servlet container or application server + web container? 2) know web server supporting web development in java support web services? 3) how identify whether particular server supports web services or not? thanking in advance. your question unclear. term web service applied rest style api soap based services json based, etc etc. wikipedia says equivalent web api , , api can pretty anything. so answer question. servlet container enough support common types of web services, doesn't require application server. take @ apache cxf , framework catering lot of web services styles (notably soap , rest). apache cxf rather large framework, , can take time head around. if need simpler, may better off looking @ object serialization frameworks , implement servlets (this mostly). serialize xml, use out-of-the box java jaxb annotati

Do POST request with Android DefaultHTTPClient cause freeze on execute() -

i need post data server. use code: httpclient client = new defaulthttpclient(); try { httppost httppost = new httppost(serverurl); stringentity se = new stringentity(data); httppost.setentity(se); httppost.setheader("accept", "application/json"); httppost.setheader("content-type", "application/json"); // execute http post request httpresponse response = client.execute(httppost); int statuscode = response.getstatusline().getstatuscode(); log.i(tvprogram.tag, "errorhandler post status code: " + statuscode); } catch (exception e) { e.printstacktrace(); } { if (client != null) { client.getconnectionmanager().shutdown(); } } but problem android freeze on execute() method, application blocked out , after time android tell me application doesn't respond. i tried debug sdk classes , freeze in abstractsessioninputbuffer class on line 103 l = this.instream.read(this.buffe

branch - Why is branching in SVN not good enough? -

i've heard how git has redesigned how branching works, , how svn's branching model screwed up. i've not used svn, have no preconceptions branch should like. first looked @ git branches, , "get" it. what practical drawbacks of svn branches? answers pov of workflow, branching strategy , branch performance (in terms of commit/checkout/switch times) encouraged. thanks, jrh a few things come mind all branches stored in central repository. if you're not connected server, or connection slow, can't access them quickly. all branches stored in central repository. means they're public -- on team can view them. there's no way keep private branch no 1 else has access to. the dag of commits contains enough information can figure out changes included in current version of code, including changes number of branches. in svn, iirc, done using svn:mergeinfo property, more complicated imho, , error-prone because might forget commit changed p

reference - HTML: when pages are saved have images / files not saved -

well not trying apply fool proof security or anything.. want know when page save web... links css \ js files , images not save... how achieve it.. again not applying security or anything.. know images there in temp, or can open source , link css files.. want learn this well, css can imported via <link rel="stylesheet" type="text/css" href="my.css"> , , similar goes javascript. further more, can inject javascript somewhere - doubt web browsers 'know' how save that. same goes images - if inject them via js, browser unable save them. as said,it's not foolproof :)

Publish asp.net mvc missing images -

i have networkdrive z: publish asp.net mvc project to, , when images content/images directory doesnt published. why that? every time have copy imagesfolder manually make sure. have set deletes on target before publishes. in solution explorer (ctrl+w,s) select image not copied publish folder. check properties panel (ctrl+w,p) , make sure image has "build action" property set "content". from description assume set "none".

internet explorer - Could someone help me achieve this in CSS? -

basically want display 2 span next each other. condition first span has max-width 200px if exceeds 200px overflowed characters hidden overflow:hidden applied span. condition second span display time next first span. the problem since ie not support (ie7, ie8) max-width feature cannot use property. there other way achieve this? so have: <div> <span>one</span> <--- max width 200 px <span>two</span> <--- alwats display next span 1 </div> i want display span 2 right next span 1. adding width span 1 leave huge space between span 1 , span 2 cannot this. need expand span 1 dynamically until overflowed. , need cross browser compatible ;( thanks. please see if this after. works alright in ie8, have tested it. html: <div id="content"> <span>oneedaskdaslkdjsaldjaslkdjaslkdjldasdasdasdasdalkdnaskdnasjkdnaskjdnaskjndaskjndajksdnasjkdnkjsandkjsandkjasndkjasndjksandkjsandjkndjksandjkasndjkasndkjasndkjsnaj

android webview showing two edit fields -

Image
i using web view in activity. using url load page. page contains text field takes user-name , password input user. when click on nay of field corresponding small field shown overlapping other. here attaching image how looks when click password field.. can tell me how solve this? thanks. duplicate question: double text box showing on android ics webview looks have add -webkit-user-modify: read-write-plaintext-only; to css input fields.

compilation - Problem compiling self-created header file using Dev-C++? -

i using dev-c++ on windows vista. have 3 files located in same directory. are: - math_functions.h - math_functions.c - test3.c math_functions.h code: int sum (int x, int y); float average (float x, float y, float z); math_functions.c code: int sum (int x, int y) { return (x + y); } float average (float x, float y, float z) { return (x + y + z) / 3; } test3.c code: #include <stdio.h> #include "math_functions.h" main () { int thesum = sum (8, 12); float theaverage = average (16.9, 7.86, 3.4); printf ("the sum is: %i ", thesum); printf ("and average is: %f \n", theaverage); printf ("average casted int is: %i \n", (int)theaverage); } it fails compile. error message is: c:\users\esum\appdata\local\temp\cckmdaaa.o(.text+0x3a) in function `main': [linker error] undefined reference `sum' [linker error] undefined reference `average' c:\users\esum\appdata\local\temp\cckmdaaa.o(.tex

windows - Why ruby installed from RubyInstaller doesn't find dll's placed inside gem/lib folder? -

my system: windows 7 x64. i've installed: ruby rubyinstaller (1.8.7) gem install rake gem install libxml-ruby --platform=mswin32 now, when make: require 'xml' i error missing libxml2-2.dll (and libiconv-2.dll). can find 2 libraries in 'ruby187\lib\ruby\gems\1.8\gems\libxml-ruby-1.1.4-x86-mswin32-60\lib\'. when copy them 'ruby187\bin' folder works. but... if install ruby old oneclick installer, libxml-ruby works without copying dll's ruby\bin folder. i've looked path variable - it's not pointing libxml-ruby lib folder, imho ruby finds them in other way. and question. can do, ruby rubyinstaller act similarily 1 oneclick installer? don't want add \lib folder path (oneclick installer doesn't need that) , don't want copy dll's ruby\bin you try rubystack installer, if seing no way around it. (i have working many gems, in win 7 64 bits, no issues date...)

java - What is the best practice when implementing equals() for entities with generated ids -

if have table columns a, b, c, d  a: auto-generated id (pk)  b & c: combination must unique (these columns define identity in business sense)  d: other columns now, if i'll create business objects based on table (e.g. in java), 1 better implementation of equals() method: define equality based on a define equality based on b , c or, wouldn't matter of 2 choose. definitely b , c, because want equals() contract valid before entities persisted. yourself: these columns define identity in business sense if case, logic equals() should use. database keys database's concern , should of no concern business layer. and don't forget use same properties in hashcode() , too.

user interface - UI Automation Testing Tools -

i'm working on ui automation. we using following tools. bewildr snoop our wpf application uses custom framework developed company. many of buttons generated dynamically. example, controls have id guids, new id guids every time run program. many controls don't have names. are there other tools might worth look? is commercial or personal - ie have budget? that'll affect whether might consider mercury or hp suites, or go straight opensource ;) http://en.wikipedia.org/wiki/list_of_gui_testing_tools provides list of gui testing tools. autoit nice , easy learn , use, if you're coder anyway. phantom al , icutest both useful wpf applications. if have budget, there's not better mercury/hp toolsets - qtp (quicktest pro) , winrunner - former uses vbscript while later uses custom test script language - clever writing tests. i won't provide links them wiki article has that, hope helps. as targeting names, hypothetically work out order in they&

java - Pitch and Yaw on a 2D ImagePlus object -

i using service , when given human face, returns "roll" "yaw" , "pitch" values. i have picture imageplus object java. used rotate() function imageprocessor() instance of imageplus object simulate "roll" measurment returned service. however, since using 2d graphic, there anyway can use "pitch" , "yaw" measurments better simulate picture? thanks, joel i assume "roll", "pitch" , "yaw" have same meaning in flight dynamics. can simulate effects of "pitch" , "yaw" applying vertical , horisontal perspective corrections. simpest form map rectangle trapezium: ________ ____________ | | \ / | | ==> \ / | | \ / |________| \____/ you mention imageplus object, conclude programming imagej. in case can how implement perspective correction in source code of perspective correction pl

sql server - SQL database permissions required to use impersonation from SSRS connection -

i encountering following error when try specify datasource ssrs sql server db (2008) using "credentials stored securely in server" - specified windows account "s2\killian" option "impersonate authenticated user after connection has been made" checked. msg 15157, level 16, state 1, line 1 setuser failed because of 1 of following reasons: database principal 's2\killian' not exist, corresponding server principal not have server access, type of database principal cannot impersonated, or not have permission. obviously method of impersonation uses setuser() function behind scenes , msdn documentation states dbowner permissions required in order use function. getting above error when using dbowner. not in position use sysadmin because of security policy. does know how mechanism of authentication , impersonation working without assigning sysadmin priveleges on sql server database windows account used ssrs data source. is there way of getting s

Haskell, possible indentation error that I can't get rid of -

i have problem , cannot find out is. have reindented again on , over, cannot find solution. there else can dependent on? code: type triple = (prime, quot, gen) correctness :: triple -> bool correctness (p,q,g) = prime && plength && qlength && divisor && orderq prime = probablyprime n 5 qlength = q < 2^1024 plength = p < 2^160 divisor = (p-1 `mod` q) == 0 orderq = (g^q mod p == 1) && (g > 1) error message (line 94 corresponds "correctness :: triple -> bool"): crypt.hs:94:0: parse error (possibly incorrect indentation) edit: solved problem. problem syntax error in above function. had otherwise m_ify m*2 instead of otherwise = m_ify m*2 you might need add backticks around mod in final line. wouldn't cause indentation error report, following compiles me: n = undefined probablyprime = undefined type prime = int typ

javascript - Any sortable plugin that allow me to reorder the widgets and save their state? -

i have columns divs on left , right, want plugin or script allow me allow sorting , reording columns between each , every column specific class example. i tried ui.sortables, it's perfect , easy , can connect 2 columns have never figured out how save state divs (it can done ul though) want sortable plugin allows save state divs please i desperate function, can suggest me plugin has features included, in advance we used script store of our info on client side, worked nicely. might worth checking out. require prototype http://ajaxian.com/archives/cookiejar-json-cookies

c# - Web: View raw content of a file from the FileName and the FileContent -

i'm using asp mvc , , want allow user download/view files web server. the files not located in web server. i know file content (a byte[] array), , file name . i want same behavior web broswer. example, if mime type text, want see text, if it's image, same, if it's binary, propose download. what best way this? thanks in advanced. the answer images available here for other types, have determine mime type file name extension. can use either windows registry or well-known hashtable, or iis configuration (if running on iis). if plan use registry, here code determines mime content type given extension: public static string getregistrycontenttype(string filename) { if (filename == null) throw new argumentnullexception("filename"); // determine extension string extension = system.io.path.getextension(filename); string contenttype = null; using (microsoft.win32.registrykey key = mi

Why is this many-to-many relation changing whitout me asking for it, using the Django ORM? -

i have recursive m2m relationship indicator class. indicator int, or calculated value 2 indicators: class indicator(models.model): params = models.manytomanyfield('self', verbose_name=__(u'parameters'), related_name='params_of', blank=true, null=true) type = models.charfield(max_length=64, verbose_name=__(u'type')) def get_value(self, record): # etc according type, get_value doesn't same things. can return numerical value or calculate value numerical value of each parameters params attribute. can see params recursive m2m relationship. now problem that, have follwoing indicators: men women total pop men ratio if add men , women parameters of total pop , fine, , total pop dynamically calculated. if add men , total pop parameters men ratio , then total pop automatically men ratio parameter. breaks everyth

silverlight - Secure / Authenticated interaction from a WP7 app -

i working on wp7 application. wp7 application interact web services have created. not want other applications interacting these web services. reason why because not want them stealing data. in mind, here i'm doing: connecting web services via https making users login application passing users username / password each web service interaction at time, don't see stopping malicious developer creating username / password combo , using account in application interact web services. how lock thing down? thanks! as start towards more secure system should stop storing password , sending on wire each request (even if you're using ssl). if must pass each request, store salted hash of password , use instead.

c# 4.0 - Silverlight 4 WScript.RegRead failing to read newly added value in registry under Windows 7 -

i have silverlight 4 application in can read existing registry values hklm branch no problem if add new value read fails filenotfoundexception . can see in code below; first read works fine second 1 fails read test value added in registry. note: able read newly added key under windows xp; not under windows 7. any appreciated. if (application.current.installstate == installstate.installed && application.current.haselevatedpermissions) { if (automationfactory.isavailable) { dynamic shell = automationfactory.createobject("wscript.shell"); try { var resa = shell.regread(@"hklm\software\microsoft\.netframework\installroot"); var resb = shell.regread(@"hklm\software\microsoft\.netframework\test"); var regvalue = shell.regread(dbtyperegkeyname); var dbtype = extractdbtypefromid(regvalue); } catch (filenotfoundexception filenotfoundexception)

How to handle AJAX driven website in asp.net MVC (lots of views and partialviews)? -

i in process of putting new site make use of ajax pull through page content should user have javascript enabled. so, in situation whereby every action method requires check see if request through ajax or not, straightforward. if request through ajax can return partialview, if not full view can returned. with pattern though, i'll need create view , partialview every page on site. real difference between them going inclusion of masterpage. am missing trick here is doubling of views way go? thanks edit - bit more info lets had page accessed through /site/test . somewhere in js add hash url #/site/test . js watch hash changes , load partial views needed. if js not available though, entire view need returned. so each page need view, include call renderpartial load partial view contain page content. so, every page there 2 files. seems there should cleaner way of doing this. sergio, yes missing trick!! you should organise page static content in - static. stati

iphone - Underline / Bold in UITextView -

is possible underline or embolden bits of text in uitextview? for example text view has headings in it, , underlined... random mode in random mode, can generate numbers... sweepstake mode in sweepstake mode... if not, best way achieve this? thanks use should use nsattributedstring... , use controllers drawing nsattributesstring.. controller nsattributedstring note: u cant use uitextview display nsattributedstring ps:from ios6, uilabel support nsattributedstring, should use uilabel directly instead of ohattributedlabel natively supported os.

visual studio 2008 - How do I configure IIS Express to run with VS2008? -

i have iis express beta downloaded , installed on winxp. don't have vs2010. how configure vs2008 launch iis express beta when debugging/running site? the following seems work iis express launching command line: open properties web site select start options under start action select start external program , put path iisexpress.exe ( c:\program files (x86)\iis express\iisexpress.exe ) command line arguments: /path:{path project solution} /clr:3.5 under server , select use custom server base url: http://localhost:8080/ (the default iis express, can change command line arguments) important! uncheck under debuggers otherwise you'll error "unable start debugging on web server..." information on launching using config file can found @ site: debug .net web project iis express [tips & tricks] . vs2010 specific suspect same work 2008.

iphone - Problem with configuring a UITableView as a inclusive selection list -

i programing uitableview behave inclusive selection list. table displays correctly , allows multiple cells selected check boxes. problem cells have been selected (cells contain check mark right) loose selected status when scrolled out of view (cells check mark disappears). want selections made cells in table preserved if cells scrolled out of view. have idea causing this? here code inside of tableviewcontroller class: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier] autorelease]; } nsuinteger row = [indexpath row]; cell.textlabel.text = [widgettitles_glob objectatindex:row]; cell.detailtextlabel.text = @""; cell.textlabel.textcolor = [uicolor bla

Missing dependencies with Atmosphere and Jersey -

i trying atmosphere jersey able broadcast messages users. on request jersey endpoint, following appears in log , results in servletexception. severe: following errors , warnings have been detected resource and/or provider classes: severe: missing dependency method public void org.apache.cxf.jaxrs.provider.jsonprovider.setmessagecontext(org.apache.cxf.jaxrs.ext.messagecontext) @ parameter @ index 7 severe: missing dependency field: private org.apache.cxf.jaxrs.ext.messagecontext org.apache.cxf.jaxrs.provider.requestdispatcherprovider.mc severe: missing dependency method public void org.apache.cxf.jaxrs.provider.jaxbelementprovider.setmessagecontext(org.apache.cxf.jaxrs.ext.messagecontext) @ parameter @ index 1 severe: missing dependency field: private org.apache.cxf.jaxrs.ext.messagecontext org.apache.cxf.jaxrs.provider.multipartprovider.mc severe: missing dependency method public void org.apache.cxf.jaxrs.provider.jaxbelementprovider.setmessagecontext(org.apache.cxf.jax

html - Stop browsers asking to resend form data on refresh? -

i have form submission via post. submit form, , well, if try reload new page form goes after submission, "do want resend data" message (firefox). might happen in other browsers too, i'm not sure. does know of way stop message popping can go ahead , refresh page. it's not production environments - users may submit same form twice! you need use the post-redirect-get pattern. make form respond redirect request. way, when user refreshes page, re-send get.

Trying to get list of freinds from twitter using httparty(ruby) -

trying list of specific user`s friends twitter. code - require 'rubygems' require 'httparty' class twitterdata include httparty base_uri 'http://api.twitter.com/1/' default_params :output => 'json' format :json def self.get_username_data(username) get('statuses/friends.json' , :query => { :screen_name => username }) end end puts "please twitter username - " twitter_username = gets puts twitterdata.get_username_data(twitter_username).inspect this error getting - please twitter username - twitter c:/ruby192/lib/ruby/gems/1.9.1/gems/crack-0.1.8/lib/crack/json.rb:14:in `rescue in parse': invalid json string (crack::parseerror) c:/ruby192/lib/ruby/gems/1.9.1/gems/crack-0.1.8/lib/crack/json.rb:12:in `parse' c:/ruby192/lib/ruby/gems/1.9.1/gems/httparty-0.6.1/lib/httparty/parser.rb:116:in `json' c:/ruby192/lib/ruby/gems/1.9.1/gems/httparty-0.6.1/lib/httparty/parser.rb:1

c# - Do I have a serious memory leak problem? -

i'm building windows form application in c# reads hundreds of file , create object hierarchy. in particular: debug[14]: imported 129 system/s, 6450 query/s, 6284293 document/s. the sum total number of object i've created. objects simple way, int/string properties , typed lists inside. question : normal application consuming 700mb of memory (in debug mode)? can how reduce memory usage? edit : here why have 6284293 objects, if you're curious. imagine search engine, called "system". system have more queries inside it. public class system { public list<query> queries; } each query object refers "topic"; main argument (eg. search "italy weekend"). ha list of retrieved document inside: public class query { public topic topic; // maintain reference topic public list<retrieveddocument> retrieveddocuments; public system system; // maintain reference system } each retrieved document has score , rank , has reference

Is there a way to set C# readonly auto-implemented Propeties through reflection? -

the title says all: there way set c# readonly auto-implemented propeties through reflection? typeof(change) .getproperty("changetype", bindingflags.instance | bindingflags.public) .setvalue(mychange, change.changetype.transform(),null); this line gives me error : system.argumentexception - {"property set method not found."} . thing can't use getfield because there no fields. before ask, i'm doing because need "complement" finished library , have no access code. this should work, there not telling us. sure it's auto-implemented property? explanation consistent seeing property not auto-implemented , not have setter. that is, public class foo { public int bar { get; set; } } typeof(foo).getproperty("bar").setvalue(foo, 42); will succeed but public class foo { public int bar { { return 42; } } } typeof(foo).getproperty("bar").setvalue(foo, 42); will not , produce exception message seeing.

http - Can Varnish be configured to try a second server for some resource if it gets a 404 from the primary server? -

this perfect solution me need serve generated content web browsers. plan generate content on demand , store next time. don't want browsers call service (which generates content) every time. want them go directly "cached" resource if it's available , call service if it's not. i'd put varinsh in front of server runs service , server b stores generated content versions. if gets request resource hasn't got cached it'll try server b. upon getting 404 response it'll request same resource server a. can varnish configured in such way vcl? if not there solution know about? p.s. don't want send 302 redirects browser plus don't have control on server b make send such redirects instead of 404's this possible in varnish. make sure in vcl_fetch (and possibly in vcl_error) check return status code (e.g. check status > 400), restart if failed, , in vcl_recv select other backend if req.restarts > 0. example: backend servera {

virtualization - How viable is it to virtualise mutliple servers on the same hardware? -

if virtualise 4 servers on 1 hardware (for instance 3 tomcat servers on same physical machine) can terminate 3 different ip addresses, hence 3 different http address same physical machine? i'm trying use temporary solution hosting same service 3 different departments pending software redesign solution , how viable solution. second question vm hardware setup kind of scenario? past readings topic suggests there 2 ways achieve virtualisation, work best? answers in advance. (researching possibilities mean time) yes, can have 3 different ip addresses. each server present network physically separate device. as far hardware, highly dependent on storage, load, , other requirements of these virtual servers be. but, you'll want fast storage, lots of ram, , decent multicore processor. look requirements of vmware esx. believe it's open source , can implemented free in non-commercial settings (but might not qualify sure check). this article couple of years old might

continuous integration - Teamcity and gitosis authentication issue -

i've git repository administered gitosis on server. on same server have teamcity ci. i can't seem connect git repository through teamcity. i've administrator user can access repository (its under git user on same server) through cygwin, when try setup teamcity access administrator's private key authentication issue: 'connection test failed: com.jcraft.jsch.jschexception: auth fail'. in team city have username style email, authentication method private key, username same public key , path private key correct. when using password access i'm told path doesn't git repository, though , works fine through cygwin. if has teamcity connecting gitosis repository please let me know how managed it. i've solved problem.... using wrong user type. using user name not user name email.

WPF validation rule problems in a datagrid -

i'm having problem using validation rule in data grid: i want use validationrule on datagridcomboboxcolumn, used this example for guidance, in particular bindinggroup stuff. this works extent seems broken. validatiorule doesn't fire combo box selection changes, instead fires when change selection click on row in datagrid. need fire have changed selection of combo box. i've tried messing validation step no avail, can help? thanks in advance! you need change default updatesourcetrigger property combobox . updatesourcetrigger=propertychanged if still doesn't work check out this post details way take care of selection change not being forced model.

.net - ASP.Net 301 redirects and URL rewriting -

i changed structure of page urls of 1 of websites using url rewriting , need redirect old structure new 1 (to handle old links indexed google). problem want redirect rewritten url, not actual url , cannot find way this. before changes had following urls: rewriterule ^products/([^_\r\n//]*)/([^_\r\n//]*)/$ /products.aspx?cat=$1&subcat=$2 [nc,l] after changes, have following: rewriterule ^products-([^_\r\n//]*)-([^_\r\n//]*)/$ /products.aspx?cat=$1&subcat=$2 [nc,l] what want issue 301 redirect urls match ^products/([^_\r\n//]*)/([^_\r\n//]*)/$ ^products-([^_\r\n//]*)-([^_\r\n//]*)/$, ie, have following rule: rewriterule ^products-([^_\r\n//]*)-([^_\r\n//]*)/$ products-([^_\r\n//]*)-([^_\r\n//]*)/ [nc,l] the above rule produces following error: "the page isn't redirecting properly" is there way .net or using url rewrite rules? any grately appreciated. ok, fixed problem using following rule: rewriterule ^products-([^_\r\n//]*)-([

git - What does HEAD point to? -

i want compare local master branch remote origin/master branch. know how git pull --rebase; git diff origin/master local master branch detect line-by-line differences in code. but, want compare commit histories, i.e., show git log , git log origin/master side-by-side. tried git show-branch -a got: * [master] change content background-color blue ! [origin/head] add favicon ! [origin/master] add favicon --- * [master] change content background-color blue *++ [origin/head] add favicon is there better way? also, head point to, checked-out commit? you do: git log master..origin/master to list commits "between" master , origin/master . head points checked out commit. both dot-dot syntax , head documented @ gitrevisions(7) .

python - What's the fastest way to loop through a list and create a single string? -

for example: list = [{"title_url": "joe_white", "id": 1, "title": "joe white"}, {"title_url": "peter_black", "id": 2, "title": "peter black"}] how can efficiently loop through create: joe white, peter black <a href="/u/joe_white">joe white</a>,<a href="/u/peter_black">peter black</a> thank you. the first pretty simple: ', '.join(item['title'] item in list) the second requires more complicated, same: ','.join('<a href="/u/%(title_url)s">%(title)s</a>' % item item in list) both use generator expressions , similar list comprehensions without need list creation

iphone - What is the best practice for sharing objects between threads for a real time game -

i want create real time game. game have model updated periodically... - (void) timerticks { [model iterate]; } like games, revive user input events, touches. in response need update model.... - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { [model updatevariableinmodel]; } so there 2 threads: from timer. iterates model from ui thread. updates the model based on user input both threads sharing variables in model. what best practice sharing objects between threads , avoiding multi threading issues? lock objects need shared across thread using @synchronized keyword. an easy way lock objects this: -(void) iterate { @synchronized(self) { // thread safe } } -(void) updatevariableinmodel { @synchronized(self) { // use variable pleased, don't worry concurrent modification } } for more info on threading in objective-c, please go here also note must lock same

c++ - Checksum of a function in memory -

i making kind of anti-hack thing program, , want able create checksum of bytes of function see if has been modified. know how checksum, how how many bytes should checksum? there way size of function? don't try. cannot assume function contiguous in memory: may have basicblocks lower start addresses entrypoint; may share trailing basicblocks other functions; may contain interspersed data or alignment bytes or may disappear entirely, depending on calling site (due compiler deciding inline function). there no way code know size of generated function. think it: size entirely dependent on compiler emits , depends on kinds of compiler settings , flags (think optimizing, heavily inlined release build vs debug build or using enhanced instruction sets sse vs not using them). also, indicated, such checksum check trivial work around hacker - branch have invert. and lastly, exercise curious , because potential malicious hackers use too, i'd recommend locking @ binary v

iphone - Dismissing a UIAlertView on any touch -

i trying use uialertview label (no title or buttons, display text) aesthetic purposes. want able continue use else in app (touch other buttons, etc.) while alert view being shown. unfortunately, cannot seem invoke touchesbegan or selector using uitapgesturerecognizer while alert view shown. these both work when alert view not shown, seems alert view disables detection of touches (other touching own buttons if had them). does know way work around this? if create uilabel , set background alert view image work. thanks help. the alert view puts new window on top of entire screen intercepts touches. it's expressly designed prevent doing you're trying do. why trying abuse alerts in manner anyway? it's bad idea take existing ui , use them in non-standard ways, possible reason rejected. your best bet draw "alert view" yourself, either in code or pre-baked image. unfortunately means cannot leverage built-in code draws uialertview, it's best don&#

Handle specific exception type in python -

i have code handles exception, , want specific if it's specific exception, , in debug mode. example: try: stuff() except exception e: if _debug , e keyboardinterrupt: sys.exit() logging.exception("normal handling") as such, don't want add a: except keyboardinterrupt: sys.exit() because i'm trying keep difference in debug code minimal well, really, should keep handler keyboardinterrupt separated. why want handle keyboard interrupts in debug mode, swallow them otherwise? that said, can use isinstance check type of object: try: stuff() except exception e: if _debug , isinstance(e, keyboardinterrupt): sys.exit() logger.exception("normal handling")

input - Read a string and parse an integer in Assembly -

i relatively new assembly. read string command line, store in variable , convert integer. ideas? tutorial using used assembly code didn't want use in of assembly applications doing. running linux ubuntu x86 processor. "read" syscall. can set registers (linux) or stack (freebsd) , use syscall raising interrupt or use nasmx 's macros (in cross-platform way!). stdin, stdout, , stderr file descriptors 0, 1 , 2 respectively. or, use scanf in same way (which of course provided in standard c library , call read you). it's easier unless want write own integer parser no reason!

bash - Killing a process in a script -

i'm running weird behavior app i'm using. if start command in background in bash, can kill using $ command & $ kill -n 2 [pid of command] killing command gracefully however, when throw script: command & id=$! kill -n 2 $id it doesn't @ all. there subtly i'm missing? edit: clue once script stops running, can't kill command using kill -n 2. man 7 signal sending signal 2, int, process, interrupt keyboard, why ? people saying send signal 1, why ? the standard gracefully way kill process signal 15, termination sigal, default used kill. so use kill "$pid" then, in case process run subprocess, don't want kill father, want kill them all, use "-$pid" instead of "$pid" kill whole process group, kill think that's -"$pid" signal number, complain, you'll have more precise, : kill -15 -"$pid" if program don't want die, use kill -9 -"$pid" man 7 signal man kil

javascript - Save or destroy data/DOM elements? Which takes more resources? -

i've been getting more , more high-level application development javascript/jquery. i've been trying learn more javascript language , dive of more advanced features. reading article on memory leaks when read section of article. javascript garbage collected language, meaning memory allocated objects upon creation , reclaimed browser when there no more references them. while there nothing wrong javascript's garbage collection mechanism, @ odds way browsers handle allocation , recovery of memory dom objects. this got me thinking of coding habits. time have been very focused on minimizing number of requests send server, feel practice. i'm wondering if don't go far. unaware of any kind of efficiency issues/bottlenecks come javascript language. example i built impound management application towing company. used jquery ui dialog widget , populated datagrid specific ticket data. now, sounds simple @ surface... lot of data being passed around here.

When using jQuery.attr() to set an attribute the browser doesn't update the style from the css -

i have site hat lists set of files can downloaded. custom attribute doctype set based on file extension. if there no extension doctype set "unknowndoc". css file looks similar this: .titlecolumn[doctype="pdf"] { background: url("/images/common/icons/pdf.png") no-repeat left center; } .titlecolumn[doctype="doc"], titlecolumn[doctype="docx"] { background: url("/images/common/icons/word.png") no-repeat left center; } .titlecolumn[doctype="unknowndoc"] { background: url("/images/common/icons/unknowndoc.png") no-repeat left center; } it's quite possible user upload document don't have css style set yet. in case item have doctype no background-image. in these cases want unknowndoc style applied. use following: $('.titlecolumn').each(function (index) { var hasnodocimage = $(this).css("background-image") == "none"; var doctype = $(this).attr(

java - Having a maven project build its own dependencies? -

with maven possible have top-level project who's packaging type "war" build , of dependent modules (packaged jar) , have build generate project.war file? much of documentation examples , other examples i've seen use top-level project packaging type of "pom" , project serves purpose of tying modules together. can avoid this? so need declaring <module>my-module</module> maven build, , in same pom, declaring <dependency>...my-module's artifact...</dependency> on same module needs built. maybe plugin suggested? update : in other words (to simplify problem): if have project a , project b , project a depends on project b - there way me execute build on project a , have automatically build project b (and include project b dependency - creating projecta.war contains projectb.jar)? that's not top-level project for. war project has dependencies, artifacts (e.g. jars) included in war (in web-inf/lib) when ru

java - How do I register the Jackson provider with the Wink client? -

i'm trying set toy application (which may turn in real application someday). i'm running problem wink , jackson. i've got 2 applications: 1 runs wink-server on jetty , seems providing json data fine; 1 runs wink-client on jetty , receives json data fine. problem lies in automagically deserializing json data java bean. here's code use in wink client action: restclient client = new restclient(); resource resource = client.resource("http://localhost:8081/helloworld"); user user = resource.accept(mediatype.application_json).get(user.class); here's error receive when try run struts action: java.lang.runtimeexception: no javax.ws.rs.ext.messagebodyreader found type class my.package.structure.user , media type application/json. verify entity providers correctly registered. org.apache.wink.client.internal.handlers.clientresponseimpl.readentity(clientresponseimpl.java:123) org.apache.wink.client.internal.handlers.clientresponseimpl.getentity(clientrespo

Python - how to get class instance reference from an attribute class? -

class a() att = b() class b() ... = a() b = b() a.att = b how can b reference of ? need attribute of here. thanks! you can make generic "reference()" class, keep reference of in attributes dictionnary. class reference(object): def __init__(self): self.references = {} def __setattr__(self, key, value): if hasattr(self, 'references'): if isinstance(value, reference): if not key in value.references: value.references[key] = [] value.references[key].append(self) elif value none , hasattr(self, key): old = getattr(self, key).references if key in old , self in old[key]: old[key].remove(self) super(reference, self).__setattr__(key, value) and then, create classes : class a(reference): def __init__(self): super(a, self).__init__() self.att = none cla

objective c - UINavigationController: setting the title of the next UINavigationItem -

i having following issue: i have uinavigationcontroller uinavigationbar changes title switch 1 view next. example, first view called root , next view called login. first time (and first time only) call [navigationcontroller pushviewcontroller:loginviewcontroller animated:yes], login view comes in , "login" title appears on nav bar after view has appeared. because set title in function called didshowviewcontroller. need call same function willshowviewcontroller. problem uinavigationitem new view controller has not been created yet cannot set title... how around issue? thanks, franck- you should setting title of navigation item in view controller's viewdidload or loadview method, rather uinavigationcontroller delegate methods. setting title property of view controller after creating should trick, however.