Posts

Showing posts from July, 2014

c# - How do you get the User's IP Address in Castle MVC (Monorail)? -

in controller action of castlemvc application, how can user's ip address? i think in asp.net mvc request.servervariables["remote_addr"] , can't find equivalent in castle. (i aware of potential proxy issue's etc, address reported in request fine) castle monorail, asp.net mvc, serve elegant mvc skin on asp.net runtime. as such, can done asp.net runtime (except webforms specific stuff viewstate) can done asp.net mvc , monorail. so, can grab current asp.net's httpcontext using static httpcontext.current method. from monorail, can use ienginecontext's .underlyingcontext property access asp.net httpcontext. specifically, in monorail, can grab client's reported ip using convenience property userhostaddress on current irequest. e.g. within controller's action: var clientip = request.userhostaddress;

java - Get path of execution - from where I start jar file -

can in java app find current path start jar file ? path of execution ( example: c:\test\test_one> java -jar test.jar c:\test\test_one ) ? you can. within code can call system.getproperty("user.dir") return working directory of application.

c# - QuickGraph - is there algorithm for find all parents (up to root vertex's) of a set of vertex's -

in quickgraph - there algorithm find parents (up root vertex's) of set of vertex's. in other words vertex's have somewhere under them (on way leaf nodes) 1 or more of vertexs input. if vertexs nodes, , edges depends on relationship, find nodes impacted given set of nodes. if not how hard write one's own algorithms? here's i've used accomplish predecessor search on given vertex: ibidirectionalgraph<int, iedge<int>> creategraph(int vertexcount) { bidirectionalgraph<int, iedge<int>> graph = new bidirectionalgraph<int, iedge<int>>(true); (int = 0; < vertexcount; i++) graph.addvertex(i); (int = 1; < vertexcount; i++) graph.addedge(new edge<int>(i - 1, i)); return graph; } static public void main() { ibidirectionalgraph<int, iedge<int>> graph = creategraph(5); var dfs = new depthfirstsearchalgorithm<int, iedge<int>>(graph); ...

.net - Why does Silverlight not call AfterReceiveReply for my custom ServiceModel.ClientBase<TChannel> channel's behavior? -

i have service reference third-party api. use custom channelfactory class build channels ([wcf] of type system.servicemodel.clientbase) api. i have custom behavior class (defined below) attach channel endpoint in order handle exceptions api. in normal .net code, works fine. in silverlight, however, afterreceivereply method called if there no error. in case, calling method encounters error when try reference result of eventargs: 'eventargs.result' threw exception of type 'system.reflection.targetinvocationexception' . the inner exception has: innerexception = {system.servicemodel.communicationexception: remote server returned error: notfound. and see above error regardless of real error. in fiddler, can see real error coming back. there channel processing hides it. below example of soap response has real error. (some values removed.) <?xml version="1.0" encoding="utf-8"?> <soapenv:envelope xmlns:soapenv="http://schemas.xmls...

sockets - Connecting to a WAN server in C# -

i wondering if possible connect listening server not on lan instead on wan. changes have make allow this? lan, man , wan relative terms used describe size of network; relate hardware layout. hardware intentionally transparent socket programming. there's no need concern these items. if have difficulty connecting into: nat/firewalls: block stuff routing: particularly subnets , private ip's. telnet: simple way see if can connect tcp server on net try telnet it. afa programmatic testing, recommend simple chat application . great learning tool beginners. use working socket application before writing new 1 in order work out network kinks prior development.

winforms - ThreadPool.QueueUserWorkItem new Form CreateHandle Deadlock -

i have thread needs create popup window. start thread using threadpool.queueuserworkitem(new waitcallback(createpopupinthread)) thew thread creats new form. application freases in new form constructor @ createhandle. worker thread locked... how can fix this? this how create form var form = new confirmationform { text = entry.caption, label = entry.text, }; in constructor thread enters deadlock public confirmationform() { initializecomponent(); } i think better create "popup window" on ui thread , create thread in "popup window" process want do. as suspected, can´t show form created on non ui thread. see answer: possible construct form on background thread, display on ui thread

html - saving value selected in a list when submit button is clicked -

in jsp have dropdownlist , submit button when clicking submit button lose value selected in list. using jstl because need construct other table corresponding value selected in list.for must call submit button problem; reset value selected i want know if there way save value selected in list click submit button. work jsp , eclipse environment. thank help. you need preset inputs request parameter values. can access parameter values in el ${param.name} . in case of dropdowns rendered html <select> element, need set selected attribute of html <option> element in question. can make use of ternary operator in el print selected attribute whenever option value matches request parameter value. basic example: <select name="foo"> <c:foreach items="${options}" var="option"> <option ${param.foo == option ? 'selected' : ''}>${option}</option> </c:foreach> </select> ...

jquery - IE adding pixels to width -

i'm making site , on pages ie adding pixels make have horizontal scroll bar , on others not. can't figure out wrong here. here css appreciated (i'm using jquery on site if effects answer any). html, body { padding: 0; margin: 0; border: 0; height:100%; min-height:900px; font-size: 12px; font-family: tahoma, geneva, sans-serif; } .north { height: 100px; margin-right:5px; } .south { height: 2em; background-color: #3f3f3f; border-top: 1px solid black; font-size:80%; color: rgb(200, 200, 200); width:100%; display:block !important; position:absolute !important; bottom:0px !important; left:0px !important; } .west { width: 200px; font-size: 0.78em; } .center { font-size: 80%; height:auto; min-width:300px; } those multiple !important notation fix other stuff wasn't working, removing them doesn't fix issue. likely margin in north. ie's box m...

bash - Bourne Script: Redirect success messages but NOT error messages -

this command: keytool -import -file "$serverpath/$servercer" -alias "$clienttrustedceralias" -keystore "$clientpath/$clientkeystore" -storepass "$serverpassword" -noprompt will when runs outputs: certificate added keystore i tried redirecting stdard out with: keytool ... > /dev/null but still printing. it appears message being output standard error. since when not displayed: keytool ... > /dev/null 2>&1 however not wanting do. error messages output not want "success" messages output command line. ideas? whatever happened unix convention: "if works not output anything". agreed, that's not friendly behaviour on part of keytool. if set of success messages small, can use grep explicitly remove them, eg keytool ... 2>&1 | grep -v '^certificate added keystore$'

Throw Simple Exception in Java -

i'm looking learn how throw super simple exception in java. have following: public percolation(int n) // create n-by-n grid, sites blocked { if(n < 1) throw new exception("n must greater zero."); grid = new boolean[n * n + 2]; dimension = n; grid[0] = true; grid[n+1] = true; unionstruct = new quickfinduf(n+2); } it's not compiling, that's type of thing i'm looking do. what's proper syntax this? it's because you're throwing checked exception without declaring exception you're throwing. in case should throwing exception derived runtimeexception instead, , these not checked (meaning don't have declare them). 2 ways fix are throw new illegalargumentexception("n must greater zero."); // unchecked or public percolation(int n) throws exception

c# - How do I reference array values within string.Format? -

i using xpath exclude nodes within menu. want expand on exclude nodes identified within array. this works exclude nodes in menu id 2905 type not content: xmlnodelist nextlevelnodelist = currentnode .selectnodes(string .format(" menu[not(menuid = 2905)] /item[ itemlevel = {0} , itemtype != 'javascript' ] | menu[menuid = 2905] /item[ itemlevel = {0} , itemtype = ...

Google docs viewer url parameters -

is there sort of documentation on parameters can put in url of google viewer? originally, thought url,embedded,chrome, i've come accross other funny ones a,pagenumber, , few others authentication etc. any clues? one know "chrome" if you've got https://docs.google.com/viewer?........;chrome=true then see heavy ui version of doc, "chrome=false" compact version. but indeed, i'd complete list myself!

database - make field a dropdown in access 2007 -

i'm creating hr database in access 2007 i have main table of employee info , several tables relate table ( education example) list acceptable elements can populate cell in row when create form created plain text field constrained wanted create dropdown had data allowed enter avoid confusion. you should able right-click text box , select change -> combo box.

Allowing 3 attempts at game - php -

possible duplicate: loop iteration in php game trying allow user guess @ "1" movie, 3 times, if dont it, tells them right answer (which variable: $rand_keys). deducts guesses , displays amount of guesses left (possible error $guesses variable?). whats going wrong here? please show me possible solution. <style type="text/css"> input {border:1px solid #add8e6; font-size:1.2em;} input.spec {background-color:#ddd;} </style> <?php echo "<fieldset><h1><legend>testing academy award trivia</h1>"; $ages['casablanca'] = "1943"; $ages['around world in 80 days'] = "1956"; $ages['patton'] = "1970"; $ages['annie hall'] = "1977"; $ages['chariots of fire'] = "1981"; $ages['dances wolves'] = "1990"; $ages['crash'] = "2005"; $ages['the departed'] =...

php - Zend RestController > Get data using model or controller? -

iam building zend rest controller, , iam unsure data from. need output database data xml format view. do employ model controller data exchange, or query database , data in controller itself, without need of model? i see, of people employing latter scenario in additional using full mvc approach, have read people using zend_rest_server , argument being don't need incur overhead of full mvc stack in order handle such request. however, if choose go handling request via mvc, can use context-switch change view rendered. however, in both cases, believe preferable have service/model access data. makes access code more re-usable in other situations.

javascript - Getting jsdoc and Crockford's design patterns to get along -

i'm using douglas crockford's design pattern implement private, privileged , public methods. looks (using requirejs ): define(function () { return function () { var = {}, _init = function () { // "constructor" }, _privatefn = function () { return 42; }; that.publicfn = function () { return 2 * _privatefn(); }; _init(arguments); return that; }; }); however, i'm having trouble getting jsdoc toolkit parse correctly. i've played around @name , @memberof annotations (like here ), no matter do, can't functions show up. does know solution? okay, figured out. here's how it: /** * @name mymodule * @namespace */ define(['mymodule'], (function () { "use strict"; var clazz = function (config) { var = {}, /** * @private * @type number * @name mymodule#_pr...

c# - Removing items from lists and all references to them -

i'm facing situation have dependent objects , able remove object , references it. say have object structure code below, branch type references 2 nodes. public class node { // has data! } public class branch { // contains references nodes public node nodea public node nodeb } public class graph { public list<node> nodes; public list<branch> branches; } if remove node nodes list in graph class, still possible 1 or more branch objects still contains reference removed node, retaining in memory, whereas quite set references removed node null , let garbage collection kick in. other enumerating through each branch , checking each node reference sequentially, there smart ideas on how remove references node in each branch instance , indeed other class reference removed node? change node include list of branches on: public class node { // has data! public list<branch> branchesin; public list<branch> branche...

c - Works for Short Input, Fails for Long Input. How to Solve? -

i've program finds substring in string. works small inputs. fails long inputs. here's program: //find substring in given string #include <stdio.h> #include <string.h> main() { //variable initialization int i=0,j=0,k=0; char sentence[50],temp[50],search[50]; //gets strings printf("enter sentence: "); fgets(sentence,50,stdin); printf("enter search: "); fgets(search,50,stdin); //actual work loop while(sentence[i]!='\0') { k=i;j=0; while(sentence[k]==search[j]) { temp[j]=sentence[k]; j++; k++; } if(strcmp(temp,search)==0) break; i++; } //output printing printf("found string at: %d \n",k-strlen(search)); } works for: enter sentence: evening enter search: evening found string @ 6 fails for: enter sentence: dear god please make work enter search: make found string @ 25 which totally wrong. can expert find me solution? p.s: kinda reinventing...

How to Profile the CPU Activity of a Visual Studio Program -

imagine have program doing lot of things wasting 90% of cpu. need way know (through visual studio) program wasting cpu. take @ visual studio profiler . you can performance reports show functions expensive cpu-wise.

c++ - problem using getline with a unicode file -

update: thank @potatoswatter , @jonathan leffler comments - rather embarrassingly caught out debugger tool tip not showing value of wstring correctly - still isn't quite working me , have updated question below: if have small multibyte file want read string use following trick - use getline delimeter of '\0' e.g. std::string contents_utf8; std::ifstream inf1("utf8.txt"); getline(inf1, contents_utf8, '\0'); this reads in entire file including newlines. if try same thing wide character file doesn't work - wstring reads the first line. std::wstring contents_wide; std::wifstream inf2(l"ucs2-be.txt"); getline( inf2, contents_wide, wchar_t(0) ); //doesn't work for example if unicode file contains chars , b seperated crlf, hex looks this: fe ff 00 41 00 0d 00 0a 00 42 based on fact multibyte file getline '\0' reads entire file believed getline( inf2, contents_wide, wchar_t(0) ) should read in entire unicode file. d...

linq to sql - What pattern to use for Data Access in WPF/MVVM App -

i have task management application uses class access data using linq-to-sql; want move data access separate solution in project. reason want in preparation 2 things. first create service run on database "server" (it win 7 pc) periodically query tasks , send out email reminders ones due. second change data access wcf can access tasks wp7 (once on verizon) the tasks returned defined number of user controls bound viewmodel. iqueryable built in series of statements narrow down selection according databound members. query ordered other members. once move data access out of solution not have access viewmodels members need pass relatively large number of parameters , not sure correct way be. ways can think of are: simply create method dozen or more parameters (i told bad practice) create object contains parameters , pass (doesn't seem different first option me) create class in data access solution, , instantiate , set each of properties before calling method return iq...

how to do gedcom import with minimal database roundtrip. what is best practice for this kind of development -

in current application, need import users gedcom file. these users may exist in registered users or need create 1 registered user same. gedcom file contain s many information e.g. personaldetails,addresses, education details, professionaldetails 1 sample of xml file storing store user's profile. <userprofile xmlns=""> <basicinfo> <title value="basic details" /> <fields> <userid title="userid" right="public" value="151" /> <emailaddress title="email address" right="cug" value="xyz@gmail.com" /> <firstname title="first name" right="public" value="anju" /> <lastname title="last name" right="public" value="trivedi" /> <displayname title="display name" right="private" value="anju" /> <registrationstatusid title=...

winapi - Serial port programming VB6 via Win32 API -

i interacting bill acceptor connected via serial in vb6 using mscomm control. we're having communication issues, , have been tasked using win32 api directly interact serial port. i'm not quite sure begin. links, articles, or books appreciated. serial port communication : perform serial port i/o without using microsoft comm control component

Change Visual studio 2010 color palette -

i visual studio. think awesome ide ever been made developers. color scheme in new vs2010 ugly, first thing i'd after install change color palette. googled how , found vs extension matthew johnson [msft]. if know way change color palette in vs2010, please let me know. you can use visual studio color theme editor make changes directly within visual studio, allow change theme/color of actual visual studio shell itself. to change theme/color of editor, can browse themes (created others) @ studio styles , allows create theme online , import visual studio.

version control - Maven local repository in CVS? -

i use cvs maven repository.. can give suggestions? there 2 ways: a) if want use in 1 project place 'repo' directory @ toplevel. add jars in maven convention (groupid in folders/artifactid/version/artifactif-version.jar). use repository declare file based repository in pom. <repositories> <repository> <id>some-repo</id> <name>some-repo</name> <url>file://${basedir}/repo</url> <releases> <checksumpolicy>ignore</checksumpolicy> </releases> </repository> </repositories> if use module pom have use url relative module pom. b) if want use several projects there socalled 'wagons'. there 1 svn. these maven plugins let use scm repository. don't know whether there cvs-wagon.

How to set the windows screen resolution using c# windows application -

i have done project in c# winforms. want set resolution of screen 1680 x 1050, when application run in pc. how ? as others mentioned shouldn't change resolution automatically, cause user set specific resolution likes (or hardware works best on). so instead of changing resolution should change application. use tablelayoutpanel , flowlayoutpanel , / or splitcontainer . set anchor , dock properties of controls , think setting minimumsize , maximumsize of each control within application. this way application can automatically scale between different resolutions , user can take 1 likes. last not least, application should not consider take care resolution user selected, should take care selected dpi settings. 1 should care of described in windows ux guide (site 592).

authentication - how to allow unamed user in svn authz file? -

i have subversion server running apache. authenticates users using ldap in apache configuration , uses svn authorizations limit user access repositories. works perfectly. apache dav svn svnparentpath /srv/svn svnlistparentpath off svnpathauthz off authtype basic authname "subversion repository" authbasicprovider ldap authldapbinddn # private stuff authldapbindpassword # private stuff authldapurl # private stuff require valid-user authzsvnaccessfile /etc/apache2/dav_svn.authz subversion [groups] soft = me, and, all, other, developpers adding anonymous access 1 machine now, have service want setup (rietveld, code reviews) needs have anonymous access repository. web service, accesses done same server. added apache configuration allow accesses machine. did not work until add additional line in authorization file allow read access users. apache <limit propfind options report> order allow,deny allow # private ip address satisfy <...

php - Doctrine DQL execute passing params -

i used dql in doctrine $q->update('product') ->set('quantity','?') ->where('id=?'); $q->execute(array(20,5)); i check server query , generated sql update product set quantity = '20', updated_at = '5' (id = '2010-04-26 14:34); so need know why arguments aren't in correct places? i got caught exact same bug myself few days ago. believe it's caused bug in timestampable behavior. i'm guessing have enabled in product model, , doctrine adds updated_at field series of fields update (set) , doesn't pay attention fact have sql parameters after (in clause). bug never comes when doing selects because timestampable isn't involved. the solution found supply parameters build query rather in execute's array parameter , doctrine won't confused. this: $q->update('product') ->set('quantity', 20) ->where('id = ?', 5); $q->execute(); however...

android - Default value on Bundle.getString(String key) -

i've noticed that, while of getters bundle have possibiliy of including default value, in case key doesn't exist in particular bundle instance, getstring not have possibility, returning null if case. any ideas on why , if there way of easy solution (by easy mean not having check each individual value or extending bundle class). as example, right have this: bundle.getstring("item_title"); while do: bundle.getstring("item_title","unknown title"); thanks! you'll have wrap yourself: public string getbundlestring(bundle b, string key, string def) { string value = b.getstring(key); if (value == null) value = def; return value; }

c# - Java coding style -

how keep coding standards? there stylecop , resharper c#. there tools/eclipse plugins code analisys in java? of them use? checkout http://checkstyle.sourceforge.net/ . checkstyle development tool programmers write java code adheres coding standard. automates process of checking java code spare humans of boring (but important) task. makes ideal projects want enforce coding standard. checkstyle highly configurable , can made support coding standard. example configuration file supplied supporting sun code conventions. well, other sample configuration files supplied other known conventions. pmd http://pmd.sourceforge.net/ pmd integrated jdeveloper, eclipse, jedit, jbuilder, bluej, codeguide, netbeans/sun java studio enterprise/creator, intellij idea, textpad, maven, ant, gel, jcreator, , emacs. findbugs http://findbugs.sourceforge.net findbugs uses static analysis inspect java bytecode occurrences of bug patterns. static analysis means findbugs ...

database - Rails show company name rather than company ID -

i making progress first rails app lot of great community here @ stack overflow. i have basic application has following models: kase person company party i have associated them in following way: class kase belongs_to :company # foreign key: company_id has_and_belongs_to_many :people # foreign key in join table class person has_and_belongs_to_many :kases # foreign key in join table class company has_many :kases has_many :people class party has_and_belongs_to_many :people has_and_belongs_to_many :companies at moment, if create company , go create new case (kase), can choose drop down list company want (from companies database) , on show view can output name of chosen company case using code: <li>client company: <span><%=h @kase.company.companyname %></span></li> however, if add new person using same method - can assign company person, on show view outputs company id number using code: <li>person company: <span><%=h @p...

php - Basic regexp help -

i new programming php , trying validate field in form. the field if ral color code , : ral 1001 . letters ral , 4 numbers. can me set them regular expression validate them. have tried no success: $string_exp = "/^[ral][0-9 .-]+$/i"; what can sorry being complete noob @ php. cheers ben [ral] match 1 character, either r, or l, whereas want match string "ral". want this, $string_exp = "/^ral[0-9]{4}$/"; this match "ral1001" , not "ral1" , "ral 1001" , "ral12345" , etc. if wanted space between ral , number, put space regexp.

javascript - jQuery tooltips on a dynamically generated page -

him i'm trying add jquery tooltip dynamically generated list, text want display tooltip on in table, css tooltip doesn't work: css tooltip . i tried add jquery tooltip page, works on local test page, think problem has uniqur ids, , i'm not sure how implement bind function explained there: "to bind of targets corresponding content, takes 1 line: $(".tooltip-target").ezpz_tooltip(); calling ezpz_tooltip() on class bind hover event each element, , because of naming convention know content display." can me understand have make work on dynamic page? the page euroworker's checkout product page. (you'll have add items basket, click home button on left of bnav bar , click little white button "kjøp" orange button "handlevogn".) thanks. i believe can call jquery(".tooltip-target").ezpz_tooltip(); every time add new item (assuming have tooltip-target class), i'm not sure right. another way...

ruby on rails - How to pass values from controller to javascript? -

my controller queries database , organizes values. need pass these values javascript(jquery) use values fullfill ui features. how pass values controller javascript??? pass data through view. use ajax. pass need respond_to block, or through rjs file organize comet server. , push javascript right controllers. (for example, http://juggernaut.rubyforge.org/ )

jquery - Defining Form Input with Dialog -

i want php application allow user select file computer. want store file's path, don't want upload file. with <input type="file" /> , file uploaded, take long. is there way this? maybe if change input's type text jquery right before form sent? let user type path, not convenient... no. server shouldn't need care file paths on client machine. if do, doing browsers not designed handle. not browsers expose path in first place (because doesn't matter).

How to convert number(16,10) to date in oracle -

i'm trying read borland starteam application oracle database , noticed represent date number(16,10) column. think not timestamp or epoch. instance, have number: 37137.4347569444, how can read date? i saw database has stored procedure, convert_date: create or replace procedure starbase.convert_date ( number_of_days in integer , ndate out number) ndateoffset number; currentdate date; month integer; day integer; year number; success boolean := false; bleapyear boolean:=false; ndaysinmonths number; nleapdays integer; fdate number (16,10); rgmonthdays number(5,0); begin select sysdate - number_of_days currentdate dual; ndateoffset := 693959; select to_number(substr((to_char (currentdate, 'mm-dd-yyyy')) , 1, 2), '99') - 1 month dual; select to_number(substr((to_char (currentdate, 'mm-dd-yyyy')) , 4, 2), '99') - 1 day dual; ...

java - Execute sql script after jpa/EclipseLink created tables? -

is there possibility execute sql script, after eclipselink generated ddl? in other words, possible eclipselink property "eclipselink.ddl-generation" "drop-and-create-tables" used , eclipselink executes sql-file (to insert data tables created) after creating table definition? i'm using eclipselink 2.x , jpa 2.0 glassfish v3. or can init tables within java method called on project (war ejb3) deployment? it called before ddl-execution. , there seems no nice way adapt it, there no suitable event 1 use.

Javascript: parseFloat not working -

i using jquery pull data web page, comes array following values (.5, .25, 1.25, 3.75) trying add. here's code snippet: var th = 0; (thisrow in objgrid) { var hours = objgrid[thisrow]['hours']; th = th+parsefloat(hours); console.log(hours); $("#msgbox").html("showing records week: " + thisdate + ". total hours week : " + th); } in console.log getting hours - 0, 0 , 1, 3 , totaling 4. if don't use parsefloat still same results, (thought nan). doing wrong? i think must have other problem, describing should work. example (here's bad-but-direct translation of code): var grid = [ ".5", ".25", "1.25", "3.75" ]; var th = 0; (x in grid){ var h = grid[x]; var hrs = parsefloat(h); th = th + hrs; console.log( h, hrs ); } // .5 0.5 // .25 0.25 // 1.25 1.25 // 3.75 3.75 console.log( th ); // 5.75 a few things should change code anyhow: ...

C++ program to calculate quotients of large factorials -

how can write c++ program calculate large factorials. example, if want calculate (100!) / (99!), know answer 100, if calculate factorials of numerator , denominator individually, both numbers gigantically large. expanding on dirk's answer (which imo correct one): #include "math.h" #include "stdio.h" int main(){ printf("%lf\n", (100.0/99.0) * exp(lgamma(100)-lgamma(99)) ); } try it, want though looks little crazy if not familiar it. using bigint library going wildly inefficient. taking exps of logs of gammas super fast. runs instantly. the reason need multiply 100/99 gamma equivalent n-1! not n!. yeah, exp(lgamma(101)-lgamma(100)) instead. also, gamma defined more integers.

objective c - Placing a subview on another view -

have loaded view xib file on window(another xib) dynamically subview. understand default subview loaded in first quadrant of window i.e.,the subview @ extreme left bottom of window. same case window well. issue how place subview elsewhere on window. in other words, if want place subview on top of window, how achieve it?? also appreciate if can explanation nsrect , frame nswindow objects.. if there methods in of apis, please direct me them.. in advance... update: @interface viewavailableitemswindowcontroller : nsobject { iboutlet nswindow * viewavailableitemswindow; //window in question iboutlet nsview * viewavailableitemsview; //view in question itemsearchviewcontroller * instanceitemsearchview; //viewcontroller object } @end @implementation viewavailableitemswindowcontroller -(void)awakefromnib{ [viewavailableitemswindow makekeyandorderfront:nil]; instanceitemsearchview = [[itemsearchviewcontroller alloc]initwithnibname:@"itemsearchview...

vb.net - Select all messages but not if the subject id is the same -

i trying select messages written from_id display latest message same subject id. example messaging table looks this: id from_id to_id subject subject_id date [content] percentage each message created unique id, if message in same message chain i.e. follow on message subject id same message id. have code select current user that's logged in : dim query = p in db.messages select p p.from_id = userid but unsure how group newest message same subject id. in advanced. i'm not visual basic expert, can use group by group returned messages subjectid , select latest message each of groups using select . syntax looks this: dim q = p in db.messaes p.from_id = userid group subject = p.subject_id messages = group select ... the ... bit needs replaced subquery returns latest message messages in current group (available in messages ).

c# - MVC3 - AJAX Partial View is being cached...and I can't stop it -

i'm using mvc3 - have javascript function uses jquery get() partialview controller. the problem it's being cached , keep getting stale content back. i've tried [outputcache(duration=0)] on action, thinking prevent caching, no joy. client caching too? edit: i've been using way prevent caching may useful some. $.get("/someurl?_="+$.now(),function(data) { // process data }); it's not clean, because each request passes _=12345678 (timestamp) it's never cached. hope helps. get requests automatically cached browser use .ajax() function contrary .get() function allows disabled caching: $.ajax({ url: '/foo', type: 'get', cache: 'false', success: function(result) { } }); another possibility use post: $.post('/foo', function(result) { });

java - Installing Java3D on Eclipse -

sorry in advance if bad question, can't seem find recent enough tutorial on how install java3d on eclipse 3.6.0 mac osx 10.6.6. if knows tutorial is, or if can give me instructions, please so. thanks! to add jar's specific project's classpath : right-click (or cmd-click on mac?) project in project explorer view , choose properties > java build path > libraries . add folder "\system\library\java\extensions" clicking "add external class folder..." button edit: i suggest following, given that you have jdk (version 1.5.0 or higher) installed you have eclipse java or java ee developers installed (not eclipse classic example) you can build vanilla, helloworld java application already basically, sounds might not have added java 3d api's jre. download linked in original question contains file named readme-unzip.html, obtained following instructions from: download java3d-1_5_1-xxx.zip temporary directory, example, ...

css - Is there a way to incude style in a php session? -

i have menu scrolls down , let select color want background, 1 page, there way include style of page near beginning of session go pages? are using php session @ moment? call change colour of background should set session variable. pages being displayed should check session see if variable present. have @ http://www.php.net/manual/en/session.examples.basic.php

c# - How do I get all controls of a form in Windows Forms? -

i have form named a . a contains lots of different controls, including main groupbox . groupbox contains lots of tables , others groupbox es. want find control has e.g. tab index 9 in form a , don't know groupbox contains control. how can this? with recursion... public static ienumerable<t> descendants<t>( control control ) t : class { foreach (control child in control.controls) { t childoft = child t; if (childoft != null) { yield return (t)childoft; } if (child.haschildren) { foreach (t descendant in descendants<t>(child)) { yield return descendant; } } } } you can use above function like: var checkbox = (from c in myform.descendants<checkbox>() c.tabindex == 9 select c).firstordefault(); that first checkbox anywhere within form has tabindex of 9. can use whatever criteria want. if aren't f...

attributes - jquery .attr('alt','logo').css('display','none') not working ! -

i have 3 following lines , first 2 line gets images on document , hides all, when add third line shows images. what need hide images attribute alt=minimize , alt=maximize reason hides images. $('img').attr('alt', 'minimize').css("display","none"); $('img').attr('alt', 'maximize').css("display","none"); $('img').attr('alt', 'logo').css("display","inline"); i using ie7, should compatible ie6 , ie8. any appreciated. thanks. i'm thinking not using attr function correctly, might looking attribute equals selector? : $('img[alt=minimize]').css("display","none"); what did code was, select images change alt attribute 'minimize' hide them select images change alt attribute 'maximize' hide them select images change alt attribute 'logo' hide them

android - Using the custom enum attributes values -

in application i'm using following custom attribute custom view: <attr name="direction"> <enum name="up" value="1" /> <enum name="down" value="2" /> </attr> the thing in custom view must compare current direction possible ones. there way access values & down attributes? thanks lot, gratzi i have stumbled upon attributeset class . should retrieve data compiled xml files.

c# - How to get this XmlAttribute -

from musicbrainz rest service, following xml: <artist-list offset="0" count="59"> <artist type="person" id="xxxxx" ext:score="100"> ... using wcf , xmlserializationformat, i'm able type , id attributes... how "ext:score" one? this works: public class artist { [xmlattribute("id")] public string id { get; set; } [xmlattribute("type")] public artisttype type { get; set; } but doesnt: [xmlattribute("ext:score")] public string score { get; set; } it produces serialization exception. i've tried using "score", doesn't work. any help? the attribute named "score", , in namespace referenced "ext", presumably xml namespace alias. so find "ext" maps (look xmlns), , add: [xmlattribute("score", namespace="http://example.org/ext-9.1#")] public string score { get; set; } ...

html - jQuery cleanup task -

so may little tricky, take @ div below. need jquery code going go through div, , delete rows or cells contain textbox or dropdown, or kind of input field, without data in it, or blank choice ("" or " "). need delete corresponding label, example in case <td> account number </td> <td> <%= html.textboxfor(m => m.stpdata.borroweraccountnumber, new { @class = "economictextbox", propertyname = "stpdata.borroweraccountnumber", onchange = "this.value = converttopasswordcharacters(this.value, '*', 4);updatefield(this);" }) %> </td> if above textbox didn't have data in it, wouldn't want see cell contained text 'account number' either. ideas? know tricky, might need jquery expert here. <table cellpadding="4" cellspacing="0"> <tbody><tr id="tr5"> <td style="text-align: right;"> ...