Posts

Showing posts from March, 2012

browser - How are cookies handled by email clients? -

let's set cookie on image request in email (so cookie set when user views images in email). if user clicks through email browser opens, browser have access cookie set? obviously, if user has outlook email client , firefox default browser, email cookie (if exists) not accessible. if use ie? on iphone or android phone, happens? i think answered own question... it's client-side problem (for you). it's "catch catch can". no guarantees combination use 100% fool-proof. outlook safari (or ff, opera, etc). there many variables. not mention 1 of recipients have email client set plain text. i got best tracking assigning query parameter images links. i've never found solution accounted 100% of emails sent (comparing/tracking view rates afterward).

visual studio - C# project lost, anyways to recover it? -

after hard drive disaster, main partition had been formatted. result, c# project ( small management software) lost. however, have copied debug folder in usb ( testing in computer). so, there anyways me recover lost project or have start again? it's not easy. can use reflector recover source, resources , harder. have step-by-step on blog works (most?) windows forms projects. p.s. use source control. there's free svn hosts (and mercurial/git, too), commercial projects...

usb - Spoofing a game controller -

i'm trying write allow user use keyboard/mouse combination on games console. approach i've thought of following: figure out how input maps output in console's controller. old trial , error, connecting controller via usb computer , figuring out how controller responds input using detailed usb logging. then, write userland program takes keyboard/mouse input , converts controller's output. so far good. comes complicated bit. need figure out way connect computer console, while making console think being connected standard controller. this, need way create fake usb device, communicates on usb port console. part have no idea whatsoever how do. i guess i'm looking usb spoofing library of sort, i'm not sure start looking this. python bindings library great, i'm not fussy. similarly, works on mac or linux perfect, live windows-only library in pinch. usb doesn't work way. usb involves directed hierarchy of devices, , trying connect 2 host d

asp.net - call javascript after updatepanel postback -

i put following javascript code inline doesn't trigger after updatepanel done postback: function endrequesthandler(sender, args) { alert("this should work"); } sys.webforms.pagerequestmanager.getinstance().add_endrequest(endrequesthandler); any ideas? thanks. ok, nevermind, got it. if else runs problem, put sys.webforms..... line this: $(document).ready( function () { sys.webforms....; }

iphone - How to make my application support ads? -

i want place ads in application. can me? you have few options, admob or google ads. however, apple provides iad framework, makes easy add ads app. suggest looking @ iad framework reference . basic process follows: create iad banner. set banner's delegate. add ad view view. you need set iad in developer account, affects revenue, not programming , testing aspect of things.

Using "C" dll in C# -

possible duplicate: how call unmanaged c/c++ code c# asp.net webpage i have dll file written in "c" language, want use in c#. how can that? you can use pinvoke platform invocation services (pinvoke) allows managed code call unmanaged functions implemented in dll. here great tutorial nag (numerical algorithms group) group

Customizing the NUnit GUI for data-driven testing -

my test project consists of set of input data files fed piece of legacy third-party software. since input data files software difficult construct (not can done intentionally), not going add new input data files. each input data file subject set of "test functions". of test functions can invoked independently. other test functions represent stages of sequential operation - if earlier stage fails, subsequent stages not need executed. i have experimented nunit parametrized test case (testcaseattribute , testcasesourceattribute), passing in list of data files test cases. satisfied the ability select input data testing. however, see if possible customize gui's tree structure, "test functions" become children of "input data". example: file #1 checkfiletypetest getfiletoplevelstructuretest completeprocesstest stageonetest stagetwotest stagethreetest file #2 checkfiletypetest getfiletoplevelstructuretest completeprocesstest stageo

Need a php caching recommendation -

i need find right caching solution clients site. current site centoos, php, mysql, apache using smarty templates (i know suck built else). current models/methods use oo structure there way many queries being done of simple page functions. i'm looking try find sort of caching solution i'm noob when comes , don't know available fit current site setup. it auction type site 10 auctions displayed on 1 page @ 1 time -- time , current bid on each auction being updated via ajax call returning json every 1 second (it's penny auction site beezid.com updates every second necessary). can see, if site gets sort of traffic number of simultaneous requests huge. data changes every second because json data returned has updated time left in auction, , possibly updated bid amounts , bid users each auction. what want ability cache pages given amount of time or based on other changed variable. example, memory caching page displays 10 auctions , updating cache copy when 1 of

php - MySQL query WHERE statement which is a query itself? -

so i'll try explain goal first: first, want query 1 table in database list of usernames. second, want take usernames, , query table in database , return rows in these usernames appear in username field. finally, want take output (in json array form right now), , return requesting client. my query looks right now: $query = mysql_query("select * tagusers username = (select usera friendtable userb = '$username')"); this works when statement yields 1 result. if 1 returned usera, works fine. if multiple, bunch of errors. here code in entirety: if (isset($_post['username'])) { $username = $_post['username']; $connect = mysql_connect("localhost", "root", ""); mysql_select_db("tagdb"); $query = mysql_query("select * tagusers username = (select usera friendtable userb = '$username')"); } while ($e = mysql_fetch_assoc($query)) { $output[] = $e; } $output = j

asp.net - How to programatically check if an application is installed or not using JAVASCRIPT? -

i have aspx page within have javascript code. want check wheather particular application installed in system or not javascript code? can 1 kindly let me know how achieve in javascript. want check if particular version of flash player installed in system or not? (my java script on server side & should find if application installed in client machine or not) thanks in advance. well first of all, javascript not on serverside. called on client side. i recommend swfobject determine if flash installed or not. use , works pretty well.

joomla1.5 - Joomla - Conditional Load of Plugin based on Menu Item -

is possible load system plugin conditionally, based on menu items? e.g. pages in site conflicting mootools upgrade plugin, required kunena. want include plugin on kunena pages. thanks geoff there no native way of doing this. to keep things way , not have conflicts in future updates -create plug-in load last. it's job check jdocument , see script loaded , if remove there if page non kunena or vise versa... e.g. disable kunena plug-in, , in plug-in check if page kunena... if load plug-in programmatically.

ajax - Autocomplete jQuery on facebox -

i need use autocomplete (in particular try plugin http://scottreeddesign.com/project/jsuggest ) in text input in facebox. didn't work beacause in document ready there function: $(document).ready( function(){ /** suggest new quid **/ $('#idinput').jsuggest({ default_text: 'inserisci il quid', terms_url: 'data.php'+'%input%', limit: 10 }); $('#idlink').live('click', function(e) { jquery.facebox("<input type='text' id='idinput' />") }); }); but dom #idinput don't exist, show in facebox when click link. can me? suggestion? p.s. plugin jsuggest isn't required. first i've found. the solution bind jsuggest plugin right on click event: $(&#

visual studio 2010 - How to automatically regenerate DB partial project files? -

i using advanced version of visual studio 2010 , using database projects. there's feature of exporting database schema partial project (which creates *.files output file), triggered manually developer (you need right-click on project , select export partial project ). automatize process, meaning output file created each time modify database, build or close solution. i tried creating macro, executes dte command project.vsdbexportaspartialproject , fails exception , shows save as dialog box, avoid. maybe idea add post-build event, don't know how execute dte commands there. to sum up, need automatically refresh *.files output file located in fixed path without user interactions. is possible?

contains - Unwanted conversion of latin letters in sql functions -

i'm using ms-sql db , have field saved in db nvarchar type. use linq sql in following way: var names = namestable.where(n=>n.name.contains("acções")); this query returns names containing: acçoes/ accoes or other combination. seems sql doesn't recognize latin special letters different english ones. how can solve problem? in sqlserver can set "collation" per column. (i think) it's "accent sensitive", case appears "accent insensitive". see says collation, if ends on "ai", it's indeed accent insensitive. need "as" "accent sensitive". and further have "ci" (for "case insensitive") or "cs" (for "case sensitive").

.net - EF 4 Filter sub collection -

im trying maingroups related entities. , filter buildingpartdata collection without affecting of other entities. have pretty tried every thing can think of no luck. test.contextoptions.lazyloadingenabled = false; var buildingpartmaingroups = (from buildingpartmaingroup in test.buildingpartmaingroup buildingpartsubgroup in buildingpartmaingroup.buildingpartsubgroup buildingpart in buildingpartsubgroup.buildingpart buildingpartdata in buildingpart.buildingpartdata buildingpartdata.statuspendingapprove == true //let buildingpartdata = buildingpartmaingroup.buildingpartsubgroup.where(x => x.buildingpart.any(o => o.buildingpartdata.any(y => y.statuspendingapprove == true))) select new { bui

c# - Troubles with Insert / Update Methods of DataSet provider for DataGrid -

i've used wizard assert datagrid mssql table using dataset provider / binding dataset model got table select / insert / update methods looking don't appear or don't work. can add / update data datagrid no changes in mssql appears. so here code generated wizards designers : this.alarmview.datasource = this.alarmdictionarybindingsource; // // alarmdictionarybindingsource // this.alarmdictionarybindingsource.datamember = "alarmdictionary"; this.alarmdictionarybindingsource.datasource = this.friibdataset; // // friibdataset // this.friibdataset.datasetname = "friibdataset"; this.friibdataset.schemaserializationmode = system.data.schemaserializationmode.includeschema; // // datagridviewtextboxcolumn1 // this.datagridviewtextboxcolumn1.datapropertyname = "id"; this.datagridviewtextboxcolumn1.headertext = "id&

How I redirect with link in asp.net mvc? -

i used 1 link in asp.net mvc project way. <a href="<%= url.action("displayaction", "tempcontroller") %>" title="display" /> it works in calling controller.but,i want call normal aspx in way. for eg, <a href="<%= response.redirect "webform.aspx" %>" title="display" /> please give me right ways. regards indi if want navigate normal page standard way html, set href of anchor attribute: <a href="webform.aspx" title="display">link text</a>

Unable to run html suites in other browser except Firefox Using selenium RC -

i have problem in running test suites in other browser using selenium rc. have test suite exported selenium ide. intending run 5 tests in suite. suite runs , gives out correct results when *firefox specified browser. doesn't run tests in other browser. java -jar selenium-server.jar -htmlsuite "*firefox" "http://www.global.com" "c:/users/desktop/prp_rc/article.html" "c:/users/desktop/prp_rc/result.html" this how run suite in command prompt. when use *iexplore(i use ie8) throws exception saying, session id 489504 doesn't exist *iexploreproxy,*googlechrome , *safari open respective browsers , display test case names on browser. doesn't run anything. *piiexplore open browser , displays script error. when tried debug error, seen: webpage error details user agent: mozilla/4.0 (compatible; msie 7.0; windows nt 6.1; trident/4.0; iopus-web-automation; slcc2; .net clr 2.0.50727; .net clr 3.5.30729; .net clr 3.0.30729;

java - Getting around making constructor call the first statement in a constructor -

i java newbie, hence simple question: i have class constructor takes 1 argument follows: class mybase { public mybase(objecttype1 o1) {} ... } i want derive class class constructor takes string , calls constructor of base class proper argument chosen on basis of argument follows: class myderived extends mybase { public myderived(string objecttype) { objecttype o = null; if (objecttype.equals("type1") o = a; /* value */ else o = b; /* other value */ super(o); } the problem code constructor call must first statement in constructor. how solve problem? don't want make decision objecttype outside myderived . prefer avoid having provide static createobject method myderived . it sounds you're reinventing enums. class base { static enum option { alpha, beta, gamma; } public base(option o) { // ... } } class derived extends base {

c# - .NET external unmanaged library function throws uncatchable exception -

i'm using opennetcf library in windowsce .net compact framework 3.5 application. problem when call 1 of functions ( networkinterface.getallnetworkinterfaces() specific), randomly throws uncatchable exception , crashes application: exceptioncode: 0x80000002 exceptionaddress: 0x03f928c4 @ nativemethods.wzcdeleteintfobj(intf_entry& intf) @ intf_entry.dispose() @ getallnetworkinterfaces() i've search web , bug reported in bug tracer of opennetcf community. unfortunately, nobody has fixed yet , i'm pretty sure nobody going fix it. i've got source code have myself. happy if managed catch exception, without crashing application. the method throws exception native method imported in following way: //--------------------------------------- // wzcdeleteintfobj: cleans intf_entry object // allocated within rpc call. // // parameters // pintf // [in] pointer intf_entry object delete [dllimport(

asp.net - How to transfer/redirect calls without www to www.domain.com -

i have website in asp.net. want calls to: domain.com redirected www.domain.com i found here following: rewriteengine on rewritecond %{http_host} !^www. rewriterule ^ http://www.% {http_host}%{request_uri} [l,r=301] however, might cause problem when using subdomain xx.domain.com thanks you can use code asp.net application @ global.asax file: void application_beginrequest(object sender, eventargs e) { string fromhomeurl = http://yourdomain.com; string tohomeurl = http://www.yourdomain.com; if(httpcontext.current.request.url.tostring().tolower().contains(fromhomeurl)) { httpcontext.current.response.status = "301 moved permanently"; httpcontext.current.response.addheader("location", request.url.tostring().tolower().replace(fromhomeurl, tohomeurl)); } }

windows - How can an EXE have static dependency on a DLL? -

often when trying run exe uses dll, if dll missing standard windows error: the program can't start because xxx.dll missing computer. try reinstalling program fix problem. this seems built-in exe before of code gets called... how work, , how set when building project in visual studio? edit: in specific scenario have dll has "static" dependencies on other dlls if aren't present, registering dll fails little hard diagnose. i'd rather not manually list ever dll function used there lots! when link dll there 2 ways this, implicit linking , explicit linking. encountering failure of implicit linking. implicit linking operates through called import table contained in executable image uses pe (portable executable) format. pe format defines both import , export tables. export table contains list of functions exported dll, , entry points. import table contains implicit dependencies on other modules. when executable starts loader reads impor

c++ - Oracle OCCI - get column by name instead of index -

using oracle occi possible instead of supplying index column when requesting data query resultset, pass column name , data? so instead of doing: (pseudocode) std::string query = "select name customers;"; std::string myresult = oracle.getstring(1); // name column in query you'd this: std::string myresult = oracle.getstring("name"); //column name string is there way this? have looked around, been unable find anything, besides perhaps going fetch table's metadata. i read documentation . it says resultset has method getcolumnlistmetadata() , produces vector of metadata . most can use metadata::getstring find name of column. and if can use std::map<string, int> map column names indices. and name → index mapping in place can implement getstring takes query result , column name arguments. possibly has used particular database can better, seems needed take @ documentation. cheers & hth.,

objective c - stringWithContentsOfFile:usedEncoding:error: does not work -

i'm trying import csv created filemaker , copied onto device using itunes filesharing. i'm stuck on should straightforward step. can't see i'm going wrong. tried alternative method , setting utf8 encoding. tried exporting filemaker xml utf8, , tried deleting app phone , rerunning. doesn't seem read encoding if specify it. following code gives me console output. file exists import (null) error domain=nscocoaerrordomain code=264 "the operation couldn’t completed. (cocoa error 264.)" -(void)importdatabase { nsstring *importstring; nserror *error; nsstring *documentsdirectorypath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; if ([[nsfilemanager defaultmanager] fileexistsatpath:[documentsdirectorypath stringbyappendingstring:@"/iphone.csv"]]) { nslog(@" file exists"); nsstringencoding encoding; importstring = [nsstring stringwithcontentsoffile:[documentsdirectorypath strin

wmi - View Cpu Information! -

i want devalope applaciton view information realted cpu , motherboard, want cpu informtion @ first others. what want information cpu brand,specs,temp,current load......etc. i searched lot , found following query: ----select * win32_temperatureprobe query dosn't return other queries returns acutally, don't know what's problem. devaloping applaction using vs2008 c#. please if there anyway me please help, , please explain in answer cause want learn , understand. i have intel pentuim d 820, gigabyte 945pl-s3. thanks. system.diagnostics you. check http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx demo project in .net 2.0 system information: http://www.codeproject.com/kb/system/gethardwareinformation.aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.aspx got example code in bottom of page..

How to clear current fill style on Flex Graphics object -

i'm rendering quite complex output on flex graphics object , can't reset fill style once i've used it. for example: var g:graphics = this.graphics; g.linestyle( 3, 0xff000, 1 ); g.moveto( 10, 10 ); g.lineto( 20, 20 ); g.lineto( 10, 20 ); g.beginfill( 0x00ff00 ); g.moveto( 110, 10 ); g.lineto( 120, 20 ); g.lineto( 110, 20 ); g.endfill(); g.moveto( 210, 10 ); g.lineto( 220, 20 ); g.lineto( 210, 20 ); first draws red line, green triangle red outline expected. but last line drawn still has green fill style applied though have called endfill(). i can't seem find way disable current fill style once i've called beginfill(). this flex builder 3.0 3.0.0 sdk.

ocr - How to make tesseract to give relevant results in the presence of noise? -

Image
i using tesseract 3.0.0 , bumped following problem: when there small tesseract recognize seems it's merged other fragments. result nothing relevant returned. the image below shows 3 cases. rectangle dashed line passed tesseract. on rectangle result (v on t means new line). the last case problem one. there someway improve tesseract in situations this? as far know, tesseract not have proper image segmentation yet (or document analysis, called in commertial ocr applications.) typically, before ocr done, image get's split on separate areas contain text, pictures, barcodes, lines , on. apply ocr on text ares , don't face problems have described. earlier versions of tesseract did not have functionality @ all, , tesseract supposed used line recognizer only, or called field-level recognizer, when use on small snippets of text cut bigger image. i did not followed throughly introduced in 3.0, there partially, not work expected, have found out. there openso

android - UI ideas on managing large set of text articles -

i need implement ui user able browse large set of text articles. consider using textswitcher , ontouchevent method implemented in order have ui similar browsing pictures in gallery. have ideas?(besides listview) grateful hints. update: want show these articles randomly, not want let user browse among them. i think not ui design problem more of application design problem. on mobile devices, counting tablets, have very small screen real estate. the statement : "how can browse large set of xx on mobile 3 inches screen" antinomical , answer : "you shouldn't" :) give user powerful search engine, organize content in tree of categories @ end of branch or after search there no more 10 20 results. can go evil root of : "sorry request generated more 50 results, try more specific." it give following : -great usability your content now(was) organized , easy reuse in other projects low bandwith usage (given web service based app) lower

collections - How do I declaratively create a list in Scala? -

in c# can declare list declaratively, in other words declare structure , initialise @ same time follows: var users = new list<user> { new user {name = "tom", age = 12}, new user {name = "bill", age = 23} }; ignoring differences between list in .net , list in scala (ie, feel free use different collection type), possible similar in scala 2.8? update adapting thomas' code below believe nearest equivalent c# code shown: class user(var name: string = "", var age: int = 0) val users = list( new user(name = "tom", age = 12), new user(name = "bill", age = 23)) what about: case class user(name: string, age: int) val users = list(user("tom", 12), user("bill", 23)) which give you: users: list[user] = list(user(tom,12), user(bill,23))

wpf - How to use {Binding Path=/} for displaying directly third level of nested collections? -

i have nested entity structure this: dataobject > universities (list) > colleges (list) > students (list) > projects (list) i want bind treeview directly dataobject as: mytreeview.itemsource = dataobject.universities; datatemplate datatemplate = new datatemplate(); datatemplate.datatype = typeof(student); frameworkelementfactory spfactorydeliverable = new frameworkelementfactory(typeof(textblock)); spfactorydeliverable.name = "spfactorydeliverable"; spfactorydeliverable.setbinding(textblock.textproperty, new binding("colleges/students/name")); datatemplate.visualtree = spfactorydeliverable; rdtreedeliverables.itemtemplate = datatemplate; to display nodes students' names. problem that- display name of single college's student names. not display records of second or further college record. any suggestion/idea? {binding path=/} shows current item list, not iterate on l

delphi - case..of with function -

this program... need how can use function calkanadmiar 2: in (case rgmetoda.itemindex of) , function calkaniedomiar 3: unit unit1; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls; type fx= function(x:extended):extended; tform1 = class(tform) naglowek: tlabel; label1: tlabel; label2: tlabel; label3: tlabel; label4: tlabel; label5: tlabel; label6: tlabel; label7: tlabel; edprzedzialy: tedit; edod: tedit; eddo: tedit; pnwynik: tpanel; oblicz: tbutton; rgmetoda: tradiogroup; rb1: tradiobutton; rb2: tradiobutton; rb3: tradiobutton; function f1(x: extended): extended; function f2(x: extended): extended; function f3(x: extended): extended; procedure obliczclick(sender: tobject); procedure edprzedzialyexit(sender: tobject); procedure edodexit(sender: tobject); procedure eddoexit(sender: tobject); private

css - How do you put two divs next to each other so they fill up the available space -

i have 2 divs, right 1 80px wide other should fill remaining space. far tried: <!doctype html> <html> <head> <title>#{get 'title' /}</title> <style type="text/css"> body { margin: 0; padding: 0; } #left { position: relative; margin-right: 80px; background-color: red; } #right { float: right; position: relative; text-align: left; width: 80px; background-color: yellow; } </style> </head> <body> <div id="left"> left </div> <div id="right"> right </div> </body> </html> however, right box put below left box , not right it. guess because of margin. tried margin-left: -80px on right 1 doesnt seem change anything. how have change css right div in same line left div?

ruby on rails - How do you get the parent of a polymorphic object before its been saved? -

i have standard polymorphic relationship , need know parent before save it. class picture < ar::base belongs_to :attachable, :polymorphic => true end class person < ar::base has_many :pictures, :as => :attachable end class vehicle < ar::base has_many :pictures, :as => :attachable end i'm uploading pictures via paperclip , build processor needs different things different pictures (ie. person pictures should have polaroid & vehicle pictures should have overlay). problem before picture saved don't know if associated person or vehicle. i tried putting "marker" in person & vehicle tell them appart, when i'm in paperclip processor thing see picture class. :( next thought climb stack try , parent caller seems quite smelly me. how it? you should able polymorphic association. class picture < ar::base belongs_to :attachable, :polymorphic => true before_create :apply_filter private def apply_filter

What does '&' mean in C++? -

what '&' mean in c++? within function void read_wav::read_wav(const string &filename) { } and it's equivalent in c? thanks edit 1 if want transform above c++ function c function, how it? in context, & makes variable reference. usually, when pass variable function, variable copied , function works on copy. when function returns, original variable unchanged. when pass reference, no copy made , changes made function show after function returns. c doesn't have references, c++ reference functionally same pointer in c. difference pointers have dereferenced when use them: *filename = "file.wav"; but references can used though original variable: filename = "file.wav"; ostensibly, references supposed never null, although it's not impossible happen. the equivalent c function be: void read_wav(const char* filename) { } this because c doesn't have string . usual practice in c

pointers - Prevent object from being moved by garbage collector in F# -

in c# es easy pin object place stored using keyword "fixed". here example msdn : unsafe static void testmethod() { // assume class point { public int x, y; } // pt managed variable, subject garbage collection. point pt = new point(); // using fixed allows address of pt members // taken, , "pins" pt isn't relocated. fixed (int* p = &pt.x) { *p = 1; } } how can done in f#? you can use gchandle type pinned

Removing the frame from the Boxplot() function in R -

does know how remove frame when producing boxplot r boxplot() function? with plot() function there optinal argument, frame=f , job... not included in boxplot() function... thank much! use option frame=f (or frame.plot=f ) in boxplot function : boxplot(count ~ spray, data = insectsprays, col = "lightgray",frame=f) other parameters can used in boxplot function (rather inconveniently) listed on helppage of ?bxp , underlying function of boxplot()

javascript - Invoke native date picker from web-app on iOS/Android -

i'm trying explore posibilities running native web-app on different platforms using html5. currently, <input type="date"> field opens standard soft keyboard on android , ios. suppose in future mobile os's soft keyboards include date pickers , such - <select> invokes native select today. since isn't implemented on either android or ios, implemented in native ui, possible web-app invoke native date picker, i.e. when clicked on? this make possible stop using javascript libraries jquery mobile , yui. if question in way unclear, please tell me. thank in advance :-) since years devices support <input type="date"> others don't, 1 needs careful. here observations 2012, still might valid today: one can detect if type="date" supported setting attribute , reading value. browsers/devices don't support ignore setting type date , return text when reading attribute. alternatively, modernizr can used detect

c++ - boost::program_options: parsing multi-valued options in ini-files in a single name-value pair -

if specify ip_addresses=monkeys ip_addresses=baboons parse_config_file creates multiple strings resulting in std::vector< std::string> output. i want list multiple strings on single line. ip_addresses=monkeys, baboons the result single string in std::vector< <std::string> > . if possible, how 1 express seperator ? the documentation not specify if string seperation allowed in ini-files. however, multi-valued settings can seperated when supplied command line switches.

sorting - Go: Is there a way to avoid the implementation of the full sort.Interface for slices of structs? -

if have array/slice of structs in go , want sort them using sort package seems me need implement whole sort interface contains 3 methods: len swap less it seems len , swap should have same implementation no matter type of struct in array. is there way avoid having implement len , swap every time or limitation lack of generics in go? your own answer right. in case of array or slice implementations of len() , swap() simple. len() go provide native swap() here. interface used can used more complex data structures btrees. still allows sort() function work (like parallel quicksort, uses same sort interface).

authentication - Ruby On Rails - Setting Object Values -

i've created ruby on rails application in users can login , logout, , new accounts can created. users have integer "rankid", , depending rankid have different permissions on site. i want users able upgrade next rank going rooturl/upgrade - in routes.rb have following: map.connect '/upgrade', :controller => 'users', :action => 'upgrade' which makes use of following method in users controller: def upgrade @currentid = session[:user_id] @user = user.find(@currentid) if @user.rankid = 0 @user.rankid = 1 redirect_to root_url, :notice => "upgraded vip!" return end if @user.rankid = 1 @user.rankid = 2 redirect_to root_url, :notice => "upgraded admin!" return end end i setup authentication using this tutorial , can't figure out why wont work. sorry if stupid mistake - i'm new both ruby , rails. first, if statements need double equals sign, compare @user.

c++ - How to workaround warning C4333 ('>>' : right shift by too large amount, data loss) -

i have following function convert integer of arbitrary size buffer: template<typename t> std::string build_data_from(t val) { std::string result; (int = 0; < sizeof(val); i++) { result.insert(0, 1, char(val)); val = val >> 8; } return result; }; however, invoking template function unsigned char renders warning in visual c++ 2008: std::string x(build_data_from<unsigned char>(1)); warning c4333: '>>' : right shift large amount, data loss is there clean way (without using pragma warning directive) workaround it? pretty simple: overloading build_data_from unsigned char (and char ). this can done either plain overload or using std::enable_if , i'd advise plain overload it'll easier: std::string build_data_from(char val) { std::string result; result += val; return result; } std::string build_data_from(unsigned char val) { return build_data_from(char(val)); } but, conscious casting unsig

html - need to display background image of link inline with text links correctly -

i want display facebook-footer-rect.png link, , provide wording in link tag screen readers. <a href="http://facebook.com/ourpage" title="join on facebook" rel="external" class="facebook-footer">join on facebook</a> example html of links: <div class="footer-links"> <p> <a href="link">link 1</a> <a href="link">link 2</a> <a href="link">link 3</a> <a href="link">link 3</a> <a href="http://facebook.com/ourpage" title="join on facebook" rel="external" class="facebook-footer">join on facebook</a> </p> </div> css footer-links , facebook-footer .footer-links { line-height:1.9em; text-align:center; margin: 0; } .footer-links a:visited, .footer-links a:link { display:block; padding:7px; background-color:#216e4f; text-decoration:none; display:inlin

Error after upgrading to NHibernate 3.0 XML parsing: line 1, character 4000, unexpected end of input -

i have sql2008 db has column type of xml. using nhibernate 2.5 can save column no problems. i've dropped in nhibernate 3.0 dlls , i'm getting above errors? my mapping file doesn't have type against column surely nhibernate should pick xml data type (i'm using sql 2008 dialect) ? 4000 seems suspicious length, i.e length of varchar column in sql. i see there few articles mapping xml columns using custom usertypes, etc. how come worked in 2.5 , doesn't in 3.0 ? don't need special handling. column gets used string everywhere. the reason behavior changed 2.x 3.0.0 due a code commit on nhibernate.driver.sqlclientdriver , turned on of behavior of enabling prepare_sql configuration in order resolve issue caching of query plans . a c# string property mapped column has no other type specified in mapping treated nhibernate.sqltypes.stringsqltype , given 4000 character limit driver: from nhibernate.sqltypes.stringsqltype : /// <remarks&

templates - Django want to use a variable from another view -

i have list of items in view called client_items. want able use variable items_list`which view called edit_order in client_items. there way call variable different view? (import variable view , able use variable in other) cannot write in client_items view because needs order_no augment. edit: here latest views. have tried creating views called items_in_edit_order. @ point `order_no not defined. def items_in_edit_order(order_no): order = models.order.objects.get(pk = order_no) return order def client_items(request, client_id = 0): client = models.client.objects.get(pk = client_id) items = client.storageitem_set.all() order = items_in_edit_order(order_no) return render_to_response('items.html', {'items':items, 'client':client, 'order':order}, context_instance = requestcontext(request)) just adding, since no 1 has said , seems don't understand yet: your client_items view must, somehow, have access

opengl - How to give a 2D structure 3D depth -

i begging learn opengl part of molecular modeling project, , trying render 7 helices placed spatially close each other , move, tilt , interact each other in ways. question how give 2d scene 3-dimensional depth geometric structures true helices in 3 dimensions? i have tried playing around projection matrices (gulperspective, glfrustum) without luck, using gldepthrange function. i include code rendering helices, simplicity insert code rendering 1 helix (the other 6 helices same except translation matrix , color function parameters) , reshaping when mapping object coordinates clip coordinates: any appreciated. void init() { glclearcolor(0.0f, 0.0f, 0.0f, 1.0f); // black background gllinewidth(8.0); } /* called draw helices */ void renderhelix() { glfloat x,y,z; glfloat c = 2.5f; //helical pitch glfloat theta; //constant angle between tangent , x-axis glfloat r = 4.5f; //radius //glint = 1; //loop through code render 7 heli

JSF expression language (EL) question -

i have menu item want show/hide if user has roles. i'm using rendered attribute this, i'm stuck on something. works ... rendered="#{loginhandler.hasstaffrole}" ... not ... rendered="#{loginhandler.hasstaffrole or loginhandler.hasinstructorrole or loginhandler.hasvolunteerrole}" the error in eclipse problem 1 is: "cannot apply expression operators method bindings" any idea how should fix this? answering own question. problem loginhandler.hasstaffrole() method needed worded loginhandler.ishasstaffrole() in order recognized property. (in end changed .isuserhasstaffrole.) thanks.

internet explorer - Is it possible to have two browser windows opened simultaneously with different sessions? -

is possible have 2 browser (ie , ff mainly) windows opened simultaneously different http sessions same web application? think remember standard way in ie 6. in ie8 , above, open multiple instances of browser running -nomerge parameter. way, session cookies separate each instance. (source: ieblog ) for firefox, there several ways achieve same result, listed here on superuser chrome/chromium , opera have private mode, in session cookies aren't shared other windows of same browser (create private window ctrl + shift + n ) tested in of above; note universally valid session cookies (those expire when close browser) - persistent cookies handled differently in each browser.

javascript - GreaseMonkey Hello World -

any ideas why script isn't working? also, when install script name , description field blank? //==userscript== //@name testname //@namespace anondeveloper //@description script automagically blah blah blah //@include * //==/userscript== alert('hello world!'); the script located on file system rather uri. causing issue? it works me in latest google chrome (you didn't browsers tested). however, in order name , description correctly display, need add space after each // : // ==userscript== // @name testname // @namespace anondeveloper // @description script automagically blah blah blah // @include * // ==/userscript== alert('hello world!');

c# - TableLayoutPanel's Control Columns properties -

i've noticed every control added tablelayoutpanel given "column" , "row" properties. how can access these properties through code? thanks:) these properties exist in properties window, magic provided iextenderprovider interface. don't exist @ runtime. extended properties are: columnspan. runtime: getcolumnspan() , setcolumnspan() rowspan. runtime: getrowspan() , setrowspan() row. runtime: getrow() , setrow() cell. runtime: getcellposition() , setcellposition() column. runtime: getcolumn() , setcolumn() obviously tlp highly optimized used designer. it's kinda of pain @ runtime.

json - Weird HTTP data accumulation on App Engine with Python and CouchDB -

i'm trying make relatively simple app engine app fetch pages on daily basis , post data couchdb server. i've got following code in app engine app (with couchdb-python library): # post result couchdb price_data = { 'source': 'blah', 'date': str(result.headers['date']) } db.save(price_data) db.put_attachment(price_data, file_one, 'prices_one.txt') db.put_attachment(price_data, file_two, 'prices_two.txt') file_one , file_two results earlier urlfetch requests. now works fine except first attachment gets posted price_data json ({ 'source': 'blah', 'date': 'date here'}) @ beginning of prices_one text file, , second attachment gets prefixed both price_data json whole prices_one text file, followed actual prices_two.txt file. i'm sure if tried add third attachment, post accumulated data one. if go on couchdb @ file in db, it's full file, { '

ruby on rails - resource_url generating wrong url -

i have rails app in subdirectory of server, www.domain.com/sub need send url e-mail, tried use "resource_url" generates link www.domain.com/resource_path, should wwww.domain.com/sub/resource_path. how can solve ? thanks! in rails 2.3.8 can add line config/environments/production.rb actioncontroller::base.relative_url_root = "/sub" i not sure equivalent rails 3, see question if using: what replacement actioncontroller::base.relative_url_root?

Wordpress - unable plugin update ftp login -

i have wordpress blog on server, admin portal on same server. the auto update of plugins admin portal not working. error saying not authorize login. error message - error: there error connecting server, please verify settings correct. i know login details correct. could problem server trying connect ? i have looked @ other articles problem, havent got selinex installed , permissions seem correct. directories -rw-r--r-- 1 root root 200 may 23 2010 .htaccess -rw-r--r-- 1 www-data www-data 1406 may 16 2010 favicon.ico -rw-r--r-- 1 www-data www-data 397 may 25 2008 index.php -rw-r--r-- 1 www-data www-data 15410 dec 6 2008 license.txt drwxr-xr-x 6 www-data www-data 4096 jul 28 2010 mint -rw-r--r-- 1 www-data www-data 9122 jul 22 2010 readme.html -rw-r--r-- 1 www-data www-data 4391 apr 19 2010 wp-activate.php drwxr-xr-x 7 www-data www-data 4096 sep 3 12:33 wp-admin -rw-r--r-- 1 www-data www-data 40284 jul 25 2010 wp-app.php -rw-r--r-- 1

php - Upgrading from Textmate to a real IDE -

i've started using php oo development. on osx, have outgrown coda , feel textmate takes more time set use. i've downloaded few of "real" ides, feel overkill , can't find way ease myself and/or way busy. i'm looking code folding, validation, can colorize php/pdo/html in same document, , completion of classes , methods doesn't require 6 months productive again. can throw me bone? i use netbeans 6.9.1 , have been happy it. here favorite features: -- functions, classes, comment blocks , other structures automatically set code folding, can highlight block , make arbitrary code fold. -- syntax highlighting good -- full support new php 5.3 features (namespaces etc.) -- autocomplete works, stays out of way when don't need it. -- refactoring works well -- has lot of built in macros, plus can create own -- nice, fast code validation. -- supports xdebug through local/remote web server. -- has built in symfony support -- tra

language agnostic - What are some useful or interesting infinite generators? -

what clever uses infinite generators? i've seen lots of seemingly trivial examples "list numbers" , assume there must others have more applicability real-world scenarios. concrete examples (in language support generators) appreciated! i'll give trivial sample answer. look @ haskell code on http://rosettacode.org/wiki/hamming_numbers#haskell ; uses lazy lists (which generators) in creative way list hamming numbers.

iphone - PDF Viewer iPad App -

i'm looking develop custom pdf viewer ipad, has features like: bookmarks search deep linking zoom jump specific page does know code solution similar this? i'm looking @ ghostscript having problem finding other options. i've developed custom reader i've used handful of projects clients. search & highlight far difficult, followed text selection. keeping memory usage low large pdf's tricky too. i cant share source. here's has free library looks promising: http://mobfarm.eu/fastpdfkit https://github.com/mobfarm/fastpdfkit (it doesn't if source code available?)

c# - Per-Request static data in ASP.NET -

i'm wanting cache roles user in each request comes in. there several places throughout given page where have like: <% if(roles.isuserinrole("rolename")) {%> <!-- conditional rendering --> <% } else if(roles.isuserinrole("anotherrole") {%> <!-- point --> <% } %> since stored in sql database, each of these requests hit database. know there ways cache roles in cookie, don't want that. anyway, thinking this. public static class securityutils { public static string[] userroles() { var context = httpcontext.current; if (context == null) return enumerable.empty<string>(); string[] roles; roles = context.items["userroles"] string[]; if (roles == null) { roles = roles.getrolesforuser(); context.items["userroles"] = roles; } return roles;

ruby on rails - Bundler path problem -

i've taken on ann application deployed server else. there's broken setup, missing environment variable or similar problem stumped. way rails application, running under ree , mod_rails (passenger) here console logs have me stumped. first, rake db:migrate claims don't have rails 2.3.8 $ rake db:migrate (in /var/www/ems.trustthevote.org/ems/current) missing rails 2.3.8 gem. please `gem install -v=2.3.8 rails`, update rails_gem_version setting in config/environment.rb rails version have installed, or comment out rails_gem_version use latest version installed. however, bundler says do: $ bundle list gems included bundle: [...snip] * actionmailer (2.3.8) * actionpack (2.3.8) * activerecord (2.3.8) * activeresource (2.3.8) * activesupport (2.3.8) [...snip...] * rails (2.3.8) but on other hand, gem says no: $ gem list rails *** local gems *** here relevant environment variables: rubyopt=-rauto_gem rubylib=~/.gem , finally, here's ruby th

c - Assigning unknown values in an array to variables -

okay have array of 9 integers. of values given , unknown. how assign integer variable such 'a' - 'z' these unknown values? example: index [0] unknown index [1] 27 index [2] 6 index [3] 9 index [4] unknown index [5] 21 index [6] 24 index [7] 3 index [8] unknown i want index [0] index [1] 27 index [2] 6 index [3] 9 index [4] b index [5] 21 index [6] 24 index [7] 3 index [8] c (ii=0; ii<maxline/2; ii++) { if (uniquenumbers[ii] == unknown_input) { printf("unkown_input @ [%d]\n", ii); } } since not seem use negative values (you mark unknown -1) use negative ascii value of chars store information. index [0] (-97) index [1] 27 index [2] 6 index [3] 9 index [4] b (-98) index [5] 21 index [6] 24 index [7] 3 index [8] c (-99) when printing use (char)(-1 * index[i]) .

Rails 3 route problem -

after solving other problem routes , have one. i have route in routes.rb: match "user/create_new_password/:reset_password_key" =>"users#create_new_password", :via=>[:post, :get], :as=>:create_new_password i can test in functional tests this: test "should create new password " post :create_new_password, {:user=>{:password=>"123456", :password_confirmation=>"123456"}, :reset_password_key=>user.reset_password_key} end in view, have following form: =simple_form_for @user, :url=>create_new_password_path |f| =f.input :password, :label=>i18n.t("activerecord.attributes.user.email") =f.input :password_confirmation, :label=>i18n.t("activerecord.attributes.user.password_confirmation") =f.submit i18n.t "activerecord.actions.user.create_new_password" when submit form, get: no route matches "/user/create_new_password/oqqxytgjykxxgvbastswtm

visual c++ - How to get the public desktop folder path in XP (C++)? -

i need way path of public desktop folder has work on xp newer flavours of windows , must (human) language-independent. there doesn't seem setting in environment variables covers folder. shgetknownfolderpath() works in vista , later, need know if there's function work me. call shgetspecialfolderlocation csidl_common_desktopdirectory

javascript - Combo buttons display improperly when created using jQuery -

i using jquery create set of combo buttons in chrome extension: for( var = 0, format; format = phoneformats[i]; ++i ) { var input = $('<input>', { style: 'width: 400', type: 'radio', name: 'phone-format-radio', value: i, text: getdisplaynumber( format ) }).after( '<br/>' ); $(id + ' > button').before( input ); } there 2 major issues current output. first of all, unless explicitly set width of each input element, width not account text next combo box. secondly, combo buttons appear right of text instead of left of it. if manually create these combo buttons in html, structure fine. doing wrong jquery? as far question in comment goes (i.e. "why radio button not being given default width (the size of text) , why radio button on right of text instead of left."), radio buttons (or <input> elements matter) don't have content. so, text get