Posts

Showing posts from July, 2010

sql server - Prevent ADO.NET from using sp_executesql -

in our sql server 2005 database (tested using management studio dbcc freeproccache , dbcc dropcleanbuffers ), following statement fast (~0.2s compile time, ~0.1s execution time): select ... ... = 1 , b = '' ... the following statement, however, slow (~0.2s compile time, 7-11s execution time): exec sp_executesql n'select ... ... = @a , b = @b ...', n'@a int, @b nvarchar(4000), ...', @a=1, @b=n'', ... sql server chooses different execution plan, although queries equal. makes sense, since, in first case, sql server has actual values of a , b , other parameters available , can use statistics create better plan. apparently, query plan concrete values of parameters much better generic 1 , outweighs "query plan caching" performance benefit. now question: ado.net seems use second option (sp_executesql) when executing parameterized queries, usually makes sense (query plan caching, etc.). in our case, however, kills performance. so, t...

ruby on rails - `/usr/bin/file -i SOME_FILE` returns different result when deployed to Phusion Passenger -

i'm using /usr/bin/file -i some_file detect whether contains non-ascii-and-utf characters. however, produces different result when application deployed apache+passenger. in 'script/console', above line gives: some_file: text/plain; charset=utf-8 in passenger, gives: some_file: regular file since pointing absolute path of 'file', strange. i'm guessing library used different in passenger. comments? if not right way detect text file's encoding, best approach(in ruby)? thank much. i'm guessing difference between versions of 'file' utility between development machine , server. have tried running them terminal of both machines?

Java - Reading input from a file. java.io.FilterInputStream.available(Unknown Source)? -

i haven't written java in years , went refresh memory simple 'read-from-file' example. here code.. import java.io.*; public class filereading { public static void main(string[] args) { file file = new file("c:\\file.txt"); fileinputstream fs = null; bufferedinputstream bs = null; datainputstream ds = null; try { fs = new fileinputstream(file); bs = new bufferedinputstream(bs); ds = new datainputstream(ds); while(ds.available()!= 0) { string readline = ds.readline(); system.out.println(readline); } ds.close(); bs.close(); fs.close(); } catch(filenotfoundexception e) { e.printstacktrace(); } catch(ioexception e) { e.printstacktrace(); } } } this compiles fine (although apparently d...

project server - Using PSI Filter objects from Python -

i'm working sharepoint , projectserver 2007 via psi python. i can't find documentation on how filter class ( microsoft.office.project.server.library ) objects work internally emulate behaviour in python. any ideas? take @ colby africa's blog post . also, msdn docs here . edit the generated filter xml. here filter returns data "lookuptables" table (list of lookup tables): <?xml version="1.0" encoding="utf-16"?> <filter xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" filtertablename="lookuptables" xmlns="http://microsoft.com/projectserver/filterschema.xsd"> <fields> <field tablename="" fieldname="lt_uid" /> <field tablename="" fieldname="lt_name" /> <field tablename="" fieldname="lt_sort_order_enum" /> <field tablename...

Web parts in SharePoint -

i wonder if there's limit in sharepoint number of webparts can have in page. also, if web part zone has kind of limit, or if page can have number of web part zones. there no limits far can tell on sharepoint or asp.net side of things. of course, you'll limits of can fit in page (horizontally or vertically), matter.

ruby on rails - Acts_as_taggable_on link_to -

i installed acts taggable on plugin 'post' model, i'm unable call list of posts tagged tag. here's have in show. <%= link_to tag.name, posts_path(:view =>'tag', :tag => tag.name) %><% end %> except when click on it, shows posts. want show posts tagged keyword...what doing wrong here? thanks help modify controller code reads like: @posts = post.tagged_with(params[:tag], :on => 'tags')

java - Can I trigger an IceFaces action using JavaScript? -

if have simple button: <ice:panelgroup> <ice:commandbutton value="foobar" action="#{filemanager.opennoflashvisiblepopup}" /> </ice:panelgroup> is possible trigger action opennoflashvisiblepopup using javascript? know there icefaces has javascript bridge don't know see simple way this. i need because have chunk of javascript detects flash , need show icefaces popup. one way button element id , call click() function. document.getelementbyid('clientid').click(); you need give form , button fixed id can use generated html id clientid in javascript code.

sql - Can I Comma Delimit Multiple Rows Into One Column? -

this question has answer here: concatenate many rows single text string? 38 answers i attempting merge in sql server database: [ticketid], [person] t0001 alice t0001 bob t0002 catherine t0002 doug t0003 elaine into this: [ticketid], [people] t0001 alice, bob t0002 catherine, doug t0003 elaine i need in both sql server , oracle. i have found function group_concat mysql need here, mysql not option here. edit: test bench: declare @tickets table ( [ticketid] char(5) not null, [person] nvarchar(15) not null ) insert @tickets values ('t0001', 'alice'), ('t0001', 'bob'), ('t0002', 'catherine'), ('t0002', 'doug'), ('t0003', 'elaine') select * @tickets here solution works in sql server 20...

inheritance - C++: Declaring pointer to base and derived classes -

i found confused 1 basic question in c++ class base { }; class derived : public base { } base *ptr = new derived(); what mean? ptr pointing base class or derived class? @ line, how many memory allocated ptr? based on size of derived or base? what's difference between , follows: base *ptr = new base(); derived *ptr = new derived(); is there case this? derived *ptr = new base(); thanks! to understand type system of c++, important understand difference between static types , dynamic types. in example, defined types base , derived , variable ptr has static type of base * . now when call new derived() , pointer static , dynamic type of derived * . since derived subtype of base can implicitly converted static type of base * , assigned ptr static types match. dynamic type remains derived * however, important if call virtual function of base via ptr , calling virtual functions based on dynamic type of object, not static type.

php - do things with the return value of smarty function? -

we have smarty function returns html code templates. possible function returns null string, wish identify. our system has been running stably years, looking least invasive possible solution. is possible assign return value smarty variable? have tried assigning javascript variable, however, because part of html user generated, return string mixture of double , single quotes, causes problems in ie (unfortunately majority of our user base). <script type="text/javascript"> var html = '{smarty function}'; //ie chokes on mixed quotes </script> any appreciated! use escape modifier, example: {$variable|escape:'quotes'} for smarty function, can first try if {smarty_function|escape:'quotes'} works, if doesn't have assign output of function variable first before escaping it, , use capture : {capture name=mycapture}{smarty_function}{/capture} {$smarty.capture.mycapture|escape:'quotes'}

c# - using local variable in another button -

there's error: "the type being set not compatible value representation of tag." string fi = null; public void reading(object sender, eventargs e) { read_from_folder = folderbrowserdialog1.showdialog(); if (read_from_folder == dialogresult.ok) { files_in_folder = directory.getfiles(folderbrowserdialog1.selectedpath); foreach (string fi files_in_folder) { string fi_nam = filese_in_folder.tostring(); ... } } } private void button1_click(object sender, eventargs e) { dicomdirectory cop = new dicomdirectory(fi); cop.load(fi); } i agree frederik, local fi hides class-level member. isn't clear expect in variable in button click handler. because you're looping, if use class member fi , you'll have last file referenced. doesn't make sense. if searching matc...

MySQL for persistence for SharePoint (WSS) -

this question has been asked many times in many forums haven't seen confident conclusive answer. i'll try luck again. i want know whether , how possible use mysql persistence node (configuration , content) sharepoint. of now, interested know wss (i guess same apply moss well). basically should able define lists, document libraries , content lives in mysql. my front end pure asp.net , use wss apis. the answer " no ". when install wss, ask microsoft sql server , not allow choose other kinds of sql servers. wss/moss depends on hundreds of inter-related stored procedures living in microsoft sql server, these quite technology specific , use microsoft sql- solutions in there. however, if not want pay mssql server, can install wss/moss on microsoft sql express edition , works fine, except have size limit of 4gb.

iphone - Inserted date of record in sqlite3 database? -

i inserted record in sqlite3 database. want know date on table inserted in database. sqlite3 not store change dates automatically, if want them later should insert date database yourself.

html - How to center the following menu? -

i've got following inside div. i'd center menu elements. appear so... | home | blog | | contact | i'd center like... | home | blog | | contact | here's css, need change? ul#menu { margin:0; padding:0; list-style-type:none; width:auto; position:relative; display:block; height:30px; font-size:12px; font-weight:bold; background:transparent url(images/nav_bg.png) repeat-x top left; font-family:arial, helvetica, sans-serif; border-bottom:1px solid #000000; border-top:1px solid #000000; } ul#menu li { display:block; float:left; margin:0; padding:0; } ul#menu li { display:block; float:left; color:#999999; text-decoration:none; font-weight:bold; padding:8px 20px 0 20px; } ul#menu li a:hover { color:#ffffff; height:22px; background:transparent url(images/nav_bg.png) 0px -30px no-repeat; } ul#menu li a.current { display:inline; height:22px; background:transparent url(im...

ajax - How to create an AJAXified form within the Zend Framework -

i'm trying create contact form. @ top of form user can select using radio buttons whether he's contacting technical department or marketing department. depending on selects, entire form changes. how implemented within zend framework? i'm extending zend_form make forms. i'm working within mvc style , rather not break out of it. right echo $this->form; in view render form. i'm guessing when visitor clicks on 1 of radio buttons, controller need set different form, i'm not sure how go without re-rendering entire page. thanks! edit i'm thinking setting in controller: $this->view->contactformtechdep = $formtechdep; $this->view->contactformmarketingdep = $formmarketingdep; and render both, hiding 1 using javascript. i think need show/hide content of form javascript, not php. (with jquery can easyli done) but you'll have keep in mind unobtrusive users without javascript enabled

cocoa - Access Text Boxes (in a Keynote slide) in AppleScript -

need figure out how access text boxes inside slide in keynote applescript. tried use asdictionary couldn't find resemble text box object. fear not scriptable in keynote, perhaps can access them through applescript cocoa bridge? thoughts? thanks! if (and if) keynote doesn't provide access objects on slide via applescript, should 2 things: file enhancement request @ https://bugreport.apple.com/ . try examining keynote document directly parsing xml. keynote's xml document format not documented, far know, @ least can access it. have careful format changing out under you.

javascript - How to Remove last Comma? -

this code generates comma separated string provide list of ids query string of page, there comma @ end of string. how can remove or avoid comma? <script type="text/javascript"> $(document).ready(function() { $('td.title_listing :checkbox').change(function() { $('#cbselectall').attr('checked', false); }); }); function cotactselected() { var n = $("td.title_listing input:checked"); alert(n.length); var s = ""; n.each(function() { s += $(this).val() + ","; }); window.location = "/d_contactseller.aspx?property=" + s; alert(s); } </script> use array.join var s = ""; n.each(function() { s += $(this).val() + ","; }); becomes: var = []; n.each(function() { a.push($(this).val()); }); var s = a.join(', ');

forms - What characters are allowed in an email address? -

i'm not asking full email validation. i want know allowed characters in user-name , server parts of email address. may oversimplified, maybe email adresses can take other forms, don't care. i'm asking simple form: user-name@server (e.g. wild.wezyr@best-server-ever.com) , allowed characters in both parts. see rfc 5322: internet message format and, lesser extent, rfc 5321: simple mail transfer protocol . rfc 822 covers email addresses, deals structure: addr-spec = local-part "@" domain ; global address local-part = word *("." word) ; uninterpreted ; case-preserved domain = sub-domain *("." sub-domain) sub-domain = domain-ref / domain-literal domain-ref = atom ; symbolic reference and usual, wikipedia has decent article on email addresses : the local-part of email address may use of these ascii ...

lazy evaluation - Why isn't promise a data type in Scheme? -

the object returned delay in scheme "a promise", promises not considered type (so there no promise? procedure, , it's not listed type in r5rs or r6rs). is there strong reson why so? seem quite natural me (if (promise? x) (force x) x) , example. (and see implementations let me force non-promises, , others not). also, if can store in variale , pass around, feel should have type. there can't strong reason, since mit/gnu scheme , defines promise? function.

How can I integrate svn with the Visual studio 2008? -

how can integrate svn visual studio 2008 ? which better svn plugin/client visual studio ? http://ankhsvn.open.collab.net/ visual studio plugin svn. prefer not plugin directly, rather use svn separately or using turtoisesvn ( http://tortoisesvn.tigris.org/ ) integrates explorer, that's personal taste guess.

sql - Oracle/PHP syntax to grab and later store a timestamp value in a date field -

there composite primary key stored in db consists of date field , foreign key id. create duplicates date field (although displays day, month, year appears have timestamp information stored well) my question how extract timestamp information (i think using to_char field) , more importantly, how can later insert record , store date , timestamp. right can store date not sure syntax need use add time date field insert can consistent values pull table select. the oracle date data type includes time portion. to date date column using to_char : to_char(date_column, 'dd-mm-yyyy') ...not sure syntax need use add time date field insert can consistent values pull table select. to specify time portion existing date, use combination of to_date , to_char: to_date(to_char(date_column, 'dd-mm-yyyy') || ' 23:59:00', 'dd-mon-yyyy hh24:mi:ss') ...changing 23:59:00 whatever time want. double pipe (||) oracle uses string concatenation (it...

php - submitting a hyperlink by GET or POST -

so there's hyperlink - it's happy being hyperlink - not want change button or form element - wants stay link! but me if submit via or post (something switch on pages due design criteria). there way can this thanks giles you're in luck... clicking hyperlink request. if want add query parameters, append them query string so: <a href="/my/page/foo.php?onions=no&pickles=yes">link text</a>

java - LinkedHashMap<String,Object>.clone(); -

does above command produce deep copy of linkedhashmap's elements? in java, clone() shallow. 2 reasons: performance not every object defines working clone() method, deep copying isn't possible.

select - cfselect problem -

i theory seems answer pre populated selectbox issue. <cfselect name = "regions" query = "getregions" selected="10" value="id" display="name" ></cfselect> this outouts <option value="8">dumfries & galloway</option> <option value="9">dundee city</option> <option value="10" selected="selected">east ayrshire</option> <option value="11">east dunbartonshire</option> but option 10 not selected automatically. html looks ok reason why? thanks, r. if using firefox reason, because keeps form values persistent across page reloads. can use different browser, or add query string ?abc=123 .

Strategy and Flyweight patterns -

i've read "strategy objects make flyweights" (from design patterns elements of reusable object-oriented software ), , i'm wondering how can implemented. didn't find example in internet. is code (c#) below right, following idea? thanks! using system; using system.collections.generic; namespace strategyflyweight { class program { static void main(string[] args) { client client = new client(); for(int = 1; <= 10;i++) { client.execute(i); } console.readkey(); } } public interface istrategy { void check(int number); } public class concretestrategyeven : istrategy { public void check(int number) { console.writeline("{0} number...", number); } } public class concretestrategyodd : istrategy { public void check(int number) { console.w...

iphone - How to make a zone where user can tap to do a specify action)? -

Image
how make zone user can tap specify action)? same below picture: please me! put transparent uibutton in zone.

tortoisesvn - How to move an SVN repository to a new server -

we merge 2 of our servers , in order need install svn on "new" server , move on of our repositories have set on our "old" server. is easy operation do? possibly using "relocate" option tortoisesvn provides? best way it? would time re-organize how repository set well? you can migrate repository using svnadmin dump function. on svn server, type svnadmin dump /absolute/path/to/the/repo > /tmp/repo.svndump . export entire repository text file in system's temporary directory , name "repo.svndump". might want compress file before transferring new server. once have repo exported, can transfer dump file new server , import so: svnadmin load /absolute/path/to/the/**new**/repo < repo.svndump . see ' svnadmin dump ' , ' svnadmin load ' more information. after dumping repository , loading on new server use --relocate command switch local copy new server. caution: if repositories use externals have proble...

ruby on rails - Haml: How to add classes dynamically to an element? -

i have <tr> element in view, , want add classes dynamically on element depending on association between 2 models (many many between company , packaging). the result should looks <tr class="pck1 pck3 pck5"> where pck1 , pck3 , pck5 packagings associated company. or simply: %tr{ :class => classes }

java - Why would a Spring login form not reveal any error information for a failed login? -

my spring mvc app not allowing logins , can't figure out why. i've added logging login controller nothing being outputted there. the login page seems automatically redirect error page without going through login controller. any ideas how debug problem? <http auto-config="false" access-decision-manager-ref="accessdecisionmanager" use-expressions="true"> <intercept-url pattern="/login/**" access="hasrole('role_anonymous')" requires-channel="${application.securechannel}" /> <intercept-url pattern="/error/**" access="hasrole('role_anonymous')" requires-channel="http" /> <intercept-url pattern="/register/**" access="hasrole('role_anonymous')" requires-channel="${application.securechannel}" /> <intercept-url pattern="/" access="hasrole('role_anonymous')" requir...

java - Log4j DailyRollingFileAppender concurrency with multiple processes -

i have number of identical processes writing single log file using log4j dailyrollingfileappender . concerned multiple processes may try , roll file , chaos ensue. implementation allow using kind of locking mechanism? - javadoc doesn't mention it. it not advisible let multiple processes access same log file. mayhem occur

mysql - should the following sql query data normalization work? -

create table if not exists `mydb`.`matches` ( `idmatch` int not null , `idchampionship` int not null , `idwinningteam` int not null , `idwloosingteam` int not null , `date` timestamp null default null , `goalswinningteam` int null default -1 , `goalsloosingteam` int null default -1 , `played` char null default 'y' , primary key (`idmatch`) , index `id_team_x_champ` (`idmatch` asc) , constraint `id_team_x_champ` foreign key (`idchampionship` , `idmatch` ) references `mydb`.`teams_per_championship` (`idchampionship` , `idteam` ) on delete no action on update no action) engine = innodb; i'm trying make matches table , i'm not sure how set winning , losing team, both idteam (can use same foreign key both?) have team table championship table , teams_per_champsionship table (for indexing). schema available thanks much an example schema: team table ---------- teamid pk rest of team information champi...

Find time difference in minutes with php or mysql -

i have 2 data inputs can enter start time , finish time. for example start_time 13:00 finish_time 14:40 the entry format of hh:mm. i'd find time difference, in case 100 minutes. what best way it? you use diff within datetime . #!/usr/bin/env php <?php $datetime1 = new datetime('13:00'); $datetime2 = new datetime('14:40'); $interval = $datetime1->diff($datetime2); $hours = $interval->format('%h'); $minutes = $interval->format('%i'); echo $hours * 60 + $minutes; ?>

c# - DeviceIoControl returning false -

in c# code,deviceiocontrol returning false,the handle correct deviceiocontrol(devicehandle, ioctl_storage_get_device_number, intptr.zero, 0, outbuffptr,//&psdn, outbuffsize, ref dwbytesreturned, intptr.zero); there not lot of data here go on, marshal.getlastwin32error() should give more specific error information.

c# - DateTime: how to display as DD.MM.YYYY? -

i've got datetime variable , want convert string "dd.mm.yyyy" please note, values must separated "dot" sign. of course can manual string composition. wonder if can use datetime.tostring() required conversion. yes, can: string formatted = dt.tostring("dd'.'mm'.'yyyy"); now in case quotes aren't required, custom date/time format strings don't interpret dot in special way. however, make explicit - if change '.' ':' example, while it's quoted stay explicit character, unquoted "the culture-specific time separator". wasn't entirely obvious me whether "." interpreted "the culture-specific decimal separator" or not, hence quoting. may feel that's on top, of course - it's entirely decision. you may want specify invariant culture, remove other traces of doubt: string formatted = dt.tostring("dd'.'mm'.'yyyy", cultureinfo.invari...

internet explorer 7 - :hover pseudo-class of CSS does not work in IE7 -

i have problem :hover pseudo-class of css. i using tr.lightrow:hover { color:red } it works in safari , firefox not work in ie7. please me. ie7 supports :hover, @ least in standards mode. may not in quirks mode.

cakephp validation response returning data to controller -

hi have made custom validation in model. how can access result($visitor) in controller? model: <?php class visitors extends appmodel { var $name = 'visitors'; var $validate = array( 'xxx' => array( 'rule' => array('checkxxx'), 'message' => 'yyy.' ) ); function checkixxx($check){ $visitor = $this->find('first', array('conditions' => $check)); return $visitor; } } ?> in controller want this: function start() { $this->visitors->set($this->data); if($this->visitors->validates()) { if($this->visitors->xxx->type == 'value') //this value $visitor array in model** { //do } } is possible? updated relevant answer, apologies. //model var myfield = 'invalid'; function myvalida...

c++ - How do I mmap a _particular_ region in memory? -

i have program. want able mmap particular region of memory on different runs. i have source code of program. c/c++ i control how program compiled. gcc i control how program linked. gcc i control how program run (linux). i want have particular region of memory, 0xabcdabcd 0xdeadbeef mmap particular file. there anyway guarantee this? (i have somehow make sure other things aren't loaded particular region). edit: how make sure nothing else takes particular region in memory? you cannot make sure nothing else takes area of memory - first come, first served. however, need particular part of memory, i'm guessing have pretty specialized environment, need make sure first (using start scripts)

linked list - Handling player on turn with Objective C -

i'm creating simple app has list of characters , list of (4) players, players reference playable character. i'm stuck on how following: make reference current player on turn find out next player on turn is handling last player return first player on turn. ideally, able after, first, last before commands on nsmutablearray, of these i'm able lastobject, there no firstobject, afterobject, etc. i believe can fake before,after,first commands objectatindex; ideally not want rely on numeric references because incorrect -- if mutable, size change. typically, able following in pseudocode. global player_on_turn.player = null //player_on_turn pointer player object ; handle next player on turn if (player_on_turn.player = null) error("no player on turn assigned") if (sizeof[playerlist]==0) error("there no players in game") if after player_on_turn = null ; reset player_on_turn.player = first player else ; move next player on turn player_on...

air - Exporting MXML using Flex -

i've been having trouble exporting adobe flex using adobe air. can't find runnable application air, , when export opened in air can't opened. i'm on mac powerbook g4 running os 10.5.8. help? if using export release build feature in flex builder ask want create .air file at. .air file installer. can use air install badge (see tour de flex example) create web page installer air app.

javascript - Google Maps API v3 - IP-based Geolocation -

has been able geo-location based on person's ip work using google maps api v3 javascript? it seems me google provided example doesn't work. http://gmaps-samples-v3.googlecode.com/svn/trunk/commonloader/clientlocation.html question : does example work anyone? how geolocation based on person's ip work using google maps api v3? q1: works here, , many other locations. note geolocation ip addresses not reliable science. getting location of isp, can quite far away, , in addition ip-to-location databases aren't date latest changes, might not have data particular ip address -- happening in case. maxmind, offers popular ip-to-location database published statistics on database: geoip city accuracy selected countries q2: way geolocation ip address through google maps api v3 using same method used in example provided . if find other geolocation database, maxmind geolite city , more accurate country, may want geolocation ip addresses yourself, inste...

web services - Error Handling in Python with SUDS -

i have been trying control camera through wsdl file using suds. have got code working want place error handling script. have tried different exceptions unable script working. when enter invalid coordinate error. code using below followed error recieving. #!/home/build/python-2.6.4/python import suds suds.client import client #################################################################### # # python suds script controls movement of camera # #################################################################### # # absolute move function # #################################################################### def absolutemove(): # connects wsdl file , stores location in variable 'client' client = client('http://file.wsdl') # create 'token' object pass argument using 'factory' namespace token = client.factory.create('ns4:referencetoken') print token # create 'dest' object pass argumen...

PCRE regex to sed regex -

first of sorry bad english. i'm german guy. the code given below working fine in php: $string = preg_replace('/href="(.*?)(\.|\,)"/i','href="$1"',$string); now t need same sed . thought should be: sed 's/href="(.*?)(\.|\,)"/href="{$\1}"/g' test.htm but gives me error: sed: -e expression #1, char 36: invalid reference \1 on `s' command's rhs sed -e 's|href=\"\(.[^"][^>]*\)\([.,]\)\">|href="\1">|g' file

c# - Adding rows to a table based on user input (ASP.NEt) -

i have textbox entry field user enter integer value. , there "create" button, when clicked upon must generate table 2 columns : "name" , "email" being column headers. i want each row have textbox in each of these columns. all of has happen after button clicked. have discovered if dynamically add control in asp.net(i using c#) controls lost during postback. , don't know how prevent happening. can please give me ideas regarding how go adding rows dynamically table (i tried using asp.net server side table control ran "lost-during-postback" problem - can try else gridview ? afaik gv not work without data bound ) point note table has textboxes user entry , not showing data ..rather accepting data user later used persist details database. dynamic controls that's involved. here's interesting article on issue of dynamic controls. i think if create dynamic controls you're responsible recreating them on postback; a...

coding style - Why do most fields (class members) in Android tutorial start with `m`? -

i know camel case rules, i'm confused m rule. stand for? i'm php developer. "we" use first letters of variables indication of type, 'b' boolean, 'i' integer , on. is 'm' java thing? stand mobile? mixed? this notation comes aosp (android open source project) code style guidelines contributors : follow field naming conventions non-public, non-static field names start m. static field names start s. other fields start lower case letter. public static final fields (constants) all_caps_with_underscores. note linked style guide code contributed android open source project. it not style guide code of individual android apps.

java - ActionMismatch while using web service -

i'm trying connect , use web service method. i'm getting following error: the soap action specified on message, '', not match http soap action, 'http://tempuri.org/xpto/foobar'. in fact, code says this: _state.getmessagecontext().setproperty("http.soap.action", "http://yadayadayada"); but doesn't state message. the wsdl states this: <wsdl:input wsaw:action="http://tempuri.org/foo/bar" message="tns:xpto"/> this question has been solved. had alter code auto generated wsdl2java. in stub class, auto generated code looks this; (...) org.apache.axis.client.call _call = createcall(); _call.setoperation(_operations[11]); _call.setusesoapaction(true); _call.setsoapactionuri("http://tempuri.org/foo/bar"); _call.setencodingstyle(null); _call.setproperty(org.apache.axis.client.call.send_type_attr, boolean.false); _call.setproperty(org.apache.axis...

php - Passing parameters to PHPUnit -

i'm starting write phpunit tests , i'd tests run developers machines our servers. developers machines set differently servers , differently each other. to run in these different places seems person runs test going have indicate it's being run. test can proper config of machine it's running on. i'm imagining like: phpunit.bat -x johns_laptop unittest.php or on alpha server: phpunit -x alpha unittest.php in test able value if 'x' (or whatever is) parameter , know, example, path app root machine. it doesn't command line allows - or have missed something? one way inspect $argv , $argc. like: <?php require_once 'phpunit/framework/testcase.php'; class environmenttest extends phpunit_framework_testcase { public function testhasparam() { global $argv, $argc; $this->assertgreaterthan(2, $argc, 'no environment name passed'); $environment = $argv[2]; } } the...

php - Naming cookies - best practices -

what should cookie names like? should be: lower_case camelcase underscore_camel_case upper_case or should else? appname_meaningfulname

sql server 2005 - How should I modify this SQL statement? -

my sql server view select geo.hyperlinks.catid, geo.tags.tag, geo.hyperlinks.hyperlinksid geo.hyperlinks left outer join geo.tags inner join geo.tagslist on geo.tags.tagid = geo.tagslist.tagid on geo.hyperlinks.hyperlinksid = geo.tagslist.hyperlinksid hyperlinksid = 1 returns these... hyperlinksid catid tags 1 2 sport 1 2 tennis 1 2 golf how should modify above have results like hyperlinksid catid tagsinonerowseperatedwithspacecharacter 1 2 sport tennis golf update: brad suggested came here... declare @taglist varchar(100) select @taglist = coalesce(@taglist + ', ', '') + cast(tagid nvarchar(100)) tagslist hyperlinksid = 1 select @taglist now result looks hyperlinksid catid tagsinonerowseperatedwithspacecharacter 1 2 id_of_sport id_of_tennis id_of_golf and of course have combine contents from the @taglist variable , original select statement.....

get all the URLs in a web site using javascript -

any 1 knows way urls in website using javascript?i need links starting same domain name.no need consider other links well same-host links on page : var urls= []; (var i= document.links.length; i-->0;) if (document.links[i].hostname===location.hostname) urls.push(document.links[i].href); if site mean want recursively links inside linked pages, that's bit trickier. you'd have download each link new document (for example in <iframe> ), , onload check iframe's own document more links add list fetch. you'd need keep lookup of urls you'd spidered avoid fetching same document twice. wouldn't fast.

What's the best way to implement a fulltext search for an ASP.NET MVC application? -

i've built asp.net mvc application mvc 2.0 , fluent nhibernate (hided behind repositories reasons). application represents quite complex domain different objects users, messages, comments, files , appointments. now want implement fulltext search enabling user find types of content entering search phrase. when handling types of different objects in application seperately, have put them "together" search. means user makes no distinction between different types, enters "xyz" , wants results in list, comments mixed messages etc. option 1 create search service fetches search result different repositories , prepares combined output (sorting, paging etc.). that's really, expensive when data behind grows (and grow). so looking alternative solution. working sql server 2008. have found lucene.net (http://lucene.apache.org/lucene.net/), didn't invest time yet. any suggestions? i'd go sql fulltext capabilities. understand of content might av...

xpcom - Firefox Popup window event -

i writing firefox extension using xpcom c++. i want notified when popup window (like see while browsing www.rediffmail.com) opening. how catch event? knows how it? thanks help. "like see while browsing www.rediffmail.com" poor definition, i'm going assume you're talking regular popup windows (with title bar, etc), not javascript-implemented in-tab dialog, , not new pages open in new tabs. there notifications fired when new windows open (or overlay firefox's browser.xul inject code). there's popupwindow dom event , not documented, far can see.

javascript - Enter key in textarea -

i have textarea , on every enter key pressed in textarea want new line started bullet (*). how go ? no jquery please. i can observe enter key , after !? should have whole value of textarea , append * , again fill textarea ? you this: <body> <textarea id="txtarea" onkeypress="ontestchange();"></textarea> <script> function ontestchange() { var key = window.event.keycode; // if user has pressed enter if (key === 13) { document.getelementbyid("txtarea").value = document.getelementbyid("txtarea").value + "\n*"; return false; } else { return true; } } </script> </body> although new line character feed pressing enter still there, start getting want.

.net - How to configure a single WCF Service to have multiple HTTP and HTTPS endpoints? -

what trying single wcf service work in development environment http scheme, and, also, have same service work in production environment https scheme. if remove 2 https endpoints (those suffixed 'https'), works in development enviornment; likewise, if remove 2 http endpoints works in production environment. have 4 endpoints in web.config, if possible. my endpoints defined below: <endpoint address="/web" behaviorconfiguration="ajaxbehavior" binding="wshttpbinding" bindingconfiguration="web" name="web" contract="service" /> <endpoint address="/custom" binding="custombinding" bindingconfiguration="custom" name="custom" contract="service" /> <endpoint address="/webhttps" behaviorconfiguration="ajaxbehavior" binding="wshttpb...

c# - Create object of parameter type -

hey. possible have method allows user pass in parameter of type , have method instantiate new object of type? this: (i don't know if generics way go, gave shot) public void loaddata<t>(t, string id, string value) t : new() { this.item.add(new t() { id=id, val = value}); } the above doesn't work, idea user passes object type want instantiate , method fill in details based on parameters. pass enum parameter , switch , create new objects based on that, there better way? thanks the way add interface specifies parameters want set: public interface isettable { string id { get; set; } string val { get; set; } } public void loaddata<t>(string id, string value) t : isettable, new() { this.item.add(new t { id = id, val = value }); } unfortunately can't test verify @ moment.

c# - How to drawn my own progressbar on winforms? -

yoyo experts! have several progressbars on windowsform (not wpf), , use different colors each one. how can this? i've googled , , found have create own control. have no clue , how this. idea? example progressbar1 green, progressbar2 red. edit: ohh, solve this, without removing application.enablevisualstyles(); line, because screw form looking :/ yes, create own. rough draft 80% there, embellish needed: using system; using system.drawing; using system.windows.forms; class myprogressbar : control { public myprogressbar() { this.setstyle(controlstyles.resizeredraw, true); this.setstyle(controlstyles.selectable, false); maximum = 100; this.forecolor = color.red; this.backcolor = color.white; } public decimal minimum { get; set; } // fix: call invalidate in setter public decimal maximum { get; set; } // fix above private decimal mvalue; public decimal value { { return mvalue; } set { mv...

objective c - mutableCopy memory leak -

can shed light why use of mutablecopy leaking memory? - (id)objectinlistatindex:(unsigned)theindex { nssortdescriptor *descriptor = [[[nssortdescriptor alloc] initwithkey:@"notenumber" ascending:yes] autorelease]; [list sortusingdescriptors:[nsarray arraywithobjects:descriptor,nil]]; nsmutablearray *thearray = [list mutablecopy]; nsdictionary *thedict = [thearray objectatindex:theindex]; return thedict; } because mutablecopy returns retained object, , never release thearray . copy methods return retained object caller responsible releasing. detailed in api docs , memory management guide .

c - How does mprotect() work? -

i stracing of common commands in linux kernel, , saw mprotect() used lot many times. i'm wondering, deciding factor mprotect() uses find out memory address setting protection value for, in own address space? on architectures mmu 1 , address mprotect() takes argument virtual address. each process has own independent virtual address space, there's 2 possibilities: the requested address within process's own address range; or the requested address within kernel's address range (which mapped every process). mprotect() works internally altering flags attached vma 2 . first thing must vma corresponding address passed - if passed address within kernel's address range, there no vma, , search fail. same thing happens if try change protections on area of address space not mapped. you can see representation of vmas in process's address space examining /proc/<pid>/smaps or /proc/<pid>/maps . 1. memory management unit 2. virtual me...

Build system for a VISUAL STUDIO 2008' C++ project -

i'am developing rigid body simulation (physics) in workstation , need share project teachers university. problem workstations of teachers have different configurations path of libraries. how can externalize paths on vs2008 c++ project? one option have set environment variable libname_root points root of installation of library, , add paths $(libname_root)\include , $(libname_root)\lib project's compiler , linker settings, respectively.

delphi - FileAge is not working with "c:\pagefile.sys" -

does know why fileage not working "c:\pagefile.sys"? returns -1. update: found it: delphi bug fixed in delphi 2010 ( qc entry 73539 ), the pdf have found not explain how fix it. does know how fix can fix delphi 7? update: elegant fix provided radu barbu! delphi 7, win 7 (32 bits) try this: with variable of type tsearchrec (wsr bellow) load pagefile.sys wsr.finddata.ftlastwritetime - should return when file accessed and function bellow should time function filetime2datetime(filetime: tfiletime): tdatetime; var localfiletime : tfiletime; systemtime : tsystemtime; begin result := 0; try filetimetolocalfiletime(filetime, localfiletime); filetimetosystemtime(localfiletime, systemtime); result := systemtimetodatetime(systemtime); except on e: exception //some message if want end; end; best regards,

javascript - How to target a div<> with a link, using php? -

what's best way target particular <div> selection menu using php? specifically, want have link selected menu contained in div id=menu loaded in div id=content . i can see has been discussed in here, can't seem find clear answer. so, apologies if rehashing old topic, gather need use ajax this, or can done php only? there examples or tutorials available? thanks you'll need ajax , bit of magic. html <div id="menu"><a href="page.html">page 1</a> | <a href="page2.html">page 2</a></div> <div id="content"></div> javascript (with jquery) $("#menu a").each(function(e){ $(this).bind("click", function(event){ $("#content").load($(event.target).attr("href")); }); }); i haven't tested this, should work. want bind links within #menu , when 1 clucked load href #content via ajax call.

selenium - Looking to validate the presence of a hidden tag with the HTML source -

i'm looking validate (hidden) tag, nothing javascript, in webpage. tag present , visible, in page source. have used selenium's selenium.gethtmlsource(); command before. however, time around need assert presence of absence of tag, without unnecessarily having slice , dice source. any ideas? thanks. consider using jquery this. example like: if ($("#hidden_tag_id")) { ... } should it.

How do I display an alert dialog on Android? -

i want display dialog/popup window message user shows "are sure want delete entry?" 1 button says 'delete'. when delete touched, should delete entry, otherwise nothing. i have written click listener buttons, how invoke dialog or popup , functionality? you use alert builder this: alertdialog.builder builder; if (build.version.sdk_int >= build.version_codes.lollipop) { builder = new alertdialog.builder(context, android.r.style.theme_material_dialog_alert); } else { builder = new alertdialog.builder(context); } builder.settitle("delete entry") .setmessage("are sure want delete entry?") .setpositivebutton(android.r.string.yes, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { // continue delete } }) .setnegativebutton(android.r.string.no, new dialoginterface.onclicklistener() { public void onclick...

c# - How do I programmatically add NewLines to a TFS work item textbox? -

i have web system has few hooks our tfs work item system. 1 of things trying when action performed, takes current text in 1 field , makes comment in "general comments" field announcing field (yes know, history contains higher ups want in gen comments). the problem having tfs seems ignoring environment.newlines have in string. code: item.fields[gencomments].value = string.concat(datetime.now.toshortdatestring() , " - qa dashboard - required date reason set \"hotfix\", contained \"" , item.fields[reqbydtreason].value.tostring() , "\"." , environment.newline , environment.newline , environment.newline , item.fields[gencomments].value.tostring()); so assuming general comments section conta...

jar - What's the best way to manage dependencies with CounterClockwise/Eclipse? -

i have dependency on clj-record in counterclockwise project. what's best way manage this? copy source code or compile jar , add referenced library? there seems no pattern specifying dependencies apart hacking code project or building jar externally. of course can, java project. while dependency resolution isn't tied eclipse (yet), once retrieve deps (via 1 of command line tools nickik listed), can specify jars included in java build path of eclipse project: retrieve deps via cake, leiningen, etc. refresh eclipse project see deps (usually in lib directory) highlight jars want eclipse know about right-click, select build path > add build path that's it. can fiddle build path going java build path section of project's properties window.

c# - Return Tuple from EF select -

how can retrieve tuples @ select using ef4? var productcount = (from product in context.products select new tuple<product, int>(product, products.orders.count)); or var productcount = (from product in context.products select tuple.create(product, products.orders.count)); entity framework says cant use not empty constructor first case, , not recognize tuple.create method second. how switching linq-to-objects projection: var productcount = product in context.products select new {product = product, count = products.orders.count }; var final = item in productcount.asenumerable() select tuple.create(item.product, item.count);

What is the best way of searching through email via Zend? -

i have implemented 3 legged auth gmail using zend framework. wondering best way of finding emails once authenticated (for example mix of title regex, sender, date range) - efficient? thanks! i'd go indexing db , use search seem fit (where, like, fulltext).

domain driven design - DDD-friendly ASP.NET MVC Model Binder? -

i'm considering value of custom model binder can instatiate immutable value objects defined in domain layer. can pass them through stack , set them on appropriate entity. has tried? had luck? think silly idea? if "value objects" mean objects can created passing values constructor, not binding fields, think have these solutions: write custom binder - though can't tell how access several fields @ once in there. pass view model (that allows bind fields) , convert value object. write simple converter using reflection (couple of lines). you'll have relate view model properties , constructor parameters either name or type. can have view model define corresponding value type, , in action filter/onactionexecuting call converter - automatically. that's kind of semi-automatic model binding. pass formcollection action , call reflection method var value = bindvalue<valuetype>(formcollection).

excel - Sum or Count until? -

Image
i'm trying make compliance worksheet more efficient. have list of controls in sections (and sub-sections), , use value placeholder count number of controls per section (or sub-section), exceptions per section. use value "1" if there valid control, , sum these values per section or sub-section. i have add rows bottom of section, , throws sum-formula off, requiring manual updating these formulas. i utilize formula either "sum-until" or "count-until" next section. i've attached example. is there way sum (or count) until next formula or non-"1"-value? easier put "end" value @ bottom of each of these sections, , count until "end"? wouldn't ideal way perform such function (as there number of unnecessary "ends" between sections), if there's not better way, perhaps i'll explore avenue. use named range each section, when add row, add named range. so name range 'section1'...

jQuery and TinyMCE: textarea value doesn't submit -

i using jquery , tinymce submit form, there problem in serialization in textarea value doesn't post. here code: <form id="myform" method="post" action="post.php"> <textarea name="question_text" id="question_text" style="width:543px;height:250px;"></textarea> </form> language: lang-js $('#myform').submit(function() { $.ajax({ type: 'post', url: $(this).attr('action'), data: $(this).serialize(), success: function(data) { $('#result').fadein('slow'); $('#result').html(data); $('.loading').hide(); } }) return false; }); tinymce.init({ // general options mode : "textareas", theme : "advanced", // theme options theme_advanced_buttons1 : "bold,italic,underline,separator,image,separator,justifyleft,jus...