Posts

Showing posts from August, 2010

unix - Javascript refresh function problem -

i have problem following javascript code. want run background check (check.php) process on unix server. execution time of php , response takes 1.2-1.5 seconds (did test in mozilla) i've come script below refresh , check what's going on process , change background of div accordingly. right now, after few refreshes hangs, because think goes loop , doesn't wait first function finish , piles up. ideas doing wrong? more simpler way it? <script language="javascript" type="text/javascript"> function getval(param) { var strurl = param; var req = new xmlhttprequest(); req.open("get", strurl, false); //third parameter set false here req.send(null); return req.responsetext; } function changedivimage() { var pid = getval("check.php") var imgpath = new string(); imgpath = document.getelementbyid("status_body").style.backgroundimage; ...

.net - NHibernate Mapping a one-to-many relationship with the many coming from multiple sources -

background i have been working on tool supposed work in conjuction legacy application, , have hit small brick wall. have spent last day or searching clues this, have had no luck. i trying map relationship between table , multiple other tables follows: the parent table represents "dictionary." dictionary list of database fields can used in ad-hoc records queries in (horrible) legacy application. each record holds table , column item can found, unique identfying "friendly" name, key use in global value lookup table, , flag determines how lookup values pulled, , text column defines sql run obtain lookup data if flag value set appropriately. table name [dictionary] (see below table structure.) the flag can have 1 of 4 values: freeform standard system dynamic if flag set freeform, end user can enter value want. if other value, value must picked list follows: standard : legacy application pulls values "union all" query of 2 tables dif...

php - How to build a url of a GRAVATAR image from a given email -

there simple way php , simple script or url manipulation build url gravatar image corresponding email? ex. http://gravatar.com/avatars/avatar.php?email=myemail@myserver.com , return jpeg or png image. if there no simple way example, easiest way know resolve url of gravatar corresponding email?. thanks you can find sample script php code on implementation site: http://en.gravatar.com/site/implement/php

logging - Why does Heroku log using the server time rather than the Rails time zone? -

update: ok, didn't formulate q answered. still struggle heroku being on -07:00 utc , @ +02:00 utc. q: how log written in correct time.zone ? 9 hours difference, heroku (us west) - norway, distracting work with. in production.log (using heroku logs ): processing productioncontroller#create xml (for 81.26.51.35 @ 2010-04-28 23:00:12 ) [post] how write 2010-04-29 08:00:12 +02:00 gmt ? note i'm running @ heroku , cannot set server time myself, 1 @ amazon ec2 servers. below previous question, i'll leave holds interesting information time , zones. why time.now yield server local time when have set time zone in environment.rb config.time_zone = 'copenhagen' i've put in view <p> time.zone <%= time.zone %> </p> <p> time.now <%= time.now %> </p> <p> time.now.utc <%= time.now.utc %> </p> <p> time.zone.now <%= time.zone.now %> </p> <p> time.zone.today <%= time.zon...

session - Yahoo account remains open after using openID to login.why? -

i have added openid login yahoo! , google in site. ok , works fine. when users select example yahoo! login site, logged in in yahoo mail account too. i think not secure because maybe don't notice issue , leave computer while email account availble. what think , solution own sites? notice same story stackoverflow.com. it's typically session cookie, if close browser they'll okay, concern. i'd curious hear yahoo! team has themselves; if nobody y! finds question i'd ask on @ yahoo openid developer forum .

c++ - Advice when using COM Object/CComPtr and the STL -

i doing com related things directshow such as: typedef ccomptr<ibasefilter> autoibasefilterptr; map<cstring, autoibasefilterptr> _filtermap; to store list of directshow related com objects , friendly name. after finding this article (see:problem 2) on how changes in vc10 compiler might effect ok code, wondering if there more things watch out when mixing stl , ccomptr or prehaps mixing stl , com in general. any tips appreciated, thanks the slight thing can think of hasn't been mentioned cadapt required ccombstr ccomptr , because overloads operator& too. in fact, overloading operator& makes cadapt necessary, many stl containers require taking address of x returns pointer said x.

google app engine - best framework on gae(python) ,like jquery on javascript ? has it? -

i want find framework make work simple on gae , has ? thanks i found one, not http://code.google.com/p/appengine-framework/ there large number of frameworks can use on app engine - both custom designed it, , general purpose , work fine on app engine. if you've used python framework in past, small amount of searching tell if work on app engine or without modifications. common frameworks work on app engine include django, web2py , pylons. there's comprehensive list or open source tools here .

javascript - JQuery class selectors -

i have html text box having class names numbers <input type="text" name="msg_timeout" class="numbers" /> similarly there different text box class numbers .i want assign keydown event text box has class number tried following ,but not working $('input.numbers').each $('.numbers').each $('input.numbers:text').each $('input:text.numbers').each $('input[type=text]').each // working selects textboxes. kindly let me know idea. code below $(document).ready(function() { $('input.numbers').each(function() { $(this).get(0).oncontextmenu = function() { return false; }; $(this).bind("keydown",function(event) { // alert(window.event); // allow backspace , delete if ( event.keycode == 46 || event.keycode == 8 && (event.keycode >=96 && event.keycode <=105) ) { ...

java - SVNKit: Commit files that were manually deleted from filesystem( Work Copy) -

i can not solve problem collecting commititem(changes commit), or more accurately, have no porblem changed , added files files manually deleted file system not seen in commititem list ... , changes can not commit svn server. if delete file using api, problem not exist... manually deleting ... has had similar problem? if file has been manually removed file system, can't commit, cause svn thinks should there isn't. try svn status on such situation (!)...

ruby - How can I improve the code to delete items in an array in the following case? -

i have code: array = ['notice', 'warning', 'error'] array.delete('notice') if flash[:notice] array.delete('warning') if flash[:warning] array.delete('error') if flash[:error] since there repeated names, in order shorten code, use interpolation perform part of code: array.delete('notice') if flash[:notice] array.delete('warning') if flash[:warning] array.delete('error') if flash[:error] how can in 1 step? i tryed this array.each { |item| array.delete("#{item}") if flash[:"#{item}"] } but doesn't work good. that happens because you're modifying array on iterate. should work array.clone.each { |item| array.delete("#{item}") if flash[:"#{item}"] } try running , without clone on sample input array = ['notice', 'warning', 'error'] flash = {:warning => 1, :error => 2} ... p array but there...

ssms - SQL Server Management Studio edit timeout -

i trying run query edit records in sql server management studio 2008 , keep getting error: "sql execution error. error message: timeout expired. timeout period elapsed prior completion of operation or server not responding." i have set following: execution time-out: 0 set lock timeout: -1 transaction time-out after: 65535 the message appears @ 30 seconds.... there locks on database trying change. need first remove locks, can execute change.

coldfusion - Is it more efficient (Performance) to store the CFC in application variables OR instance the CFC on the page call? -

i'm working on coldfusion dynamic website. website, there lot of cfcs , lot of functions within each cfc. would more efficient store instance of cfc in application variable, instance each cfc separately on each page load. for each page, @ 2 separate cfcs called. i'm interested in how performance effected when requests increase (stress). thanks! it depends. if cfcs in question singletons yes, it's wise instantiate them once , store them application scope. more experienced , application grows you'll find best tool manage object dependencies coldspring , creating object in onapplicationstart() best bet. if dealing transient objects you'd need create object per request.

javascript - Problem with onblur="submit" when using TinyMCE with JEditable -

i'm trying use tinymce jeditable, per samspeak's blog post . i'm running small annoying problem. i set onblur="submit" in jeditable's settings. behavior expect (and want) user clicks away editor, editor submits new data (in case, function). the problem is , happens first time user clicks away. other time user clicks on editor, submits when click "submit" button. edit : after bit of digging, looks problem jeditable puts "onblur" event on textarea created initially, gets "hidden" tinymce when doing "mceaddcontrol". not sure how can fix this, without messing around jeditable's code. thanks, edan

opengl - Cylinder Normals -

Image
i'm developing opengl application right draws big tube consisting of several small cylinders (kind of slinky). i'm getting annoying effect when turn lighting , normals on, angles these annoying black dots on cylinders' borders: i belive byproduct of fact cylinders thin. set normal (0,0,+/- 1) when setting top/base, , side normals (cos(toradian(beta)), sin(toradian(beta)), 0). is possible remove effect whitout getting 'fatter' cylinders? or there wrong in way define normals? thanks this appears rendering of sides of cylinders. yellow in image corresponds tops of cylinders. sides of cylinders @ 90 degrees tops, not lit (i'm guessing light in same direction camera) , appear black. cylinders being thin these not fill make pixels don't show much. how fix it? i've got couple of ideas: 1) draw tops , bottoms, not sides - fix problem when viewed angle, lead further problems if camera moves. 2) disable lighting, faces drawn same colour ...

ruby - How can I send mail with rails without a template? -

in rails 3 project, want send simple notification emails. don't need make template them or logic. want fire them off various places in system. if doing in arbitrary ruby script use pony . however, i'd still use rails mail facilities , configuration, same reliability , setup have rest of mail in system. what's simple way this? ideally there method actionmailer.send(:to => 'foo@example.com', :subject =>"the subject", :body =>"this body") the simplest way send mail in rails 3 without template call mail method of actionmailer::base directly followed deliver method, for ex, following send plain text e-mail: actionmailer::base.mail(from: "me@example.com", to: "you@example.com", subject: "test", body: "test").deliver http://api.rubyonrails.org/classes/actionmailer/base.html#method-i-mail gives header options , ideas how send multipart/alternative email text/plain , text/html p...

c# - Troubles wtih comments in XmlSerialzier -

i try load xml file code: xmlserializer xmlserializer = new xmlserializer(typeof(myobject)); streamreader reader = new streamreader(filename); object myobject = xmlserializer.deserialize(reader); when file contains comment this: <?xml version="1.0" encoding="utf-8"?> <!-- edited xmlspy v2007 sp2 --> <route> <!--file created on 26-nov-2010 12:36:42--> <file_content>1 <!--0 = type1 ; 1 = type2--> </file_content> </route> xmlserializer returns error like unexpected node type comment. readelementstring method can called on elements simple or empty content when remove comments in file it's work fine. i don´t know problem, ideas? as can see comments not allowed in serialized xml, should pose no problem you. might not control source xml control deserialization process, remove comments prior deserialization: xmlserializer xmlserializer = new xmlserializer(typeof(myobjec...

java - keytool -genkey error: Keystore file does not exist -

i try create new self certified keystore file the command use is: keytool -genkey -selfcert -dname "cn=my name, ou=orga unit" -alias selfcertified -keypass somepass -keystore keystore.jks -storepass anotherpass -validity 365 but annoying error: keytool error: java.lang.exception: keystore file not exist: keystore.jks i not understand why i'm getting error. command above should create new keystore, why complaining non existing store? generating key pair (and new keystore) has done separate operation creating self-signed certificate key. i.e. keytool -genkey -alias mykey -keystore store.jks keytool -selfcert -alias mykey -keystore store.jks

TabActivity in library project, android.R.id.tabhost not found error -

i trying create template/baseactivity class other developers use, part of framework. i extended class tabactivity, , xml looks this/ <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <view android:layout_width="fill_parent" android:layout_height="0dip" android:background="#000" /> <tabwidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="0dip" android:layout_marginright="0dip" /> <view android:layout_width=...

objective c - How to @synthesize a C-Style array of pointers? -

i have property defined in class so: @interface myclass uiimageview *drawimage[4]; ... @property (nonatomic, retain) uiimageview **drawimage; ... @synthesize drawimage; // fails compile i have found similar questions on stackoverflow , elsewhere, none address issue. objective-c kosher way this? you can't; have change retain assign , handle memory management yourself; can't send -[retain] uiimageview ** (as isn't object.) that say; can't use @synthesize lead epic memory leaks assign , doesn't work retain or copy ; need implement -drawimage , -setdrawimage: , write accessor code. but don't that. use nsarray .

domain driven design - Simple aggregate root and repository -

i'm 1 of many trying understand concept of aggregate roots, , think i've got it! however, when started modeling sample project, ran dilemma. i have 2 entities processtype , process . process cannot exist without processtype , , processtype has many process es. process holds reference type, , cannot exist without it. so should processtype aggregate root? new processes created calling processtype.addprocess(new process()) ; however, have other entities holds reference process , , accesses type through process.type . in case makes no sense going through processtype first. but afaik entities outside aggregate allowed hold references root of aggregate, , not entities inside aggregate. have 2 aggregates here, each own repository? i largely agree sisyphus has said, particularly bit not constricting 'rules' of ddd may lead pretty illogical solution. in terms of problem, have come across situation many times, , term 'processtype' lookup . lookup...

can i combine two css classes per single html div or span element? -

i have below code doing want, wanted see if can simplify single line , not use 2 html elements <head runat="server"> <title></title> <style type="text/css"> .firstletter{color:white; background:blue; border:1px black solid; padding-top:10px; padding-left:10px;} .spaced{letter-spacing: 5px;} </style> </head> <body> <form id="form1" runat="server"> <span class="firstletter"> r </span> <span class="spaced"> ealtime account activiation </span> </form> </body> </html> can away single inline text in html element this: <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <style type="text/css"> .firstletter{color:white; background:blue; b...

ssms - Sql Server Management Studio Express (2005 or 2008) - Save Password Doesn't work -

i click "remember password" when connecting database server. sometimes when come ssms, has remembered, not. more not. regularly connect 4 different servers, it's random when works servers. how can work time? yup known bug in ssms - believe versions, reported here on connect . have experienced in past, yet had machines never had problems. i love have solution it, unfortunately solution me allow windows authentication connecting instead. my recommendation post on bug report , if enough people microsoft either fix or provide information it. yes, pay attention connect bug reports when 'popular'.

Is there a way to programatically popup the "Microsoft Silverlight Configuration" dialog? -

i building silverlight 4, , handle mouserightbuttondown events , build own contextmenu's (a class silverlight toolkit). add classic " silverlight " menu item menus, , give user familiar option of launching " microsoft silverlight configuration " dialog. dialog lets users manage updates, webcams, permissions, , application storage. need way programatically launch dialog when menu item clicked. i can done flash, , seem microsoft want encourage developers support option. can done? here answer no likes give: no. there no exposure in silverlight api invoke display of silverlight configuration dialog. i agree such feature ought exist. edit in response additional question. in elevated sl4 oob app may possible scripting shell launch silverlight.configuration.exe . find file at:- %programfiles%\microsoft silverlight\4.0.50401.0\silverlight.configuration.exe

rendering data in jsp using spring controllers and different classes -

Image
i want render data this how jsp page table how achieve this, please me, it creates lot of confusion me, how many classes define , fields. thanks most data coming database , kind of list of javabeans returned. let's is: list<myobjects> objects you need set in controller level: @requestmapping(value="/table") public modelandview rendertable() { modelandview mv = new modelandview("/table"); mv.add("objects",objects); return mv; } now way render on jsp: <c:if test="${not empty objects}"> <table> <c:foreach var="o" items="${objects}"> <tr> <td>${o.id}</td> <td>${o.name}</td> <td>${o.descriptio}</td> </tr> </c:foreach> </table> </c:if> you can read more here: http://static.springsource.org/spr...

ios - Select First Row as default in UITableView -

i have application viewbased , adding tableview subview main view. have taken uitableviewdelegate respond table methods. working fine, want select first row or uitableview default selected(highlighted). please me, code need , need put it. - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; nsindexpath *indexpath=[nsindexpath indexpathforrow:0 insection:0]; [mytableview selectrowatindexpath:indexpath animated:yes scrollposition:uitableviewscrollpositionbottom]; } the best way use in code, if want select row default, use in viewdidappear.

jQuery: Checking a Radio Button with attr() doesn't work? -

not sure if bug in jquery 1.4.2 - can't figure out why won't work. i need check radio button. i'm using attr({'checked':'checked'}) , tried attr('checked':true) - none work. if attr('title':'whatever') on same radio button, no other change anyhwere, work everytime. is there obscure difference between title attribute , checked attribute i'm missing? both everyday html attributes. why 1 work , other 1 doesn't? here's code: $('.formradiodiv').live('click', function() { //remove checked radio btns $('input', $(this).parents('#radiogroup')).each(function() { $(this).removeattr('checked'); }); $('input', $(this)).attr('checked', true); }); edit: alright, believe got it. apparently worked along, , head temporarily being in tukka tukka land or something. i checking source code see if jquery had added "checked" att...

c# - What does "throw;" by itself do? -

possible duplicate: difference between throw , throw new exception() what point of having catch (exception) { throw; } what do? by itself, throw keyword re-raises exception caught catch statement above. handy if want rudimentary exception handling (perhaps compensating action rolling transaction) , rethrow exception calling method. this method has 1 significant advantage on catching exception in variable , throwing instance: preserves original call stack. if catch (exception ex) , throw ex, call stack start @ throw statement , lose method/line of original error.

algorithm - Invert a LUT (lookup table) -

i writing color management code, , dealing luts (look tables). i can read color profile lut , convert values... but, how can inverse operation? maybe, there algorithm generate 'inverse' of lut? if lut given, simplest method find closest entry given color value. can accelerate computation variety of methods; example, can build k-d tree out of lut entries , use eliminate of comparisons exhaustive check require. however, tend result in "posterized" image, since smooth areas in image shift abruptly 1 entry next. can avoid taking pixels in (quasi-)random order, picking best fit lut, , pushing difference between pixel value , chosen entry onto nearby pixels haven't been chosen. there variety of ways last, result in dithering effect makes better use (for imaging purposes) of available lut entries simple, per-pixel operation can.

CodeIgniter: Passing variables via URL - alternatives to using GET -

i'm new codeigniter , have discovered difficulties using method of passing variables via url (e.g. domain.com/page.php?var1=1&var2=2). i gather 1 approach pass variables in uri segments haven't quite figured out how yet seems create expectation of having function in controller named specific uri segment???? anyway instead of using i've decided use post adapting submit button (disguised link) variables in hidden input fields. i've created following solution seems work fine, wondering whether i'm on right track here or whether there easier way of passing variables via link within codeigniter? i've created following class in application/libraries/ <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class c_variables { function variables_via_link($action, $link_text, $style, $link_data) { $attributes = array('style' => 'margin:0; padding:0; display: inline;'); echo form_open($ac...

.net - Best design pattern for calculated values on a subclass? -

say have 2 types: classa { int valuea; int calculateda; } classb { int valuea; int calculateda; int valueb; int calculatedb; } calculatedb requires valuea valueb . i'm trying decide best pattern implement this. option 1: subclass classa , add values. have common update() method overridden in subclass. simple code in model, code create these classes needs know create in advance, , code iterates on list of these types needs type checking deal fields. option 2: have properties in separate class, , have update code calculatedb there. issue classb needs way of knowing when valuea updated, , hoping not have implement inotifypropertychanged on these classes. way have sort of public update method on properties class, , have main class call method when valuea updated. not desirable. option 3: have classb valueb , calculatedb being nullable types. pass. are there more? choose? if classb not related classa, subclassing not meth...

regex - Rails - "can't convert Symbol into String" on Production ONLY -

i have partial view displays model-specific flash messages. partial looks like: app/views/mymodel/_flashpartial.erb <% flash.each |key, value| %> <% if model_key = mymodelflash(key) %> <%= content_tag(:div, value, :class => "flash #{model_key}") %> <% end %> <% end %> the mymodelflash method takes key , checks particular prefix using simple regex. it's located in app/helpers/mymodelhelper.rb module mymodelhelper def mymodelflash( key ) m = /^_mymodel_(.*)/.match(key) m[1] unless m.nil? end end this works fine in development , test environments. goes onto heroku, error saying (actionview::template::error) "can't convert symbol string" pointing call match . if remove call mymodelflash view , display key , value, works fine in terms of not erroring out, @ least key , value getting partial view fine. reason helper method thinks key being passed symbol , not string. any ideas why might...

scripting - How to change svn commit message -

i wrote script can auto commit in every 10 minutes. it's commit message same ("code saved"). want change of them milestone. this auto commit script: cd c:\inetpub\wwwroot\sitecodes svn commit -m "code saved" how can write script can give me chance write revision number , new commit message. to answer actual question (at personal risk), svn requires explicit permission set in hook script before allow log message changed. never have repository long before need this. here's batch file can use. put in repository's "hooks" folder , call pre-revprop-change.bat http://svn.haxx.se/users/archive-2006-03/0107.shtml or little more readable version, http://ayria.livejournal.com/33438.html of course, agree else setup sub-optimal. you'll inevitably need change log message good reason sooner or later. :)

.net - what to use for repetitive (daily, weekly, monthly) tasks ? Workflows, Windows Services, something else? -

i've been writing windows services while , seem work fine things need run every day, few times week, once month, etc. i've been lately thinking going windows workflow foundation. however, unsure how run on server without container application (for instance sharepoint)? worked sharepoint workflows before , had huge problems, @ first bugs in workflow architecture implementation (the problems sleep , delay) , later when started work, difficult manage , change. on other hand windows services quite easy implement, easy create setup them , install them , quite resilient (they working months without crashing or else going wrong). what recommend? please bear in mind working in .net (version of no problem, if 4.0 brings new on subject, can use it). we choose use windows service. recurring , scheduled tasks, utilize quartz.net library. when tasks lengthy blocking operations, incorporate smartthreadpool library. let quartz create job , stick in smartthreadpool exec...

facebook - What exactly does this piece of JavaScript do? -

i saw page growing in popularity among social circles on facebook, what 98 percent bla bla... , walks users through copying below javascript (i added indentation make more readable) address bar. looks dodgy me, have basic knowledge of javascript. simply put, do? javascript:(function(){ a='app120668947950042_jop'; b='app120668947950042_jode'; ifc='app120668947950042_ifc'; ifo='app120668947950042_ifo'; mw='app120668947950042_mwrapper'; eval(function(p,a,c,k,e,r){ e=function(c){ return(c<a?'':e(parseint(c/a)))+((c=c%a)>35?string.fromcharcode(c+29):c.tostring(36))} ; if(!''.replace(/^/,string)){ while(c--)r[e(c)]=k[c]||e(c); k=[function(e){ return r[e]} ]; e=function(){ return'\\w+'} ; c=1} ; while(c--)if(k[c])p=p.replace(new regexp('\\b'+e(c)+'\\b','g'),k[c]); return p} ('j e=[...

android - How to set a bitmap from resource -

this seems simple, trying set bitmap image resources, have within application in drawable folder. bm = bitmapfactory.decoderesource(null, r.id.image); is correct? assuming calling in activity class bitmap bm = bitmapfactory.decoderesource(getresources(), r.drawable.image); the first parameter, resources, required. obtainable in context (and subclasses activity).

c++ - Copy vector of values to vector of pairs in one line -

i have following types: struct x { int x; x( int val ) : x(val) {} }; struct x2 { int x2; x2() : x2() {} }; typedef std::pair<x, x2> pair_t; typedef std::vector<pair_t> pairs_vec_t; typedef std::vector<x> x_vec_t; i need initialize instance of pairs_vec_t values x_vec_t . use following code , works expected: int main() { pairs_vec_t ps; x_vec_t xs; // not empty in production code ps.reserve( xs.size() ); { // want change block 1 line code. struct get_pair { pair_t operator()( const x& value ) { return std::make_pair( value, x2() ); } }; std::transform( xs.begin(), xs.end(), back_inserter(ps), get_pair() ); } return 0; } what i'm trying reduce copying block 1 line using boost::bind . code not working: for_each( xs.begin(), xs.end(), boost::bind( &pairs_vec_t::push_back, ps, boost::bind( &std::make_pair, _1, x2() ) ) ); i know why not working , want know how make working without de...

How to learn Cakephp -

i want learn cakephp framework , dont have enough time research it, need book or online tutorial enable me learn quickly. please suggest online tutorial or books, if any. the cakephp official manual answer http://book.cakephp.org/ go official site manual , documentation sufficient.

SSL Enabling: Tomcat in Windows 7 -

when try enable ssl (editing server.xml enable port:8443 https) in windows 7, not getting enabled. shows (connected localhost..) , remains hanged. i'm using windows 7 64-bits/4gb ram tomcat 6.0(netbeans bundle), jre 1.6(64-bit). i made work on case, problem protocol used. in file server.xml change connector option protocol="http/1.1" protocol="org.apache.coyote.http11.http11nioprotocol" the section should following. <connector port="8443" protocol="org.apache.coyote.http11.http11nioprotocol" sslenabled="true" maxthreads="150" scheme="https" secure="true" clientauth="false" sslprotocol="tls" keystorefile="c:\pathtocert\cert.bin" keystorepass="****" />

c# - How can I remove the border padding on container controls in WinForms? -

Image
i set margin , padding 0 0 0 0 doesn't have effect tabcontrols. look: here talking about. want stick borders together. how can this? @henk holterman - yes, what's wrong ? there's comment left in source code tabpage exasperated microsoft programmer (edited fit page): //hack: ensure tabpage draws correctly (the border // clipped , gradient fill match correctly tabcontrol). // unfortunately, there no way determine padding used // on tabpage. // use following below, getmargins busted // in theming api: //visualstylerenderer visualstylerenderer = new visualstylerenderer(visualstyleelement.tab.pane.normal); //padding themepadding = visualstylerenderer.getmargins(e.graphics, marginproperty.contentmargins); visual styles have been major bug factory, particularly tabcontrol. check this answer way selectively turn off tabcontrol you'll behavior used to. of course does change appearance.

java - Hibernate Criteria API - adding a criterion: string should be in collection -

i have following entity object @entity public class foobar { ... private list<string> uuids; ... } now i'd make criteria query fetch foobar pojos uuids list contains string "abc123", i'm not sure how make appropriate criterion. i assume using version of hibernate implements jpa 2.0. here's jpa 2.0 solution should work compliant implementation. please annotate uuids jpa's @elementcollection annotation. don't use hibernate's @collectionofelements mentioned in of other answer comments. latter has equivalent functionality being deprecated . foobar.java approximately this: @entity public class foobar implements serializable { // might have other id @id private long id; @elementcollection private list<string> uuids; // getters/setters, serialversionuid, ... } here's how can build criteriaquery select foobar s uuids contain "abc123". public void getfoobar...

How do I OPEN a stored excel file in SQL Server 2008 via C# -

i have stored excel file in sql server 2008 db (as varbinary(max)) following (so far, hard coded) way: // c# - visual studio 2008 var update = new sqlcommand("update requests set attachment = @xls" + " requestsid = 27", conn); update.parameters.addwithvalue("xls", file.readallbytes("c:/afolder/hello.xlsx")); update.executenonquery(); it works, i want open too ! how do that? note, not read blob-data, open actual "hello.xlsx" file. i have tried following: http://dotnetsoldier.blogspot.com/2007/07/how-to-retrieve-blob-object-in-winforms.html can see works, "binary.length" size of "hello.xlsx" when executing - file doesn´t open, , that´s problem. please me out! edit: here code use "open" spreadsheet: sqlconnection conn = new sqlconnection (global::my_project.properties.settings.default.db_1connectionstring); conn.open(); sqlcommand cmd = new sql...

refactoring - How could I reduce PHP code with lots of isset checks and repetitive, but variable generation arguments? -

greetings. struggling reduce code segment looks rather lengthy, leaving me unconvinced essentiality. it's function generate multitude of session arrays used fill out forms, , has me verifying existence of values in argument array, cases every single 1 generate requested arrays. here goes: function prepoptional($formdata) { $baseinfo=getbaseinfo(); $_session['foodata'] = (isset($formdata['cbfoo']) ? prepbaseform($baseinfo, 'foo', 'option foo') : ''); $_session['opt1data'] = (isset($formdata['cbopt1']) ? prepbaseform($baseinfo, 'opt1', 'option 1') : ''); $_session['bardata'] = (isset($formdata['cbbar']) ? prepbaseform(prepotherarray($formdata), 'bar', 'option bar', 'optional argument') : ''); } the function accepts formdata array argument, , depending on contained values generates corresponding...

SQL Server (Not Express) + Visual Studio Express (vb.net) - Connection possible? -

i couldn't find quick answer on official pages, possible write vb projects in express edition of visual studio connect sql server not included 'express' server ? any hints appreciated :-) yes, there no restrictions of kind on visual studio express, can connect version of sql server.

html - PHP - DOMDocument - remove tags around text based on class -

i have html document want remove specific tags from, identified specific class. tags have multiple classes. simple example of markup have: <style>.c{background-color:yellow}</style> <span class="a b c">string</span>. <span class="a b c">another string</span>. <span class="a b">yet string</span>. i want able parse through string (preferably using php's domdocument?), finding <span> tags class c result this: <style>.c{background-color:yellow}</style> string. string. <span class="a b">yet string</span>. basically, want remove tags around text, preserve text on document. update: think i'm close, doesn't work me: $test = '<style>.c {background-color:yellow;}</style>' . 'this <span class="a b c">string</span>.'. 'this <span class="a b c">another string</span>....

arrays - unboxing, (sparse) matrices, and haskell vector library -

i manipulate matrices (full or sparse) efficiently haskell's vector library. here matrix type import qualified data.vector.unboxed u import qualified data.vector v data link = full (v.vector (u.vector a)) | sparse (v.vector (u.vector (int,a))) type vector = u.vector as can see, matrix vector of unboxed vectors. now, dot product between vector , matrix. simple combining sum, zip , map. but if that, because i'm mapping through rows of matrix, result boxed vector, though unboxed. propagates output (field src) (full weights) = v.map (sum out) weights out = u.map output src sum s w = u.sum $ zipwithfull (*) w s propagates output (field src) (sparse weights) = v.map (sum out) weights out = u.map output src sum s w = u.sum $ zipwithsparse (*) w s zipwithfull = u.zipwith zipwithsparse f x y = u.map f' x f' (i,v) = f v (y u.! i) how can unboxed vector result efficiently ? i don't know field type is, d...

android - How to create a RelativeLayout programmatically with two buttons one on top of the other? -

i'm adding 2 buttons ui, appear on top of 1 another. want them appear next each other. missing in code? m_btncrown = new imagebutton(this); m_btncrown.setimageresource(r.drawable.king_crown_thumb); m_btncrown.setalpha(100); relativelayout.layoutparams lp = new relativelayout.layoutparams( relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); lp.addrule(relativelayout.align_parent_top); addcontentview(m_btncrown, lp); m_btnmonkey = new imagebutton(this); m_btnmonkey.setimageresource(r.drawable.monkey_small); m_btnmonkey.setalpha(100); lp = new relativelayout.layoutparams( relativelayout.layoutparams.wrap_content, relativelayout.layoutparams.wrap_content); lp.addrule(relativelayout.align_parent_top); lp.addrule(relativelayout.right_of, m_btncrown.getid()); addcontentview(m_btnmonkey, lp); i have written quick example demonstrate how create layout programmatically. public class codelayout extends activity { @overri...

Clear a kml that was added to google earth using javascript -

i have added kml google earth use of button javascript. how can delete kml or clear kml's use of button? thanks to remove features can use following method. presumes 'ge' references plug-in object. function removeallfeatures() { var features = ge.getfeatures(); while (features.getlastchild() != null) { features.removechild(features.getlastchild()); } }

Override Javascript Function Based on Passed Parameters -

is possible override function based on number of parameters passing it? instance: function abc(name) { document.write ('my name is' + name); } function abc(name,friend) { document.write ('my name is' + name + 'and best friend\'s name is' + friend); } so in html if called abc(george) use first version of function, if called abc(george,john) use second version. there may other ways accomplish example used, i'm wondering if concept sound in javascript. javascript not support function overloading. you can, however: if (typeof friend === "undefined") { // } else { // else }

c++ - Function that copies into byte vector reverses values -

hey, i've written function copy variable type byte vector, whenever insert gets inserted in reverse. here's code. template <class type> void packet::copytobyte(type input, vector<uint8_t>&output) { copy((uint8_t*) &input, ((uint8_t*) &input) + sizeof(type), back_inserter(output)); } now whenever add example uint16_t value 0x2f1f gets inserted 1f 2f instead of expected 2f 1f. what doing wrong here ? regards, xeross if on little-endian machine (e.g., x86), bytes appear reversed (i.e., lower order bytes appear before higher order bytes). if want reverse order of bytes, can use std::reverse .

Start using Ruby on Rails, Web Services and OAuth -

i running ruby on rails 3 , create application app1 acts web service . create ror application app2 can communicate (send/get information) app1 using oauth protocol. what have start (i not expert programming in topics read lot , know how conceptually\theoretically works) ? think implement custom code or maybe better use plugin or gem? why? if possible, can write todo list , steps accomplish aim? and, more important , can suggest me useful (awesome) resources (like books, blog posts, ...) about creating ror web services? assuming decide kind of web service want, , restful xml web service acceptable choice, rails applications practically default. when generate scaffolding code, controller ready interface restful web service. of course, that's not need know , do, subject seems covered following series of articles... http://css.dzone.com/news/rest-with-rails-part-1 http://css.dzone.com/news/rest-with-rails-part-2-serving http://css.dzone.com/news/res...

visual studio - Matching tag in HTML keyboard shortcut -

Image
is there shortcut in visual studio (2008) allow me jump matching html tag... ctrl+] matching braces when in code view? example: <table> <tr> <td> </td> </tr> </table|> cursor on closing table tag , press ctrl+] jump opening table tag. any ideas? ok here answer macro i've built (toggle ) including go focus : here demo : and here code , enjoy ! imports system imports envdte imports envdte80 imports envdte90 imports envdte90a imports envdte100 imports system.diagnostics imports system.windows.forms public module module2 sub begintoend() 'place cursor somewhere in beginning tag, run macro, select beginning end tag dte.activedocument.selection.selectline() dim objsel textselection = dte.activedocument.selection dim toppoint textpoint = objsel.toppoint dim ltopline long = toppoint.line objsel.gotoline(ltopline, false) ' dte.activedocument...

Get current orientation of iPad? -

in given event handler (not "shouldautorotatetointerfaceorientation" method) how detect current ipad orientation? have text field have animate (when keyboard appears) in landscape view, not in portrait view , want know orientation i'm in see if animation necessary. orientation information isn't consistent, , there several approaches. if in view controller, can use interfaceorientation property. other places can call: [[uidevice currentdevice] orientation] alternatively, can request receive orientation change notifications: [[uidevice currentdevice] begingeneratingdeviceorientationnotifications]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(orientationchanged:) name:uideviceorientationdidchangenotification object:nil]; some people check status bar orientation: [uiapplication sharedapplication].statusbarorientation

Java: Regular expression to strip out: %j or %f -

is there easy way strip out %j or %f out of string , replace int? like: xyz: %j num: %f becomes xyz: 12 num: 34 a simple way be: "xyz: %j num: %f".replace("%j", "12").replace("%f", "34");

php - Need Some Tutorial LInks -

currently php development use normal php, mean there's no orm layer or anything. new php , prefer know how write end codes orm in java , create php classes , retreive data front end. if knows tutorial links, pls provide me. great help thanks http://www.doctrine-project.org/

integer Max value constants in SQL Server T-SQL? -

are there constants in t-sql there in other languages provide max , min values ranges of data types such int? i have code table each row has upper , lower range column, , need entry represents range upper range maximum value int can hold(sort of hackish infinity). prefer not hard code , instead use set upperrange = int.max there 2 options: user-defined scalar function properties table in oracle, can within packages - closest sql server has assemblies...

php - output echo'd contents in browser while script is running? -

does know how output stuff echo browser while script running? i have long loop i'd output string after every run of loop, kind of progress bar, know how that? use ob_flush() function: ob_start(); //echo stuff... ob_flush(); //echo more stuff... ob_flush();

javascript - Browser Zooming Misaligned Workaround -

i have website when user zooms, lines no longer line in situations. unfortunately, don't have example show, know has lack of understanding of how zooming works. assume has things when zoom, pixel may end becoming 2 pixels because single old pixel gets drawn on half of 2 new pixels, depending on how zoom affects pixel orientation. are there workarounds dealing zooming on websites specified, pixel off noticeable? there 2 types of zoom. 1 increases fonts , other magnifies evenly. if issue second it's highly doubtful there can it. if it's first type @ how fonts expand , cases might want change relative units ems px (in general fonts specified in px don't zoom).

java - how can I create an application for mobile phone with .JAR extension? -

i want create photo dictionary .jar extension mobile phones,what right tool or language purpose ? i suspect want write called midlet using java me . the proper tools include the java sdk eclipse proper plugin such eclipseme (or compliant ide) the sun wireless toolkit (wtk) among other things contains emulator) a step-by-step introduction writing first midlet can found here: http://www.autexier.de/jmau/dev/j2me/j2me.html

C++ Boost bind value type -

i in documentation , source code cannot figure out how return value type of boost bind functor. trying accomplish following: 35 template<typename t,size_t n, class f> 36 boost::array<typename f::value_type, n> make_array(t (&input)[n], f unary) { 37 boost::array<typename f::value_type, n> array; 38 std::transform(input, input + n, array.begin(), unary); 39 return array; 40 } where f can bind functor. above not work because functor not have value_type. matter, there standard interface unary/binary functor far return value. solution: should result_type . equivalent defined argument_type , first/second_argument_type binary functions thanks doh. nevermind, it's result_type rather value_type . should delete question?

cython - Python: pyximporting a pyx that depends on a native library -

my pyx depends upon native library how can pyximport.install() it? auto-build in pyxinstall doesn't know link native library, build fails... you can still export correct ldflags / cflags before doing pyximport.install() : from os import environ environ['cflags'] = '-i/path/to/my/custom/lib' environ['ldflags'] = '-lpath/to/my/custom/lib -lcustomlib' import pyximport pyximport.install() however, pyximport should used in debug case. prefer setup.py method !

OpenXML sdk Modify a sheet in my Excel document -

i create empty template in excel. open template , edit document not know how change existing sheet. that's code: using (spreadsheetdocument xl = spreadsheetdocument.open(filename, true)) { workbookpart wbp = xl.workbookpart; workbookpart workbook = xl.workbookpart; // worksheet required name. // used match id required sheet data // because sheet class , sheetdata class aren't // linked each other directly. sheet s = null; if (wbp.workbook.sheets.elements().count(nm => nm.name == sheetname) == 0) { // no such sheet name xl.close(); return; } else { s = (sheet)wbp.workbook.sheets.elements().where(nm => nm.name == sheetname).first(); } worksheetpart wsp = (worksheetpart)xl.workbookpart.getpartbyid(s.id.value); worksheet worksheet = new worksheet(); sheetdata sd = new sheetdata(); //sheetdata sd = (sheetdata)wsp.worksheet.getfirstchild(); stylesheet stylesheet = workbook.workbookstylespart.stylesheet; //sheetdata sheetdata = new sheetdata(); ...

Is there any provision in VS 2008 to enter symbol file path as WinDbg? -

is there provision in vs 2008 enter symbol file path windbg? because project want debug contains lots , lots of dlls , hierarchy of dll folders deep. difficult task create hierarchy of directories every time. finally have come know can provide symbol files path same windbg in visual studio. please follow below steps: tools -> options -> debugging -> symbols this option there vs 2005 onwards (not sure previous versions of visual studio).

compiler construction - Left recursion elimination -

i'm attempting eliminate left recursion cfg eliminating indirect recursion direct recursion algorithm shows. i'll using grammar: a = a | b c | b c | d d when i = 1 , , j = 1 looking @ replacing productions of form a -> r with: a -> δ 1 γ | δ 2 γ | .. | δ k γ so when @ a -> a matches, should replace with a -> a | b c a | b c | d d which im sure wrong can point me in right direction how replace productions when replacing production itself? note : also, i'm stuck on first rule have omitted others simplicity any appreciated [update]found close original greek symbols could. also, perhaps approaching in wrong direction. when i=1 , j=1 , a j -> a | b c | b c | d d, should using a j -> b c | d d if get: a -> b c | b c b c | d d | d d b c | b c | d d as eliminate recursion in production. better direction? this recipe: a → aα1 | ... | aαm | β1 | ... | βn should transformed to: a → β1 a' | ... | βn...