Posts

Showing posts from January, 2010

asp.net mvc - MVC3 : How to force empty field to update as 0 during UpdateModel -

update: part of reason question traced bad database design. had allowed myself talked design in turn led poor choices ui design. decided go , refactor db design, removed problem on ui. therefore, question moot , won't accepting answer. can't delete question because there answers , comments. is there anyway cause mvc3 / ef treat empty form field zero? is, if user leaves field blank, or blanks out field, want ef treat zero, , not null value. i know how make work string fields using data annotations, can't make work integer fields. i hope question makes sense. i've been fiddling data annotations, custom validators, blah blah blah, morning , can't seem make work. this kind of work around.you can make input field 0 if empty before posting form data when user clicks submit button in form . can use javascript

c++ - Calculate Combination based on position -

i have combinations this: 1,2,3,4 //index 0 1,2,3,5 //index 1 1,2,3,6 //index 2 and on until 7,8,9,10 so n=10 k=4 combinatorics how calculate combination index for example when index==1 mycmb = func(index) returns 1,2,3,5 this example need bigest numbers, , more params , without (if possible) many loops i find obtain position: http://answers.yahoo.com/question/index?qid=20110320070039aa045ib i want reverse this... i programming in c++ sugesstions or help it seems want find k-combination given number . following example , here's should work: #include <cstddef> #include <iostream> #include <string> #include <boost/lexical_cast.hpp> #include <boost/math/special_functions/binomial.hpp> std::size_t choose(double n, double k) { using boost::math::binomial_coefficient; if (n < k) return 0; return static_cast<std::size_t>(binomial_coefficient<double>(n, k)); } // returns largest n such choos

gcc - C++ running on PIC32 (MIPS32) -

unfortunately, c app pic32 needs oo , can't continue doing in c. do know mips32 c++ compiler pic32? thanks you might contact comeau computing ; thier c++ compiler generates c code intermediate language can utilise platform's existing native c compiler c compiler available, , therefore porting new platforms relatively quick , simple. for various reasons intermediate generation , compiler adaptation not accessible end users still need comeau generate pic32/c32 port, won't take long , amortise cost on sales other users. however if use commeau or other c++ c translator, suffer inability use source-level debugging, , likley killer attempt use c++ sucessfully without native debugger support. although not pretty, best bet learn how implement oo designs in c. here's whole book on subject: http://www.planetpdf.com/codecuts/pdfs/ooc.pdf

security - Java networking? -

first off, before ask, point out question education. want know expand understanding of java , network security (what little there is). how use java network security , counter attacks? have been using server/sockets while (for non system security stuffs), don't quite understand i'm doing. naturally, should learn on networking, start? there protocol everything, heck there protocols have protocols. further expand, how use java say, port sniff, catch packets or kill/open port remotely? i guess phrase question more adequately; know of sources @ more in depth look/study of how java handles network security , counter hacking , malware containment? how use java say, port sniff, catch packets or kill/open port remotely? you can't use java sniff ports. you can't use java catch packets. you can't use java kill/open port remotely. how java handles network security , counter hacking , malware containment? java doesn't handle network

python - Check if string is a real number -

is there quick way find if string real number, short of reading character @ time , doing isdigit() on each character? want able test floating point numbers, example 0.03001 . if mean float real number should work: def isfloat(str): try: float(str) except valueerror: return false return true note internally still loop string, inevitable.

c# - wpf binding change of binding source -

i have following class main window: public partial class window1 : window { public network network { get; set; } public dataset data_set { get; set; } public training training { get; set; } public string currentfile { get; set; } public mgtester tester; public mctester testersse; public chartwindow errorwindow; public chartwindow timeswindow; public window1() { network = new network(); data_set = new dataset(); training = new training(); tester = new mgtester(); testersse = new mctester(); currentfile = ""; errorwindow = new chartwindow(); timeswindow = new chartwindow(); initializecomponent(); (int = 0; < tester.getdevicecount(); ++i) { devicecombobox.items.add(tester.getdevicename(i)); } }... and in xaml code have: <listview grid.row="0" x:name="networklistview" itemssource="{bi

asp.net - How do you push an update to a non-HTML5 browser? -

we considering web application provide users frequent updates system data. initially, data limited system pressure, flow, etc. concept apply many areas of our business. data stored in sql server. the question is, how force table on webpage update when new data inserted database. example, pump reports new flow value. updates database can throttled realistically we're looking @ new update every minute or 2 our purposes. this seems case push notification used can use asp.net? html5 out of question although we've watched push demos web sockets. is there push technology can use asp.net? if not, or if it's better solution, should poll database jquery / ajax? suggestions samples should at? polling via ajax best solution here. since using asp.net, of built in ajax controls can make pretty simple: http://ajax.net-tutorials.com/controls/timer-control/ if want make better job of this, might consider creating web service , using raw javascript or jquery fram

Custom smarty function without identifiers? -

is possible create smarty functions accept shorthands or, more specifically, variables without identifiers? i have function takes object , returns string; i'm writing: {myfunc source=$object} i want able write {myfunc $object} without smarty squawking missing identifiers, don't know begin. it's entirely possible i'm missing fundamental fact makes impossible. if that's case, i'd know too. without knowing myfunc 's purpose be, believe modifier plugin looking for. these great taking string , formatting in way, taking timestamp , formatting in way wanted. variable modifiers can applied variables, custom functions or strings. apply modifier, specify value followed | (pipe) , modifier name. modifier may accept additional parameters affect behavior. these parameters follow modifier name , separated : (colon). also, php-functions can used modifiers implicitly (more below) , modifiers can combined. source then in t

php - What does "return $this" mean? -

i'm trying understand code, , when arrived @ final line, didn't it. :( can have in order find out, return $this mean ? public function setoptions(array $options) { $methods = get_class_methods($this); foreach ($options $key => $value) { $method = 'set' . ucfirst($key); if (in_array($method, $methods)) { $this->$method($value); } } //???? - return ? return $this; } update: i've removed comments better clarification. this way of coding called fluent interface . return $this returns current object, can write code this: $object ->function1() ->function2() ->function3() ; instead of: $object->function1(); $object->function2(); $object->function3();

c# - How to pass my own class using WCF? -

i have simple wcf service application (based on tutorial http://msdn.microsoft.com/en-us/library/ms734712.aspx ). is possible write function passes/returns own class? yes, till time class serializable, can pass back. recommended way use data contracts. see using data contracts what's point of datacontract in wcf?

javascript - Using funcunit to test a popup window -

i using funcunit test small application wrote. have button open popup window (using javascript function window.open(...)). can funcunit press button , open pop window,but i'm not sure how proceed in order handle on popup window , further testing. unfortunately, cannot change of code in pop up, thank you, matt open returns reference created window's window object. can use access in window. not sure if can verify has finished loading if can't modify popup. note both windows must on same domain in order access it.

special characters rails 3 ruby 1.8.7 -

i using new rails 3 mail emails in app. when send email app email account subject: (パンを食べない。) "i not eat bread"‏ my app have mail subject this: <subject: =?iso-2022-jp?b?kbskqivrjxmkcj8pjfkksiqkismbkeip?= =?iso-2022-jp?b?icjjihdpbgwgbg==?= =?iso-2022-jp?b?b3qgzwf0igjyzq==?= =?iso-2022-jp?b?ywqi?=> but mail.subject looks "(\e$b%q%s$r?)$y$j$$!#\e(b) \"i not eat bread\"" anyone know is, , how display correctly again in browser, , save correctly in database?

asp.net mvc - IIS 7.5 URL Rewrite - Redirect from http to https for account controller but from https to http for everything else -

i've found bits , pieces of need make work, haven't been able bring workable solution. i working on intranet site, , want secure *just logon , logoff actions on account controller https. have certificate installed correctly, , can redirect traffic these controller actions https using urlrewrite rule: <rule name="redirect https" stopprocessing="true"> <match url="^account/logon$|^account/logoff$" /> <conditions> <add input="{https}" pattern="^off$" /> </conditions> <action type="redirect" url="https://{http_host}/{r:0}" redirecttype="permanent" /> </rule> now, however, want redirect *all of rest of site's requests (other traffic 2 actions) http. i'm not interested in debating merits of approach, have consider valid reasons wanting redirect out of https http. i've tried writing code in actions achieve

mysql - C# ODBC Exception Incorrect String value -

i using c# parse chat log , insert messages database. when trying insert string "don't worry, it's unloaded" (with double quotes) gives me following exception: system.data.odbc.odbcexception: error [hy000] [mysql][odbc 5.1 driver][mysqld-5.5.11]incorrect string value: '\xef\xbb\xbf it...' column 'msg' @ row 1 @ void system.data.odbc.odbcconnection.handleerror(odbchandle hrhandle, retcode retcode) the database using latin-1 default collation encoding scheme. i have tried switching utf-8 gave me error on same line. not sure means specific error, ef bb bf utf bom character causing issue. this answer pointed out client connection needs set proper character set well. c# client character isn't matching mysql encoding.

html - Check duplicate content without doing a GET -

one of main purposes of url normalization avoid get requests on distinct urls produce exact same result. now, know can check canonical tag , compare 2 url's html see if they're same, have download exact same resource twice in order this, beating point stated before. is there way check duplicated content doing head request? if not, there way download <head> section of web page without downloading entire document? i can think of solutions last one, wan't know if there's direct one. according msdn documentation solution question following dim myhttpwebrequest httpwebrequest = ctype(webrequest.create(url), httpwebrequest) dim myhttpwebresponse httpwebresponse = ctype(myhttpwebrequest.getresponse(), httpwebresponse) console.writeline(controlchars.lf + controlchars.cr + "the following headers received in response") dim integer while < myhttpwebresponse.headers.count console.writeline(controlchars.cr + "header name:{0}, value

iphone - How can I view the object hierarchy in XCode 4 like XCode 3 does? -

in information builder, need view/navigate objects in xib , use object hierarchy view in xcode 3. however, in xcode 4, show top level objects, not child objects. how can view them in xcode 4? you can drag object view window right side of window. show objects , hierarchy.

asp.net mvc default parameter attribute -

is there way set default value on parameter not passed, eg: public actionresult index(int? page) {} i'd have page=0 if no page passed, can remove nullable symbol. not want in routing, on action itself. have tried: public actionresult index(int page = 0) {}

javascript - Using jQuery to update the st_url attribute of the sharethis chicklet button? -

i dynamically updating attribute 'st_url' of of sharethis spans url of video clicked jquery. in firebug can see updating st_url attribute of spans, sharethis button still tied initial url. read may have reinit elements, unsure of best way this? has done or have idea of best way re-initialize buttons updated url? thanks! sharethis includes , init: <script type="text/javascript"> var switchto5x=true; </script> <script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script> <script type="text/javascript"> stlight.options({publisher:'xxxx'}); </script> my markup: <span st_url="http://sharethis.com" class='st_stumbleupon' ></span> <span st_url="example" class='st_facebook' ></span> <span st_url="example" class='st_twitter' ></span> <span st_url="example" c

order - Django + ordering by comment amount -

does know solution taking instances of commented model ordered amount of comments? i @ comments model class , using: content_type = models.foreignkey(contenttype, verbose_name=_('content type'), related_name="content_type_set_for_%(class)s") object_pk = models.textfield(_('object id')) content_object = generic.genericforeignkey(ct_field="content_type", fk_field="object_pk") here snippet might out: http://djangosnippets.org/snippets/1101/ from django.contrib.contenttypes.models import contenttype django.contrib.comments.models import comment django.db import connection qn = connection.ops.quote_name def qf(table, field): # quote table , field return '%s.%s' % ( qn(table), qn(field) ) def comments_extra_count(queryset): commented_model = queryset.model contenttype = contenttype.objects.get_for_model(commented_model) commented_table = commented_model._m

Help with LINQ to SQL group by query -

the linq group syntax confusing me. in tsql can select multiple columns , group 1 of them. linq it's making me group of columns want work with. how can convert tsql linq? select max(item.itemid) expr1, max(item.title) expr2, sum(orderdetail.quantity) qty, max([order].datecreated) expr3 payment inner join [order] on payment.id = [order].orderid inner join orderdetail on [order].orderid = orderdetail.orderid inner join item on orderdetail.itemid = item.itemid ([order].datecreated >= '4 / 15 / 2011 12:00:00 am') , ([order].datecreated <= '4/15/2011 11:59:00 pm') group item.itemid order expr2 var q = p in db.payments join o in db.orders on p.id equals o.paymentid join od in db.orderdetails on o.orderid equals od.orderid

c++ - Server won't connect to more than one client? -

the problem connects 1 client instead of two. can me figure out why? server: #include <sfml/system.hpp> #include <sfml/network.hpp> #include <iostream> void sendinfo(void *userdata) { sf::ipaddress* ip = static_cast<sf::ipaddress*>(userdata); // print something... while(true){ // create udp socket sf::socketudp socket; // create bytes send char buffer[] = "sending info."; // send data "192.168.0.2" on port 4567 if (socket.send(buffer, sizeof(buffer), *ip, 4444) != sf::socket::done) { // error... } } } void receiveinfo(void *userdata) { // print something... while(true){ // create udp socket sf::socketudp socket; // bind (listen) port 4567 if (!socket.bind(4444)) { // error... } char buffer[128]; std::size_t received; sf::ipaddress sender; u

ruby on rails 3 scope extensions and includes -

i experimenting scope extensions , wondering if this. class user has_many :tasks belongs_to :klass scope :users_in_klass, lambda {|k| where(:klass_id => k)} def current_task_report includes(:tasks) users = [] each {|u| user = { :name => u.full_name, :id => u.id, :tasks => u.tasks } users << user } users end end and call this u = user.users_in_klass(6899) u.current_task_report the problem i'm having it's ignoring includes on tasks eager loading. user load (0.5ms) select `users`.* `users` (`users`.`klass_id` = 6899) task load (0.4ms) select `tasks`.* `tasks` (`tasks`.user_id = 46539) task load (0.2ms) select `tasks`.* `tasks` (`tasks`.user_id = 46909) task load (0.2ms) select `tasks`.* `tasks` (`tasks`.user_id = 46910) is i'm doing correct? on side note, there better place put current_task_report method? cheers, tim

c# - When using BDD specifications in a .NET project, why would one use both SpecFlow *and* MSpec? -

i repeatedly hear bdd enthusiasts advocate using both specflow , mspec in same project. apparently specflow more suitable outside-in/ui tests. (for example, web tests simulate mouse-clicks, etc, using watin or similar.) apparently mspec more suitable unit-tests. now question - why use 2 frameworks incredibly similar , virtually same thing? why not instead: choose 1 bdd framework , stick it. use outside-in/ui tests, intended, write unit-tests normally, established unit-testing framework (such nunit, mstest, etc)? i thought reason adopt bdd can test behaviours, driven externally , means of integration tests. i don't see how/why applies unit tests. i agree darren. think partly cultural/learning thing. if want have business actively collaborating on executable specification do, need business readability. need bdd tool, specflow. for unit testing, "business" or other developers in team, constraint have write unit tests in way other develop

linux - C++ Can't link Boost library -

i'm trying compile little piece of code boost documentation: (http://www.boost.org/doc/libs/1_46_1/libs/iostreams/doc/tutorial/filter_usage.html) #include <boost/iostreams/device/file_descriptor.hpp> #include <boost/iostreams/filtering_stream.hpp> namespace io = boost::iostreams; int main() { io::filtering_ostream out; out.push(compressor()); out.push(base64_encoder()); out.push(file_sink("my_file.txt")); // write out using std::ostream interface } but refuses compile, following errors: g++ -c -pipe -g -wall -w -d_reentrant -dqt_gui_lib -dqt_core_lib -dqt_shared -i/usr/share/qt4/mkspecs/linux-g++ -i../teste -i/usr/include/qt4/qtcore -i/usr/include/qt4/qtgui -i/usr/include/qt4 -i. -i../teste -i. -o main.o ../teste/main.cpp ../teste/main.cpp: in function ‘int main()’: ../teste/main.cpp:9:25: error: ‘compressor’ not declared in scope ../teste/main.cpp:10:29: error: ‘base64_encoder’ not declared in scope ../teste/main.cpp

youtube - Blackberry, QRs, and video -

i've been asked create qr image that, on being scanned smartphone, play short 2-minute video. video in .mp4 format, format can change. video playback works fine on iphone i'm having problems blackberry bold. when user scans qr code phone directs them url. right url directed http://domain.com/video.mp4 . when user attempts access page 413 error "entity large". basically, being pushed client. reading blackberryforums.com.au thread titled "request entity large" , see need increase allowed request size. user able play youtube videos fine on blackberry! why? youtube video size smaller? format youtube using? why youtube work, when method doesn't? i know obvious solution here use youtube hoster , embed video told cannot use quick , easy solution. the problem youtube streams video. you're trying user download whole video file. you may need streaming server video can played. alternatively, reduce filesize of file reducing video resolut

python - Pivoting data and complex annotations in Django ORM -

the orm in django lets annotate (add fields to) querysets based on related data, hwoever can't find way multiple annotations different filtered subsets of related data. this being asked in relation django-helpdesk , open-source django-powered trouble-ticket tracker. need have data pivoted charting , reporting purposes consider these models: choice_list = ( ('open', 'open'), ('closed', 'closed'), ) class queue(models.model): name = models.charfield(max_length=40) class issue(models.model): subject = models.charfield(max_length=40) queue = models.foreignkey(queue) status = models.charfield(max_length=10, choices=choice_list) and dataset: queues: id | name ---+------------------------------ 1 | product information requests 2 | service requests issues: id | queue | status ---+-------+--------- 1 | 1 | open 2 | 1 | open 3 | 1 | closed 4 | 2 | open 5 | 2 | closed 6 | 2 | closed 7

MouseEvents with JUNG and Java -

i made pluggablegraphmouse , 2 editinggraphmousepluggings in java jung program. if set modifiers left click , right click works fine, here setmodifiers code: ovalmouse.setmodifiers(mouseevent.button1_mask); circlemouse.setmodifiers(mouseevent.button3_mask); what i'd have left click 1 thing , shift + left click (instead of right click) other. i've tried every combination can think of can't seem work. here of more logical combinations i've tried don't work: //my logic here button1 , shift down doesn't work circlemouse.setmodifiers(mouseevent.button1_mask & mouseevent.shift_down_mask); // logic here button1 , shift doesn't work either circlemouse.setmodifiers(mouseevent.button1_mask & mouseevent.shift_mask); // tried inputevents didn't work either circlemouse.setmodifiers(inputevent.button1_down_mask & inputevent.shift_down_mask); if knows correct modifiers can use button 1 ovalmouse , button 1 + shift circlemouse please let me

database replication - Don't quite understand SQL Server transaction logs -

i've read on sql server transaction logs, still not entirely comfortable how use/manage them. important things transaction rollbacks, mirroring, replication , log shipping etc. to me, still seem black box , i'm not entirely comfortable doing them. there tools allow me view transaction log file or information it? if don't need things transaction log shipping, ok me shrink and/or truncate log files periodically? particularly in case of restoring backups onto test instance - need multi-gigabyte log file taking space? other features need aware of have particular dependency on transaction logs , not work if shrank/truncated log files? as general rule should not need 'do' transaction logs except ensure don't big. while possible read them log mining tools rare , and until comfortable other aspects of dba role, don't concern it. they black box , work fine that. you should select recovery model suits business needs. involve determining if need po

php - Google Maps V3 API for Codeigniter [Adding Numbered Markers + other questions] -

i have several questions regarding google map v3 api , library codeigniter wraps php class google maps api. how can have marker show a,b,c… or 1,2,3…? (most important) how prevent white bubble box opening when click on marker? after adding marker using addmarkerbyaddress() inside controller, there function can call within controller remove marker? because after adding directions it, marker addmarkerbyaddress() overlaps start/end marker in case need remove initial marker. i cannot seem have map display without calling addmarkerbyaddress(), right? this has been bothering me days hope can me out!! related links http://www.in-the-attic.co.uk/2010/08/02/codeigniter-google-maps-library-using-google-maps-api-version-3/ http://www.bradwedell.com/phpgooglemapapi/docs/googlemapapi/googlemapapi.html for showing custom markers use this: var latlon2 = new google.maps.latlng(44.959944, 26.0186218); marker2 = new google.maps.marker({ position: latlon2,

How can I remember which of list.append and list.extend is which in Python? -

in python, lists have 2 methods adding elements end: "append" , "extend". 1 of them adds single element list, , other adds every element iterable end of list. know which? did know without having up? if so, please share secret remembering which? at least me literal meaning clear enough make distinction between them. one of dictionary definition append : add to end 1 of dictionary definition extend : stretch out on distance, space, time, or scope; run or extend between 2 points or beyond point

tomcat7 - java, tomcat: what is the meaning of the id attribute in the tag web-app in web.xml? -

what meaning of web.xml id attribute of web-app tag? eclipse generated id="webapp_id" . using version servlet specification version 2.5, switched using 3.0, suggestion of this answer doesn't include id. is necessary? value supposed be? the newer versions of servlet spec use .xsd files no further information on id attribute, if go older versions .dtd, such web_app_2_2.dtd , find: the id mechanism allow tools make tool-specific references elements of deployment descriptor. allows tools produce additional deployment information (i.e information beyond standard deployment descriptor information) store non-standard information in separate file, , refer these tools-specific files information in standard web-app deployment descriptor. for example, websphere application server used id mechanism in old bnd , ext files: web.xml: <web-app id="webapp_id" ... ibm-web-app-bnd.xmi: <webappbnd:webappbinding ... <

internet explorer - Cache-control in Tomcat -

we have run problem internet explorer unable handle cache-control header set no-store ssl downloads. see http://support.microsoft.com/kb/323308 more details. unfortunately when tomcat authentication enabled appears automatically add cache-control header value no-store. i know there workaround when using basicauthenticator in tomcat. see http://daveharris.wordpress.com/2007/07/09/how-to-configure-cache-control-in-tomcat/ . solution describes using disableproxycaching attribute on authenticator. however, using sso authentication using org.apache.catalina.ha.authenticator.clustersinglesignon not appear have disableproxycaching attribute. there way change cache-control headers when using sso? you can use filter run on cache-control header tomcat imposes. response.setheader("cache-control", ); chain.dofilter(request, response);

What is context_object_name in django views? -

i'm new django. , i'm studying using class-based generic views. please explain aim , use of context_object_name attribute? if not provide "context_object_name", view may this: <ul> {% publisher in object_list %} <li>{{ publisher.name }}</li> {% endfor %} </ul> but if provide {"context_object_name": "publisher_list"}, can write view like: <ul> {% publisher in publisher_list %} <li>{{ publisher.name }}</li> {% endfor %} </ul> that means can change original parameter name(object_list) name through "context_object_name" view. hope help:)

cocoa - Odd NSView display performance -

i adding custom nsview nswindow's content view. whenever go interact subviews of new nsview (some nstextfields, nsmatrix, nspopupbutton , nsbutton), specific part of view seems disappear , show subview. the parts of view go missing never return. know causing this? thanks in advance. looks common problem. ended having add view child window of application's window. this link useful: http://blog.stuntaz.org/cocoa/2009/11/03/nswindow-overlay.html

netbeans problem : localhost/­PhpProject1/­index.­php not found -

i have installed netbeans6.9.1 java,c++ , php on windows 7. when tried run test php code, browser cant find localhost. pleas me rid of issue. need install else? or configure anything? you need install apache,php on machine . easiest way download : xampp

iphone - problem in UIPageControl -

pagecontrol = [[uipagecontrol alloc] initwithframe:cgrectmake(153,356,38,36) ]; pagecontrol.userinteractionenabled =yes; pagecontrol.numberofpages = 2; pagecontrol.currentpage = 1; pagecontrol.enabled = true; [pagecontrol sethighlighted:yes]; [pagecontrol addtarget:self action:@selector(changepage:) forcontrolevents:uicontroleventvaluechanged]; [self.view addsubview:pagecontrol]; } - (ibaction) changepage:(id)sender { } i'm programmatically creating page control , want display new view controllers on click of page control. how need implement changepage method? can help? you can show 2 views instead of showing 2 different view controller. can keep first dot selected , show first view , have next view out of screen, right. when user taps second dot, make uiview animation similar pushing in uinavigationcontroller. thus, push , pop uiview animation. if want show view controllers, page control needs shown in both view controller, user can switch 1 another. in su

c# - How can I better populate two arrays in a class? -

i need populate class of subtopics looks this: public class subtopic { public int[] subtopicid { get; set; } public string[] description { get; set; } } so far have following code insert in description not yet subtopicid. var description = new list<string>(); description.add("afds)."); description.add("afas."); ... ... description.add("aees."); new subtopic { description = description.toarray()} can think of simple way me populate subtopicid numbers 1,2,3 .. etc , there maybe better way can populate subtopic class. better adding list , converting array? you use class , array initializers: var subtopic = new subtopic { subtopicid = new[] { 1, 2, 3 }, description = new[] { "afds).", "afas.", "aees." } };

ruby - Get value of a second table cell with unique text in first cell of the row with Watir -

i want value in second cell of row of table, unique value in first cell. value of second cell keeps on changing. <table class="mm-table" cellspacing="0" cellpadding="3" border="0"> <tr class="trhover" onclick="location.href='stock.php?id=ri&p=wtch';"> <td align="left" rowspan="1" class="tdwidth35per paddingleft4px"> <a shape="rect" href="stock.php?id=ri&p=wtch"> reliance </a></td> <td align="right" rowspan="1" class="tdwidth35per"> **951.35** </td> <td align="right" rowspan="1" class="tdwidth30per"><font color="#008000">0.60</font></td> </tr> above table. there other tables same name. want access second cell contains text "951.35" try this: browser.table(:class => &

c# - retain value after page refresh -

i using button control("validation button") in c#. define global variable in project. when clicked button form validation happens , button("save button") gets visible. problem when click validation button, current page refreshes , global variable doesn't contain values. shows null. how cal maintain value in global variable after page refresh. this asp.net, correct? store value in session session["myvariable"] = value , read session value = session["myvaraible"] there other alternatives, viewstate, application or use static variable using session simple enough you.

c# - Mysterious disappearing reference -

i have seems strange problem windows forms application. web developer , have limited experience of developing windows forms application. working on ecommerce web site stores product images in database blobs. in order make easier bulk import images writing small windows forms utility uses existing website bll library. using visual studio 2010 c# , .net 4. created new windows forms project in solution , added reference bll project. started coding , added using statements code, working expected intelisense worked corectly bll classes etc. built project , failed, complained every line of code refered bll project including using statements, , intelisense no longer worked bll project. expect if there no reference bll project. if remove reference , re add it, or add ar reference projecct in solution, intelisense comes , of compiler errors disapear. if build again reappear , intelisense no longer works. what missing, hell might going on here. your library possibly has d

Image Data,iphone -

i converting image data bytes using below code.. nsdata *imagedata = uiimagejpegrepresentation(m_imageview.image,90); unsigned char *byteptr = (unsigned char *)[imagedata bytes]; same image coverting bytes using .net, in using encoding techs... iphonesdk , .net bytes not in sync... do need use encoding techs bytes....if please please provide me solution code :) thanks in advance.... are looking raw color data (rgba array), or saving file? the jpeg encoding not unique given quality level, you're not going have exact same data in .net vs cocoa.

Orbeon adds namespace declarations to XML automagically -

i not want namespace declarations used during xforms processing added xml instances work with, orbeon adds these declarations automatically (i not yet know whether these added during xforms processing stage, xforms runner or xpl processor) - xml instances work left alone (no automatic insertion of namespace declarations) - how achieve that? thanks. try adding xxforms:exclude-result-prefixes="#all" on <xforms:instance> , has behavior similar attribute of same name in xslt.

android - setting the sender of an email using startActivity(mailIntent) -

i send in android app emails using code: intent emailintent = new intent(android.content.intent.action_send); emailintent.settype("plain/text"); emailintent.putextra(android.content.intent.extra_email, new string[]{"recipient"+"@email.com"}); emailintent.putextra(android.content.intent.extra_subject, "subject"); emailintent.putextra(android.content.intent.extra_text, "text"); startactivity(intent.createchooser(emailintent, "send mail...")); but mail program uses wrong mail account. try select senders email address/mail account. there like: emailintent.putextra(android.content.intent.extra_senders_mail_address, "my_email_address@email.com"); or emailintent.putextra(android.content.intent.extra_users_email_account, "mail_account_x"); ? no there nothing mentioned above. default choose default email id used activate

javascript - linkedin button dynamic rendering -

how render linkedin button in dynamic way? e.g. writing "<script type='in/share'></script>" @ runtime or after page has finished loading. tested on writing or appending in body tag using jquery doesn't work. i'll appreciate help. thanks. for still wondering how this, after load your <script type="in/share"></script> //don't forget other attributes just call in.init() in javascript , render buttons. the developer guide using undocumented functions, forum post on developer site: https://developer.linkedin.com/forum/3-problems-share-button as stated eugene o'neill (web developer linkedin) 1) in.parse() , in.init() here stay. while employ policy undocumented methods may or may not supported indefinitely, these 2 uniquely crucial functionality of framework. amount of work require remove in.parse()... don't want think ;). in.init() our preferred method loading framework asynchronously , won&#

java - Spring WebFlow - problem with rest mapping -

i have problem mapping in spring webflow 2.3.0 i got error when want excute: http://localhost:8090/mywebapp/ register/other http://localhost:8090/mywebapp/verify or http://localhost:8090/mywebapp/register etc works can help? <bean class="org.springframework.web.servlet.handler.simpleurlhandlermapping"> <property name="order"> <value>1</value> </property> <property name="mappings"> <value> /register=flowcontroller /verify=flowcontroller /forgotpassword=flowcontroller /register/other=flowcontroller </value> </property> <property name="alwaysusefullpath" value="true" /> </bean> ... <webflow:flow-registry id="flowregistry" flow-builder-services="flowbuilderservices"> &

c# - SQLite .NetCompact Framework -

i creating pocket pc application in c# , want add sqllite db , create tables. when compile project error error 1 the type 'system.data.common.dbconnection' defined in assembly not referenced. must add reference assembly 'system.data, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089'. c:\documents , settings\build\desktop\testppcapplication\database.cs 40 17 testppcapplication any 1 please either missing reference system.data assembly or referencing non compact framework version of system.data.common.dbconnection

Prevent session expired in PHP Session for inactive user -

i have problem application: application has many forms , need 1 hour finish form because form dynamic (can add other forms). problem is: session of web server 24 minutes. when user fill form, spent time , session timed out because server recognize user inactive. it's annoying when form submitted, data lost , user returned login page. have tried make session expired in 10 hours code: ini_set('session.gc_maxlifetime', '36000'); but it's not working in server, possible server preventing ini_set() function? so, should solving problem? can prevent session timeout session can expanded 10 hours? or can disable session expiration? thanks instead of setting time in ini fixed length, remind session timeout reset on reload. create ajax code request every 5 minutes or file (image or smth). way timer reset every 5 minutes , users can spend day filling out forms.

Wrap highlighted text within textarea with strong tags using javascript/jquery -

i looking create javascript/jquery function wrap piece of highlighted text textarea in strong tags - similar wysiwyg editor here. is possible , if can point me in right direction. edit: ok here's clearer description of want... i have textbox on page can type in. i want able highlight part of text , wrap highlighted part in <strong> tags so if text box had words one 2 three , highlighted word "two", want able wrap word in strong tags - becoming one <strong>two</strong> three hope clearer... know there plugins out there don't need full wysiwyg functionality. my rangy inputs (terrible name, know) jquery plug-in this. example code: $("#foo").surroundselectedtext("<strong>", "</strong>"); jsfiddle: http://jsfiddle.net/agjda/

java - What's the configuration to notify the unhandled exceptions in Eclipse? -

when in eclipse use method throws exception, complains if not surrounded try/catch or if exception not thrown again. exceptions (e.g. integer.parseint(string)) eclipse won't complain. how set eclipse complain not handled exceptions?? thanks! the simple answer can't. the longer answer is: checked versus unchecked exceptions fundamental part of java language. it not role of eclipse compiler give compilation errors or warnings valid , acceptable java. you wouldn't want either, considering majority of statements (in theory) throw or propagate exceptions such nullpointerexception , arrayindexoutofboundsexception , outofmemoryerror , , on. yes, there 1 or 2 "mistakes" ... such numberformatexception being unchecked exception ... better way deal (for example) run pmd custom rules pick exceptions "ought be" treated checked.

WebAdministration powershell module not found on windows server data center -

in windows server 2008 datacenter, not find powershell webadministration module. tried get-pssnapin , get-module -listavailable , neither of showed webadministration and don't see webadministration module under directory %systemroot%\system32\windowspowershell\v1.0\modules !! do need install or enable have webadministration on datacenter ? you need have web server role (iis) installed. webadministration module. so, use get-module -listavailable also, looks these cmdlets available on windows server 2008 r2 or iis 7.5. so, if have iis7.5 on windows server 2008, these cmdlets available.

c++ - Storing pointers to const objects in boost::ptr_unordered_map -

i can't seem make boost::ptr_unordered_map<uint32_t, const foo> work - underlying implementation looks it's casting things void* . do have bite bullet , make methods wrap access const_cast<foo*> when inserting items, or there i'm missing here? there way store pointers const objects ( const foo* )? it looks isn't possible. a workaround wrap access ptr_unordered_map . insert method should take const auto_ptr , const_cast<foo*> insert it. if hand auto_type client code when removing elements, you'll need unpack pointer , transfer const auto_ptr or similar make ownership transfer explicit without leaking non-const references. this sufficient use case, don't need expose iterator behaviour - it's pure single-element insert/release/look-ups.

call c++ library from java application -

possible duplicate: calling c++ functions java hi how call c++ library java , use any suggestion example, highly appretiated best regards try jna , more friendly jni.

bash - Moving files/directories older than 7 days -

i have code find files/directories older 7 days, execute mv. realise need different command directories , files. -type not support fd - manual says supports 1 character. find /mnt/third/bt/uploads/ -type f -mtime +7 -exec mv {} /mnt/third/bt/tmp/ \; how move both files , directories >7d /mnt/third/bt/tmp/ whilst keeping same structure had in /mnt/third/bt/uploads/ ? thanks imho, non-trivial problem correctly - @ least me :). happy, if more experienced post better solution. the script: (must have gnu find, if "find" gnu-version change gfind find) fromdir="/mnt/third/bt/uploads" todir="/mnt/third/bt/tmp" tmp="/tmp/movelist.$$" cd "$fromdir" gfind . -depth -mtime +7 -printf "%y %p\n" >$tmp sed 's/^. //' < $tmp | cpio --quiet -pdm "$todir" while read -r type name case $type in f) rm "$name";; d) rmdir "$name";; esac done < $tmp #rm $tmp

c - Raw H264 frames in mpegts container using libavcodec -

i appreciate following issue: i have gadget camera, producing h264 compressed video frames, these frames being sent application. these frames not in container, raw data. i want use ffmpeg , libav functions create video file, can used later. if decode frames, encode them, works fine, valid video file. (the decode/encode steps usual libav commands, nothing fancy here, took them almighty internet, rock solid)... however, waste lot of time decoding , encoding, skip step , directly put frames in output stream. now, problems come. here code came producing encoding: avframe* picture; avpicture_fill((avpicture*) picture, (uint8_t*)framedata, codeccontext->pix_fmt, codeccontext->width, codeccontext->height); int outsize = avcodec_encode_video(codeccontext, videooutbuf, sizeof(videooutbuf), picture); if (outsize > 0) { avpacket packet; av_init_packet(&packet); packet.pts = av_rescale_q(codeccontext-&

javascript - Google translate save language setting to a cookie -

will possible save settings of google.translate in cookie? example set language 'english' 'spanish' , navigate other pages (eg. about) of site , still retain language 'spanish'. need on how implement this, know it's possible, don't know how implement it. here 's (http://jsbin.com/esiga3) code i'm working". need detect if theres cookie has been set language , if not create cookie set language. i think possible set language setting of google translate api temporarily in user side using javascript or cookie. thank you! with few improvements avoid bad translations etc or english english issues. - http://jsfiddle.net/f248g/3/ // set original/default language var lang = "en"; var currentclass = "currentlang"; // load language lib google.load("language", 1); // when dom ready.... window.addevent("domready", function() { // retrieve div translated. var translatediv = document.i

How can I use a variable to create MATLAB elements? -

possible duplicates: how concatenate number variable name in matlab? matlab: how can use variables value in variables name? i have following code: x = textread('/home/data/data.txt','%s') i=1:50 s=load(['/home/data/',x{i},'_file.mat']) info_',x{i},' = strcat(s.info1, s.info2) end of course, last line ( info_',x{i},' = strcat(s.info1, s.info2) ) doesn't work. doesn't seem possible use variable create matlab elements. right or doing wrong here? there elegant workaround? do want like eval( sprintf( 'info_%s = strcat( s.info1, s.info2 );', x{i} ) ); ? if so, discourage doing so, see: http://matlab.wikia.com/wiki/faq#how_can_i_create_variables_a1.2c_a2.2c....2ca10_in_a_loop.3f

jQuery Carousel not advancing in Internet Explorer 7 -

i have jcarousel on homepage of site: http://www.thegirlsfoundationoftanzania.org/ it works great in browsers except internet explorer 7 , 6. in 7, renders carousel correctly pictures not advance nor next , previous arrows work. have tried think of fix no avail. ie 7 not display javascript errors. the code jcarousel container is: <div id='carouselboxes'> <a href='#' id='carouselboxes-prev'></a> <a href='#' id='carouselboxes-next'></a> <ul> <li><img src="/featurephotos/10_slideshow 2.jpg" width='600' height='410' border='0' /></li> <li><a href='/facts_about_girls.htm'><img src="/featurephotos/15_facts.jpg" width='600' height='410' border='0' /></a></li> <li><img src="/featurephotos/11_slideshow 3.jpg" width='600' hei

php - Spanish Accent Marks in Form Submission -

i have form spanish can submitted , using php, send email data. unfortunately, accent marks totally screwed when emailed. if submit following: testing accent marks á é í ó ú ñ i end following in body of email... testing accent marks á é à ó ú ñ the code processing email placing $_post info directly body of email. assume need have htmlentities() or have tried , nothing works... i need placing same data mysql database , retrieving later. need aware of when that? thanks! drew you have touched fine subject of charsets. try create , convert utf-8. database, files, forms , like. information on internet header use in e-mail make utf-8. convert e-mails standard 7-bit 8-bit these headers. "content-type: text/plain; charset=utf-8" "content-transfer-encoding: 8bit" for database need set, in case of mysql, collation.

java - maintain the order of column when creating a new table using hibernate -

this pojo annotated entity @entity @table(name = "book", catalog = "book_db") public class book { private integer bookid; private string bookname; private string bookshortdesc; private string bookdesc; private string bookauthor; } @id @generatedvalue(strategy = identity) @column(name = "book_id", unique = true, nullable = false) public integer getbookid() { return this.bookid; } @column(name = "book_name", nullable = false, length = 256) public string getbookname() { return this.bookname; } @column(name = "book_short_desc", nullable = false, length = 1024) public string getbookshortdesc() { return this.bookshortdesc; } etc...... the above entity created using annotation, when mysql database,the columns not created in order, have written below, instead , first columns book_id, book_desc, book_athor, book_short_desc book_name. my question how can tell hibernate create columns same order have wr

Different CSS style for JSF messages -

in jsf, have included following line in xhtml file: <h:panelgroup id="messageheader"> <h:messages for="messageheader" layout="list" errorclass="error" infoclass="inform"/> </h:panelgroup> the text gets rendered as <ul> <li class="error"> please enter first name </li> <li class="error"> please enter last name </li> </ul> how css style apply <ul> tag or surrounding <span> tag? here trying do. want error messages appear in single red box. want info messages appear in single green box. example above produces 2 red boxes; 1 each <li> item. use styleclass attribute of <h:messages> . applied on parent html element. e.g. <h:messages styleclass="messages" /> will end as <ul class="messages"> ... </ul> update : seem want show info , error messages in separat

Can a dynamic table be returned by a function or stored procedure in SQL Server? -

i call stored procedure or user-defined function returns dynamic table created via pivot expression. don't know number of columns front. is possible? (i not interested in temporary tables) you can via stored procedure can return kind of table, question trying achieve , data have no idea about?

mercurial - How to tag a certain folder in my source tree? -

i using mercurial command line , can't find out how tag folder. source repository consists different libraries i'd tag them separately. mistakenly tagged whole source tree, i'd know how erase tag before create new tag. as lasse states, can tag revision of entire repository in mercurial. in order tag different components in repository consider using mercurial subrepositories . subrepositories allow treat individual components (what calling libraries) independent repositories, , pull them single, functional unit. in terms of bitbucket's limitation on private repos - consider making of them public, or placing main repository on local machine or server if you're concerned exposing source publicly. if you're interested in hosting yourself, redmine free tool allow serve many repos want.