Posts

Showing posts from June, 2011

url rewriting - Apache Mod rewrite help -

url rewriting - Apache Mod rewrite help - i've been working on solution several hours & figured if doesn't mind helping me out, might save me time. question regards apache mod_rewrite; of course of study there tons of documentation out there, nil specific requirements are: to take url in format: language/pagename.php (language either 'english' or 'french', write separate rule each. [only need illustration 1 though]. page name word character (w+) . urls have .php extension). and rewrite url doesn't alter in users browser, php receive in format: language/page.php?slug=pagename e.g. $_get['slug'] homecoming value pagename , , requests handled page.php. so far best guess is rewriteengine on rewritebase / rewriterule ^english/(\w+).php$ english/page.php?slug=$1 however create php tell me slug=page url illustration english/financial.php ; rather financial . have tried bunch of other regex conventions (.) inst...

stl - getting a C++ std::set's members by index -

stl - getting a C++ std::set's members by index - is there way utilize 1 of stl algorithms define in fellow member of set using index position in set? i utilize utility method 1 below, i've got think exists in generic form in stl: elementptr elementat(int elementnumber) { list<elementptr>::iterator elementit = elements.begin(); (int counter = 0; counter < elementnumber && elementit != elements.end(); counter++, elementit++) { } homecoming *elementit; } #include <iterator> list<elementptr>::iterator elementit = elements.begin(); std::advance(elementit, elementnumber); x = *elementit; which code does. but fact want indicates you're info structures wrong. sets not designed processed this. c++ stl

excel - access database is not updating from vb.net -

excel - access database is not updating from vb.net - i have access database named login.mdb,which has many tables.i want update table named "try".in tat table have 2 fields viz name , rollnumber.i want update rollnum of corresponding name.my code is: public class form11 inherits system.windows.forms.form dim myconnection1 system.data.oledb.oledbconnection dim mycommand1 new system.data.oledb.oledbcommand dim sql string ''# .... private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click seek myconnection1.connectionstring = "provider=microsoft.jet.oledb.4.0;data source = c:\documents , settings\1001\desktop\subhedar sir\windowsapplication1\bin\login.mdb" myconnection1.open() mycommand1.connection = myconnection1 mycommand1.commandtext = "update seek set rollnumber = '" & textbox1.text & "' n...

opengl - C - invalid use of non-lvalue array -

opengl - C - invalid use of non-lvalue array - i have matrix struct: typedef struct matrix { float m[16]; } matrix; when seek phone call function: memcpy(m->m, multiplymatrices(m, &translation).m, sizeof(m->m)); i error @ compile time saying: error: invalid utilize of non-lvalue array multiplymatrices returns matrix. i error if utilize gcc compile file object, if utilize g++ compile object no error. i not sure error means, have feeling has array stored in matrix returned multiplymatrices. if need see more code allow me know. this code tutorial: opengl book chapter 4 p.s. maintain code strict iso/ansi, if there no other solution however, i'll have deal it. edit: ended going creating temporary matrix copying array. matrix tempmatrix; ... tempmatrix = multiplymatrices(m, &translation); memcpy(m->m, tempmatrix.m, sizeof(m->m)); the homecoming value of multiplymatrices() not lvalue (like homecoming value...

selenium - xpath locator not work as expected to locate a "<a" element with compound class name -

selenium - xpath locator not work as expected to locate a "<a" element with compound class name - this line not work think have used right xpath? driver.findelement(by.xpath("//a[contains(@class,'cke_button_bold')]")).click(); to locate button below : <a id="cke_73" class="cke_off cke_button_bold"> id dynamic number can used fixed locator here. , class compound class not supported webdriver findelement method... i created simple html file , xpath works firefoxdriver in webdriver 2.1.0. can seek use driver.findelement(by.classname("cke_button_bold")) classname supported webdriver api xpath selenium webdriver

interface builder - Remove ibplugin from xib -

interface builder - Remove ibplugin from xib - how remove traces of ibplugins .xib files? xcode3 project had around 10 custom ibplugins used lots of places through out around 20 .xib files. have reworked code no longer rely on ibplugins nor bindings can compile in xcode4. however xcode4 still complains there traces of original ibplugins in .xib files. /* com.apple.ibtool.warnings */ /users/johndoe/myproject/english.lproj/mainwindow.xib: warning: ibtool encountered error while loading interface builder plug-in /users/johndoe/myproject/core/build/debug/core.ibplugin. underlying errors: description: can't load plugin, there no bundle @ /users/johndoe/myproject/core/build/debug/core.ibplugin. i have removed ibplugins interace builder's preferences , re-saved .xib files. have removed target build .ibplugin. have removed source files utilize .ibplugin. have clean builded. xcode4 installed on different machine xcode3 machine, there no way there can remains o...

ruby on rails - How can I add a related record whilst on its parents edit page? -

ruby on rails - How can I add a related record whilst on its parents edit page? - i have table of venues , offers. each venue can have have many offers. i able add together offers venues venues edit page. far have (code below) giving "nomethoderror in venues#edit, undefined method `model_name' nilclass:class" error. venues edit page (the div id="tabs-3" container in accordion) <div id="tabs-3"> <%= form_for [@venue, @offer] |f| %> <h2 class="venue_show_orange">offers</h2> <%= f.fields_for :offers |offer| %> <div class="add_offer"> <%= offer.text_field :title %><br> </div> <div class="button"><%= submit_tag %></div> <% end %> <% end %> </div> offers controller class offerscontroller < applicationcontroller def new ...

iphone - trying to add UILabel to some UIView organized by 2 columns -

iphone - trying to add UILabel to some UIView organized by 2 columns - i'm adding n uilable n uiview organized 2 columns first uilabel shows up. here code: for(int i=0; i<ienen; i++){ uiview *ienasx = [[uiview alloc] init]; uiview *ienadx = [[uiview alloc] init]; ienasx.frame = cgrectmake(0.0, i*95.0, 160.0, 95.0); if(i%2==0) ienasx.backgroundcolor = [uicolor redcolor]; else ienasx.backgroundcolor = [uicolor greencolor]; uilabel *ienasxlabel = [[uilabel alloc] init]; ienasxlabel.frame = cgrectmake(0.0, (i*95.0)+80.0, 160.0, 15.0); ienasxlabel.text = [nsstring stringwithformat:@"iena n°: %i", i]; [ienasx addsubview:ienasxlabel]; [scrollview addsubview:ienasx]; ienadx.frame = cgrectmake(160.0, i*95.0, 160.0, 95.0); if(i%2==0) ienadx.backgroundcolor = [uicolor greencolor]; else ienadx.backgroundcolor = [uicolor redcolor]; uilabel *ienadxlabel = [[uilabel alloc...

ruby on rails 3 - How to do lookup table for roles -

ruby on rails 3 - How to do lookup table for roles - i have table lists authors; column :name, :string, column :role_id, :integer i have table roles column :role_name, :string models: author belongs_to :role role has_many :authors this seems strange. right author has 1 role , role belongs many authors? now if have author can following; @author.name , name. how role_name @author.role.role_name? thank in advance your associations right - @ this explanation. also, answered own question, getting role name author can done @author.role.role_name another alternative add together next line author model delegate :role_name, :to => :role and able role name with @author.role_name ruby-on-rails-3

iphone - Unrecognized selector sent to instance when calling category method -

iphone - Unrecognized selector sent to instance when calling category method - i have static library made encryption xml serialization utilize in projects. code worked until now. when included in latest project got error, know error appears when object phone call not allocated witch not case here nslog returns nsdata encryption. what problem? the error is -[nsconcretedata base64encodingwithlinelength:]: unrecognized selector sent instance 0x1c9150 * terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[nsconcretedata base64encodingwithlinelength:]: unrecognized selector sent instance 0x1c9150' here code: nsdata * encryptedmsg =[crypto encrypt:msgenc key:[accessdata->certificate datausingencoding:nsutf8stringencoding] padding:&padding]; nslog(@"encryptedmsg %@",encryptedmsg); nsstring * msg = [nsstring stringwithformat:@"%@", [encryptedmsg base64encodingwithlineleng...

php - How to set a node of an XML file? -

php - How to set a node of an XML file? - i've created xml document. so, now, want find node , set values of node, after research topic, don't know how it. this document : <?xml version="1.0" encoding="utf-8"?> <scripts> <script nom="mytools.class.php"> <titre>useful php classes</titre> <date>18/07/2011</date> <options> <option name="topic">tutorials</option> <option name="desc">tutorial you</option> </options> </script> <script nom="index.php"> <titre>blabla</titre> <date>15/07/2011</date> <options> <option name="topic">the homepage</option> </options> </script> </scripts > so, build html form theses values, @ moment, can't , set want :( i want first "script" node : ...

In Python, is it possible to write a generators (context_diff) output to a text file? -

In Python, is it possible to write a generators (context_diff) output to a text file? - the difflib.context_diff method returns generator, showing different lines of 2 compared strings. how can write result (the comparison), text file? in illustration code, want line 4 end in text file. >>> s1 = ['bacon\n', 'eggs\n', 'ham\n', 'guido\n'] >>> s2 = ['python\n', 'eggy\n', 'hamster\n', 'guido\n'] >>> line in context_diff(s1, s2, fromfile='before.py', tofile='after.py'): ... sys.stdout.write(line) # doctest: +normalize_whitespace *** before.py --- after.py *************** *** 1,4 **** ! bacon ! eggs ! ham guido --- 1,4 ---- ! python ! eggy ! hamster guido thanks in advance! with open(..., "w") output: diff = context_diff(...) output.writelines(diff) see documentation file.writelines() . explanation: with context manager: handles ...

shell - Using sed to find a folder directory in a file and replacing with another directory -

shell - Using sed to find a folder directory in a file and replacing with another directory - so trying utilize simple sed command in shell find , replace string in bash file alias. the alias like: alias configure='cd /opt/test/conf/server' i want replace /opt/test/conf/server /opt/test/conf having difficulties syntax. thanks help. cat my_bash_file.sh | sed 's#/opt/test/conf/server#/opt/test/conf#g' shell sed

html - Put text in textbox -

html - Put text in textbox - is there way set text in textbox allow user type something. write "username:" within box , allow user type after colon. can hard way creating div right next textbox , create 1 container, wondering if there easier way? thanks edit: don't want text disappear. want user able go on typing edit 2: reason cant set value in textbox because form. when user types username next value submit together you this: <div> <label>username:</label> <input type="text" /> </div> css div{border:1px solid gray;} label{font-family:arial; font-size:.8em;} input{border:none;} input:focus{outline:none;} basically, created containing div , placed label , input in div . label words remain in field. input has border removed. http://jsfiddle.net/jasongennaro/rzmfx/ fyi... may need increment size of input , depending on how many characters want accept. html css textbox ...

asp.net mvc 3 - Main MVC3 web app interferes with child MVC3 web app -

asp.net mvc 3 - Main MVC3 web app interferes with child MVC3 web app - just background info here. using shared hosting winhost, , have next setup shared iis |______main primary mvc3 web app (uses nhibernate & castle.windsor orm) |_______ kid mvc3 web app (not using nhibernate nor castle.windsor not need database access) at winhost, allows me set application starting point, can have / <= primary app /child <= kid app each app has own web.config, like /web.config /child/web.config well, surprise, seems though /child folder set application starting point, doesn't appear isolated parent primary web app, because when seek load kid app, infamous error could not load file or assembly 'castle.windsor' or 1 of dependencies. scheme cannot find file specified. i tried workaround dumping nhibernate related library /child/bin folder, makes matter worse, because need setup additional nhibernate configuration within kid...

ASP.NET webform error with JQuery Mobile -

ASP.NET webform error with JQuery Mobile - here effort using jquery mobile asp.net webform. below code have used in default.aspx page. it's simple code below finish code of aspx page. <%@ page language="c#" autoeventwireup="true" codefile="default.aspx.cs" inherits="_default" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title> login</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script> <script t...

c# - Unit test a function -

c# - Unit test a function - i got intersting question while writing unit test. can test function while using function in test code? for example, if have list<int> class has function called add() . i want test target list object 2 int inside: 1 , 2. add together 3rd number: 3, , want assert number added. wrote: public void testmethod() { //initialize list<int> list = new list<int>(); list.add(1); list.add(2); //do operation list.add(3); assert.istrue(list.contains(3)); } however, above test case, trying test target function: add(), uses add() initialize. thinking corelationship may result in problem under conditions, speaking... is there test thoery saying cannot this? thanks! functions may require more 1 test. in case, have function tested single add() , , 1 have above. long both pass, can (reasonably) confident results solid. if first test fails, though, result of sec test should ignored. ideally...

java - Spring @Async Not Working -

java - Spring @Async Not Working - an @async method in @service -annotated class not beingness called asynchronously - it's blocking thread. i've got <task: annotation-driven /> in config, , phone call method coming outside of class proxy should beingness hit. when step through code, proxy indeed hit, doesn't seem go anywhere near classes related running in task executor. i've set breakpoints in asyncexecutioninterceptor , never hit. i've debugged asyncannotationbeanpostprocessor , can see advice getting applied. the service defined interface (with method annotated @async there measure) implementation's method annotated @async too. neither marked @transactional . any ideas may have gone wrong? -=update=- curiously, works only when have task xml elements in app-servlet.xml file, , not in app-services.xml file, , if component scanning on services there too. have 1 xml file controllers in (and restrict component-scan accordingly), ...

objective c - iOS Objec-C error for object pointer being freed was not allocated -

objective c - iOS Objec-C error for object pointer being freed was not allocated - i'm getting next error in xcode. error object 0x4e18d00: pointer beingness freed not allocated ** set breakpoint in malloc_error_break debug i've setup nszombieenabled in target can view call. is -[___nsarrayi release] it looks i've released array somewhere else in code , auto release pool trying release when dealloc'd. how can find out where? idea? fyi, i'm creating arrays using arraywithcapacity method or similar, never utilize alloc or init methods. don't see, anywhere releasing same arrays. (maybe i'm blind!!) also, command flow follows: click uibutton , fire function attached onclick. go various logic layers , nsarray back. can iterate array in "onclick button function" , print contents. when "onclick button function" quits above error in "main" method. another note in 1 function create nsmutablearray want homeco...

excel - Dynamically expanding field headings in crystal reports -

excel - Dynamically expanding field headings in crystal reports - i have study have 50+ fields , exporting study crystal excel. 1 time in excel info columns proper width headings truncated. there way headings dynamically expand info does? have tried using grid line tools line columns , headers? ensure snap grid on , headers/fields same size on screen. basically want crystal study in designer similar excel report; headers , fields in grid structure. crystal produced document many moons ago when owned seagate describing how avoid formatting problems when exporting excel. check out here this helped me load when had build stock reports , summaries 1 of customers. excel crystal-reports

web scraping - Node.js scraiping using Node.io -

web scraping - Node.js scraiping using Node.io - i trying node.js titles of page: https://www.odesk.com/jobs/braintree i seek this: var nodeio = require('node.io'); var methods = { input: false, run: function() { this.gethtml('https://www.odesk.com/jobs/braintree/', function(err, $) { //handle request / parsing errors if (err) this.exit(err); var titles = [], scores = [], output = []; //select titles on page $('.content').each(function(a) { titles.push(a.text); }); this.emit(output); }); } } exports.job = new nodeio.job({timeout:10}, methods); but i'm getting nil result. wrong? thanks you aren't accurately traversing markup. , utilize of each incorrect. seek this: $('a', '.content h3').each(function(index, a) {console.log($(a).text())}); node.js web-scraping

cocoa touch - What's the convention on placing curly braces in Objective-C? -

cocoa touch - What's the convention on placing curly braces in Objective-C? - i have seen different conventions objective-c (cocoa/cocoa touch) of placing curly braces. the 2 have seen are: - (void)dealloc { [super dealloc]; } vs. - (void) dealloc { [super dealloc]; } this confuses me because expect such rather little community there should 1 convention. which 1 of 2 more common? i don't think there's canonical reply (whether speaking in terms of objective-c or other language). prefer: - (void)dealloc { [super dealloc]; } ...but there lot of people prefer alternate style, well. more common, example code provided apple appears prefer first style (brace on same line), safe bet more mutual pattern. recall stumbling across older apple coding conventions document recommended sec style (brace on next line), (but recommended using 2 spaces instead of 4 indents, makes document garbage in opinion). might pick preference. the thin...

iphone - Parsing substrings using NSRange. Seeking a more elegant solution -

iphone - Parsing substrings using NSRange. Seeking a more elegant solution - i parsed xml rss feed using touchxml library. looks far. in description tag extract out 'img src' url thumbnail image. in past utilize nsrange match; match = [self.tweettext rangeofstring: @"http://"]; then find end of string getting range of '\' , parsing out substring. but thinking maybe not typical/optimal way handle kind of thing. here nsdictionary printed out via nslog: blog item: { category = "premier league"; description = "\n\n\t\t\t <img src=\"http://www.independent.co.uk/multimedia/dynamic/00620/charlieadam_620843k.jpg\" style=\"padding-right:5px;margin-right:5px\" align=\"left\" /> \n\t\t\t\t<p>\nliverpool manager kenny dalglish confident new signing charlie adam can \n have same impact @ club did @ blackpool.\n</p> "; guid = "http://www.independent.co.uk/sport/football/premier-...

Programming way to list shared library dependency on linux -

Programming way to list shared library dependency on linux - it's there programming way (system call?) list shared library dependency on linux? instead of using ldd ... thanks in advance! readelf -wa lib.so|grep needed linux shared-libraries

c# - WebClient client ip address -

c# - WebClient client ip address - i have generic handler (ashx) homecoming file file system. handler not behind login. however, need homecoming file if request has been made within .net application via webclient object. user type ashx url in box , click upload button transfer file securely. in ashx file how determine if request coming "http://myapp.com/upload.aspx"? give thanks you, virgil in ashx file how determine if request coming "http://myapp.com/upload.aspx"? you absolutely can't if handler doesn't require authentication. same way can write webclient consume handler, could. , handler has strictly no way of knowing request comes (other ip address). unless create ashx handler require authentication chance restrict caller ip address. in handler check whether request.userhostaddress corresponds ip address of myapp.com . c# .net asp.net webclient ashx

android - Facebook Application request -

android - Facebook Application request - i want give application request list of user android application. the main thing "the app request must not go wall , must go user's inbox or app request list" is there way using graph api or facebook api. you need embed facebook requests dialog web view. there isn't graph api method sending app invites. android facebook facebook-graph-api

php - Best approach to create a tag cloud from input text -

php - Best approach to create a tag cloud from input text - i wondering best approach generate tag cloud input text (while user typing it). example, if user types story's text containing keywords "sci-fi, technology, effects", tag cloud formed each of keywords ordered relevance according frequency on every story. tag cloud displayed in descending order , using same font size, it's not display algorithm, search algorithm should implement. i'm using mysql , php. should stick match...against clause? should implement tags table? more details have mysql table containing lot of stories. when user typing 1 of his/her own, want display tag cloud containing frequent words, taken input text, occurring on set of stories saved on db. tag cloud used show user relevance of words he/she has entered on his/her own story according frequency occur on stories entered users. i think first thing need more define purpose of tagging system. want build tags based on word...

javascript - validation only for type word english or persian or number? -

javascript - validation only for type word english or persian or number? - how validation type word english language or western farsi or number, each separate in input? not want utilize of plugin. only type english language -> hello type western farsi -> سلام type number -> 123123 1. english only var only_english = 'abcdabdkdk', mixed = 'سلامaasdsd'; if (/[^a-za-z]/g.test(only_english)) { alert('"only_english" contains characters other english'); } else { alert('"only_english" contains english language characters'); } if (/[^a-za-z]/g.test(mixed)) { alert('"mixed" contains characters other english'); } else { alert('"mixed" contains english language characters'); } 2. persian only var only_persian = 'سلام', mixed = 'سلامaasdsd'; if (/[^\u0600-\u06ff]/g.test(only_persian)) { alert('"only_persian" ontai...

javascript - Replacing Switch-Case with something better? -

javascript - Replacing Switch-Case with something better? - i working on web chat application. code see above used process info responses received in json format. how works ajax long-poll request sent server, pulls messages need sent user. outputs in json format, parsed js, , minte.processor.process(json) called handle rest. i replace switch statement else. can see there quite few commands (and i'm estimating @ to the lowest degree 50 more) need more elegant solution. thinking of creating object holds array of key-value pairs key command name , value data, don't know if less efficient switch. you create handler object knows how handle each command , has method each one. like: var myhandler = { addchatnotice: function(content) { minte.ui.addchatnotice(content); }, changeusername: function(content) { minte.client.username = content; } //etc... }; minte.processor.process = function(json) { (var x in json) { v...

iphone - Find out memory leak? -

iphone - Find out memory leak? - i new on iphone apps.now first app,app installed not run? write code shows memory leak.please find out.thanks in advance. abrecordref ref = cfarraygetvalueatindex(all, i); cfstringref *firstname = (cfstringref *)abrecordcopyvalue(ref, kabpersonfirstnameproperty); nslog(@"name %@", firstname); contact.strfirstname = (nsstring*)firstname; cfstringref *lastname = (cfstringref *)abrecordcopyvalue(ref, kabpersonlastnameproperty); nslog(@"name %@", lastname); contact.strlastname = (nsstring*)lastname; contact.contactname = [nsstring stringwithformat:@"%@ %@",(nsstring *)firstname,lastname]; nslog(@"name %@", contact.contactname); abmutablemultivalueref phonenumbers = abrecordcopyvalue(ref, kabpersonphoneproperty); for(cfindex j = 0; j < abmultivaluegetcount(phonenumbers); j++) { cfstringref phonenumberref = abmultivaluecopyvalueatindex(phonenumbers, j); nsstring *phonenumber = (nsstring *) phonenu...

java - Android capturing volume up/down key presses in broadcast receiver? -

java - Android capturing volume up/down key presses in broadcast receiver? - i'm trying create application user can override default behaviour of volume up/down buttons (as screen on/off button - possible?). anyways, using code along lines of next can this: @override public boolean onkeydown(int keycode, keyevent event) { super.onkeyup(keycode, event); if ((keycode == keyevent.keycode_volume_up)) { //this can stuff homecoming true; //because handled event } homecoming false; //otherwise scheme can handle } but possible when application not open, hence why i'd set broadcast receiver or maybe stick in service create possible. thanks help. as screen on/off button - possible? fortunately, no. but possible when application not open, hence why i'd set broadcast receiver or maybe stick in service create possible. this not possible volume buttons. for example, andross allows override photographic camera hardware butto...

c# - Problem with login control -

c# - Problem with login control - <asp:login id="login1" runat="server" failuretext="חיבורך לא הייה מוצלח. אנא נסה שנית" loginbuttontext="התחבר" passwordlabeltext="סיסמה:" passwordrequirederrormessage="יש צורך בסיסמה" remembermetext="זכור אותי פעם הבאה" titletext="" usernamelabeltext="שם משתמש:" usernamerequirederrormessage="יש צורך בשם משתמש" height="100px" destinationpageurl="~/allquestions.aspx" passwordrecoverytext="שכחת סיסמה" passwordrecoveryurl="~/retrievepassword.aspx" remembermeset="true" onauthenticate="login1_authenticate"> <checkboxstyle height="50px" /> <validatortextstyle bordercolor="#cc0000" /> </asp:login> the command works without part: onauthenticate="login1_authenticate" p...

svn - Removing needs-lock attribute when tagging -

svn - Removing needs-lock attribute when tagging - i wonder if there smart way remove needs-lock attribute when branching/tagging subversion directory. it comes useful because while in trunk need serialize access shared files, when making modifications branch integrating trunk modifications, developer assigned task. is there smart way either ignore svn:needs-lock property during tagging (probably not) or perchance remove @ 1 time svn:needs-lock attribute recursively in directory? thank you svn

php - Rename file before sending to user? -

php - Rename file before sending to user? - this simple , stupid question ask, have no thought how go doing this. i building file hosting functionality client site in php. have central repository of files in 1 directory. because client wants maintain 1 re-create of each file (based on "hash" of file) if multiple people upload same file. files renamed before dumping them directory (datetime + code) avoid filename clashes. original name(s) of file held on database. where problem is, have no thought how go renaming file original filename when user requests download it? create temporary re-create of in directory, think going messy. hoping there improve way. have seen post response.appendheader("content-disposition", "attachment; filename='myfile.jpg'"); but in asp. point me in right direction? many thanks ted in php similar: see header function from illustration on page: <?php // we'll outputting pdf header(...

exception - c# binding failure was detected 'Microsoft.Practices.EnterpriseLibrary.Validation' -

exception - c# binding failure was detected 'Microsoft.Practices.EnterpriseLibrary.Validation' - the building of project working on friend's computer not on mine. on homecoming line: protected static database connection2 { { seek { homecoming databasefactory.createdatabase("hermesdb"); } grab (exception e) { //corpnet.elmah.error.add(e); homecoming null; } } } i getting next error: the assembly display name 'microsoft.practices.enterpriselibrary.validation' failed load in 'load' binding context of appdomain id 1. cause of failure was: system.io.filenotfoundexception: not load file or assembly 'microsoft.practices.enterpriselibrary.validation' or 1 of dependencies. scheme cannot find file specified. fil...

ruby - resque-status argument error -

ruby - resque-status argument error - i have basic sinatra app test resque-status require 'sinatra/base' require 'resque' require 'resque/job_with_status' class sleepjob < resque::jobwithstatus def perform total = options['length'].to_i || 1000 num = 0 while num < total at(num, total, "at #{num} of #{total}") sleep(1) num += 1 end completed end end class app < sinatra::base '/' info = resque.info out = "<html><head><title>resque demo</title></head><body>" out << "<p>" out << "there #{info[:pending]} pending , " out << "#{info[:processed]} processed jobs across #{info[:queues]} queues." out << "</p>" out << "<form action='/sleep' method='post''>" out << '...

c++ - Unit Testing: coding to interfaces? -

c++ - Unit Testing: coding to interfaces? - currently project composed of various concrete classes. i'm getting unit testing looks i'm supposed create interface each , every class (effectively doubling number of classes in project)? happen using google mock mocking framework. see google mock cookbook on interfaces. while before might have classes car , engine , have abstract classes (aka c++ interfaces) car , engine , implementation classes carimplementation , engineimpl or whatever. allow me stub out car 's dependency on engine . there 2 lines of thought have come across in researching this: only utilize interfaces when may have need more 1 implementation of given abstraction and/or utilize in public apis, otherwise don't create interfaces unnecessarily. unit tests stubs/mocks are "other implementation", , so, yes, should create intefaces. when unit testing, should create interface each class in project? (i'm leaning towards creat...

c# - HTML tag not appearing on page -

c# - HTML <A> tag not appearing on page - i have dataset 2 datatable. want show fields of datatables in labels. i using stored procedure. code here------ private void getinfocompany() { int companyid; if (int.tryparse(hidcompanyid.value, out companyid)) { var ds = companydata.getcompanyinfo(companyid); if (ds != null && ds.tables[0].rows.count > 0) { var dtcontact = ds.tables[0]; var dtprofile = ds.tables[1]; } if (dtcontact != null && dtcontact.rows.count > 0) { lblcontactname.text = dtcontact.rows[0]["name"].tostring(); lblemailid.text = dtcontact.rows[0]["email"].tostring(); lblphoneno.text = dtcontact.rows[0]["contactnumber"].tostring(); lblstate.text = dtco...

php - Authenticate system without sessions - Only cookies - Is this reasonably secure? -

php - Authenticate system without sessions - Only cookies - Is this reasonably secure? - i'm interested in advice/opinion on security problem. i thinking on doing this: get hash mac (sha256) string built userid + expirationtime , secret key string built secret string , $_server['http_user_agent']. get hash mac (sha256) userid + expirationtime , secret key made hash (from step 1). build string userid|expiration| , made hash (from step 2). encrypt given string (from step 3) 'rijndael-256' algo. (mcrypt family of functions). encode base64. set cookie given value. what think. ok? else implement $_server['http_user_agent'] check, create sure cookie isn't stolen (except ip address)? p.s. sensitive info cookie contain userid. edit: ok clear things. i'm trying create "safe" auth scheme doesn't rely on sessions. app in question build more or less pure restful api. step 2: problem: "fu’s protocol not provide repl...

sql server 2008 r2 - using merge statement in ssis package -

sql server 2008 r2 - using merge statement in ssis package - here situation. i have got table in database db1(sql server) , table b in database db2(sql azure) same table structure. need compare info in table , table b , add together missed records in table b , update table b. can help me on how in ssis bundle using merge statement? if know how write merge statment in t-sql, utilize execute sql statement execute it. sql-server-2008-r2 sql-azure ssis

c# - Filter data from an XML document -

c# - Filter data from an XML document - i have next xml file. <jamstatus> <ipaddress value="10.210.104.32 " facid="2"> <type>letter</type> <jobid>1</jobid> <fi>50-30c-kmc-360a</fi> <timestampprinting>1309464601:144592</timestampprinting> </ipaddress> <ipaddress value="10.210.104.32 " facid="2"> <type>letter</type> <jobid>2</jobid> <fi>50-30c-kmc-360a</fi> <timestampprinting>1309465072:547772</timestampprinting> </ipaddress> <ipaddress value="10.210.104.32 " facid="2"> <type>letter</type> <jobid>2</jobid> <fi>50-30c-kmc-360a</fi> <timestampprinting>1309465072:547772</timestampprinting> </ipaddress> </jamstatus> there may number of ipaddress elememt in document. jobid , timestamp can same perticular ipaddress. want count of i...

php - [function.openssl-public-encrypt]: key parameter is not a valid public key -

php - [function.openssl-public-encrypt]: key parameter is not a valid public key - long time listener/first time caller i have set test page follows <form action="" method="post"> <input type="text" name="value" width="20" max="30" value=""/> <input type="submit" value="go"/> </form> with php encrypt post info "value" , store in variable so $pubkey = openssl_pkey_get_public(".../public.pem"); openssl_public_encrypt($_post["value"], $var, $pubkey); echo $var; also have tried $publickey = ".../public.pem"; $plaintext = $_post['value']; openssl_public_encrypt($plaintext, $encrypted, $publickey); echo $encrypted; keep getting error warning: openssl_public_encrypt() [function.openssl-public-encrypt]: key parameter not valid public key i created keys openssl using: # generate 1024 bit rsa private...

ssl - how to do asp.net routing in secure pages? -

ssl - how to do asp.net routing in secure pages? - is possible asp.net routing in secure pages? not next mvc pattern need implement url rewriting in 1 of pages. can help me on this? yes. it's possible. setting url rewriting secure pages same non secure pages. asp.net ssl routing

performance - ASP.net - C# - How to make it run faster ajaxToolkit : ToolkitScriptManager -

performance - ASP.net - C# - How to make it run faster ajaxToolkit : ToolkitScriptManager - i using ajaxtoolkit website. want create run faster. asp.net netframework 4.0 - c# - microsoft visual studio 2010 the below config current config. waiting farther suggestions. <ajaxtoolkit:toolkitscriptmanager runat="server" id="sc1" scriptmode="release" loadscriptsbeforeui="false" enablepartialrendering="true" combinescripts="true" /> to optimize asp.net ajax in our web application, first of all, need create sure compression , caching enabled in web.config: <system.web.extensions> <scripting> <scriptresourcehandler enablecompression=“true” enablecaching=“true”/> </scripting> </system.web.extensions> if using asp.net 3.5 sp1, there more powerful tool combining script file – compositescript. reference : asp.net ajax performance asp.net performance optimizatio...

MongoDB & Java Driver: Range Query -

MongoDB & Java Driver: Range Query - i have database of documents contain numerical field x . attempting write query returns specified number of documents x fields closest given value y . e.g. list of x documents [1, 4, 9, 2, 5, 4, 6, 8, 9, 10, 23, 2] y 5, specified number of results homecoming 6 homecoming [4, 4, 5, 6, 8, 9] my initial thought of documents, sort result set x , , trim excess entries around y . i'm not sure how implement "trimming" functionality in mongo, however. how can go crafting query using java driver this? there nil mongodb help you. have implement such filtering on application level or perhaps utilize map-reduce standard client-side query api not help here (unlikely implement using sql). java mongodb

iphone - UITableView is loading the same cells of some reason -

iphone - UITableView is loading the same cells of some reason - i have tableview loading custom cell , loading info json string on server. json string parsed array of 14 ids (id_array). if cell==nil , i'm using [id_array objectatindex:indexpath.row] id , fetch more info row server, , set cell's labels , image. when running app, uitableview loading visible rows [0,1,2,3,4] (cell height 70px). when scrolling downwards tableview, row [5] loaded , fetching info server, problem beyond point - tableview repeating 6 rows instead of requesting new info server new rows... but request new info row [5], not visible (and not loaded) when app first runs. anyone have thought why happening? thanks! edit: here cellforrowatindexpath method - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"customcell"; customcell *cell = (customcell *)[tableview dequeue...

java - Is it safer to inject an EVENT scoped bean into a CONVERSATION/SESSION scoped bean? -

java - Is it safer to inject an EVENT scoped bean into a CONVERSATION/SESSION scoped bean? - is safe inject beans narrower scope wide scoped bean? does seam cdi take care of figure out current event/request/page context right injection session/conversation bean. my point is. don't want 1 page/even's objects getting mixed other page/event's data. i can utilize component.getinstance() within method create sure current event/page's beans anyway. utilize @in(scope = scopetype.event) this. session , page scoped components synchronized per default. therefore, should safe inject event-scoped component, such entitymanager , them. synchronized, 2 request won't interfere 2 different injected objects. to sure, don't run concurrency problems, recommend don't inject these components fetch them component repository: mycomponent mycomponent = (mycomponent) component.getinstance("mycomponent"); java java-ee dependency-injection sea...

mysql - Implementing association tables -

mysql - Implementing association tables - i wondering if help me organize mysql tables in way consider right (i read somewhere association tables i'm looking for). i'm having problem implementing them. here's example: location type event date location 1 bar, disco event1 fri location 1 bar, disco event2 saturday location 2 bar, restaurant event3 fri how go if wanted have 'location 1' in database once, , have events associated stored elsewhere? same applies type section. having problem deciding how should set multiple variables 1 location, such bar beingness restaurant, etc... the relationship between locations , events illustration of 1-to-many relationship. means each individual location can have many events associated it. these types of relationships implemented adding foreign key 'many...

javascript - jQuery Show/Hide on a group of radio box shows then hides the div really fast -

javascript - jQuery Show/Hide on a group of radio box shows then hides the div really fast - my code works beautfiully shows when need show , hides when need go away. thought here when using form person using can check box, see more required form info checked, makes fields required, , when user unchecks box goes away. the problem when user clicks radio box within grouping radio box not have right value show container container (ex false condition) jquery quick show box, hide again. there way within code maintain box hidden if it's not right condition, , if switch different box, it'll hide box user looking at? if how? here's code: var hiddenclassarray = [ "appliedworkedyes", "workstudyyes", "workhistoryyes", "workweekendsyes", "cpryes", "aedyes", ...

What language are the C and C++ standard libraries written in? -

What language are the C and C++ standard libraries written in? - c , c++ can't do anything, need libraries work. how libraries created? assembly language? c , c++ libraries universally written in c , c++, c , c++ compilers. in fact, many compilers used compile themselves! how possible? well, first c compiler couldn't have been developed in c. however, 1 time c compiler exists, can used compile compiler. , compiler beingness developed, source code. it's possible develop both side-by-side. since compilers improvements on predecessors, used compile improve versions of themselves! however, respect library, that's easy: c can something. while lower-level routines may written in assembler, vast bulk can written in c or c++. c++ c assembly standard-library

sdk - AmazonS3 GetPreSignedUrlRequest max Expires date -

sdk - AmazonS3 GetPreSignedUrlRequest max Expires date - i'm generating pre-signed urls amazons3 .net sdk. working fine have stopped working now. used set expires date near year 2038 because wanted create them permanent posible. used 2038 because date epoch date , there year 2038 problem (http://en.wikipedia.org/wiki/year_2038_problem). sdk doesn't limit on date seems when access url gives access denied next message: <message>invalid date (should seconds since epoch): 2147500800</message> does know if there limits expires date? it looks know reply this. a quick test reveals expiry dates after approximately 03:14 utc on tuesday, 19 jan 2038 indeed fail. you've run bug in wikipedia article linked to. sdk amazon-s3

jquery - jQeuer / AJAX - load whole external file into the 'ul' element -

jquery - jQeuer / AJAX - load whole external file into the 'ul' element - i working on project have massive multilevel menu - create in easier update in future (site static html) decide stack menu in separate file. my question is: how load whole content external file in ul element using jquery? e.g html be: <ul class="menu"> </ul> external file menu.html like: <li><a href="index.html">home</a></li> <li><a href="index.html">home</a></li> <li><a href="index.html">home</a></li> <li><a href="index.html">home</a></li> <li><a href="index.html">home</a></li> any help appreciated. $(".menu").load("menu.html"); take jquery's .load() documentation. jquery

antlr - Help with left factoring a grammar to remove left recursion -

antlr - Help with left factoring a grammar to remove left recursion - i have little custom scripting language, , trying update allow boolean expressions such a > 2 , a > 2 , (b < 3 or c > 5) . it's parenthetical expressions having problem here. here (edited since original post based on reply @bart kiers) total grammar exhibits problem. pared-down version of actual grammar, problem occurs here too. grammar test; options { language = 'javascript'; output = ast; } statement : value_assignment_statement eof ; value_assignment_statement : ident '=' look ; value_expression : value_list_expression | ident ; value_list_expression : value_enumerated_list ; value_enumerated_list : '{' unary+ '}' ; term : lparen look rparen | integer ...