Posts

Showing posts from May, 2015

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - C++ dll throwing assertion faliure -

i have program written in c# consumes dll written in c++. have source changing out of scope. there 2 files of type .pak , .jrn saved in application. location of these files configurable. if choose save in local location (somewhere on hard drive of machine running c# code) works fine. however, when try configure system store files in remote machine, assertion failure error in c++. this urgent. appreciated. thanks in advance, i notice configuring pakdir , not jrndir . guess jrndir points invalid file path on remote machine.

User has .NET Framework or not -

is there way find out user have installed .net framework 2.0 or not in browser? when browse microsoft internet explorer 6.0 beta, you may receive user agent string similar following: user agent :: mozilla/4.0 (compatible; msie 6.0b; windows nt 5.1; .net clr 1.0.2914 ) reference 1 , reference 2

Disabling PDF toolbar in JavaScript -

how disable pdf toolbar using javascript when using window.open(fi,fnam,items) i used toolbar='no' disables explorer toolbar. need if want disable pdf toolbar inside explorer? that part of acrobat plugin, , i'm reasonably sure isn't possible manipulate javascript browser.

Dependency Injection in PHP 5.3 -

i trying tidy application, , have manually been doing constructor dependency injection while. this bit tedious, , start utilizing dependency injection container instead. i looking actively developed , maintained di container. have found crafty alternative, can wire dependencies xml, yaml, arrays or programatically. the di container should not tightly coupled full blown framework, looking simple , pluggable, least hassle possible. does have recommendation , why chose particular implementation? reading. since people seem comment, post answer. not have experience of it, know of symfony dependency injection library. should decoupled rest of framework , seems pretty flexible. check out @ symfony components . i think substrate looks pretty good. according author, has production experience, good.

html - jQuery - draggable images on iPad / iPhone - how to integrate event.preventDefault();? -

i use jquery, jquery ui , jquery mobile build web application iphone / ipad. create images , should draggable, did this: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>drag - test</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /> <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script> <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script> </head> <body> <div> <div style="width:500px;height:500px;border:1px solid red;"> <img src="http://upload.wikimedia.org/wikipedi

c# - Getting an int value out of an object -

when use following code feels i'm going wrong somewhere. object obj = 1; int = int.parse(obj.tostring()); is there simpler way? well, actually in obj ? if boxed int , cast unbox: int = (int)obj; for less predetermined content might try: int = convert.toint32(obj); which handle number of scenarios , doesn't add string in mix.

Hibernate, Postgresql: Column "x" is of type oid but expression is of type byte -

i have strange problem regarding hibernate mapping containing large objects (blob), when switching between different databases. @lob private byte[] binarydata; the field above creates byte array field in mysql , in oracle, in postresql creates field of type oid. now when try access field works fine in other databases, in postgresql fails following error column "binarydata" of type oid expression of type bytea. so tried remove "@lob" annotation, solve problem postgresql, in mysql without annotation, hibernate creates field of type "tinyblob", small in of our cases. and, want use project in more 1 environment annoying have 2 different mappings switch. is there annotation forces postgresql use bytea instead of oid fields annotated @lob? or somehow possible omit @lob , put else in order force mysql allocate larger datatype using @lob? i imagine have solution this if (field of type oid) store oid else if (field of type bytea) store bytea

How to start an application using Python -

i want use python script start application, , click file open file. how should accomplish this? example, want write script starts automation tool/program have. is there scripting language better suited this? you appreciated! if understand question correctly want load program using python, if should try this: import os acrord = r"c:\program files\adobe\acrobat 5.0\reader\acrord32.exe" os.system ('"%s" %s' % (acrord, r"c:\temp\blah.pdf")) as found here also: http://mail.python.org/pipermail/python-win32/2004-april/001868.html

Extjs. Can't catch write event after store.save() with create action -

i'm trying handle event after creating new record extjs store , saving server. have problem - write event firing after update action. documentation says: @event write fires if server returns 200 after ext.data.api.actions crud action. success of action determined in result['successproperty']property (note restful stores, simple 20x response sufficient actions "destroy" , "update". "create" action should should return 200 along database pk). now i've such response server: [{"tid": 5, "action": "citygrid", "type": "rpc", "method": "create", "result": {"msg": "saved", "data": {}, }}] i guess adding database.pk of created object server response should resolve problem i've no idea how it. i've tried ... "data": {"id":my_object.id} no effect. this example: http://dev.s

asp.net - User in student role automatically -

in asp.net(c #) want automatically add new users when sign in particular role (student role) have managed role how can automatically add them or in more simple words i want new users in student role default what codes , processure please !! in createduser event of create user wizard add line roles.addusertorole(createuserwizard1.username, "student");

Mysterious Ruby Block behavior: &block vs. {block.call} -

when writing helper printing javascript can used both other helpers , views, stumbled upon following problem: def javascript(print_tag = false, &block) content_for(:javascript) if print_tag javascript_tag(&block) # not work javascript_tag { block.call } # work else capture(&block) end end end this helper should called javascript { "alert('hurray'); } . in first alternative - expected work - rails javascript_tag helper renders empty <script type="text/javascript"> //<![cdata[ //]]> </script> tag. the second alternative, however, works expected. what's going on there? how can different? you doing on views, right? <%= javascript { "alert('hurray');" } %> but content_tag(&block) work, should call javascript way content_tag intended used in views, is: <% javascript %> alert('hurray'); <% end %> content_t

javascript - Getting the following code to work in both Chrome and Safari -

can't seem figure out why works in safari not in chrome. appreciated. //create or use existing db var db = opendatabase('mytest', '1.0', 'myspecialdatabase', 200000); if (db) { //new transaction db.transaction(function (tx) { tx.executesql('drop table if exists foo'); tx.executesql('create table if not exists foo (id unique, text)'); //insert test data tx.executesql('insert foo (id, text) values (1, "mytest")'); tx.executesql('insert foo (id, text) values (2, "another")'); tx.executesql('insert foo (id, text) values (3, "andyetanother")'); tx.executesql('insert foo (id, text) values (4, "ohandagain")'); }); alert("db success"); } else { alert("oooops"); } db.transaction(function (tx) { // loop rows of db, print values tx.executesql('select * foo',[], function (tx, results) { var ro

sql - Numbering of groups in select (Oracle) -

i have following example - table name, department , country. need create select statement lists records , assigns unique number each group of department , country (column group in example): name department country group ====== ============ ========= ===== james hr uk 1 john hr uk 1 alice finance uk 2 bob finance de 3 frank finance de 3 i thought of select analytic function found row_number() on (partition department, country) numbers records inside group , not groups themselves. have idea how solve problem? thank you! select t.*, q.grp ( select q.*, rownum grp ( select distinct department, country mytable order department, country ) q ) q join mytable t on t.department = q.department , t.country = q.country or select t.*, dense_rank() on (ord

jquery - How do I define the trigger events 'beforesend' in this plugin? -

probably simple question, cannot figure out. in plugin: https://github.com/brianmario/jquery-infinite-scroll the readme says fires 'infinitescroll.beforesend', how assign own function without modifying plugin? matt use bind() attach event handler ( infinitescroll.beforesend custom event fired plugin): $(window).bind('infinitescroll.beforesend', function() { // });

c# - Is Autofac ContainerBuilder.Build an expensive operation? -

i'm starting use autofac , can't seem find answer question. also, when should call containerbuilder.build() ? after call containerbuilder.build() possible register type or instance? containerbuilder.build() should called during application startup before start invoking business behavior. if need register additional components existing container can. in autofac v2.2 (or later), can create containerbuilder instancer , use containerbuilder.build(icontainer) overload method.

elisp - Delete only first appearance of element into list? -

how delete first appearance of element list (elisp) ? you can use elisp (which requires cl ): (defun remove-first (elt seq) (let ((remove-first t)) (remove-if (lambda (e) (when (and remove-first (equal elt e)) (setq remove-first nil) t)) seq))) note: makes copy of original list. 1 using side-effects, try this: (defun remove-first* (elt seq) (if (equal elt (car seq)) (cdr seq) (while (cdr seq) (if (equal elt (cadr seq)) (progn (setcdr seq (cddr seq)) (setq seq nil)) (setq seq (cdr seq)))) seq)) note: when first element 1 removed, cdr returned, type of operation, invoke so: (setq mylist (remove-first* 3 mylist))

.net - Common Dialog for selecting a SQL Server and getting login details? -

Image
my application needs ask user sql server connect , credentials use connection, , wondering if there's dialog box out there has built - functioning openfiledialog comes framework (in .show it, can ask file picked), looking login box sql management studio. ideally, i'd .show dialog, , once finished, .connectionstring property returned string associated details picked. if once doesn't exist, i'd start process create it, because imagine helpful people able drop on form , have getting database connection user taken care of. yes, 'connection properties' dialog box used within visual studio available stand-alone component: http://code.msdn.microsoft.com/connection

c++ - why do we even need VPTR? -

and why don't use same method non virtual functions? i mean, why use virtual functions in way? can't use them non-virtaul ones , override them? and if method saving time/space or ever, why don't use same method non-virtual functions? mean make sense there 1 table of functions specific class. anyway, in advance, bit confused. you can't have run-time polymorphism without using level of indirection. that's vptr for. the vptr not used non-polymorphic functions because indirection costs something. c++ philosophy don't pay don't use. edit: here's info on how virtual tables work: http://en.wikipedia.org/wiki/virtual_table

Java generics - ArrayList initialization -

it known arraylist init. should this arraylist<a> = new arraylist<a>(); arraylist<integer> = new arraylist<number>(); // compile-time error so, why java allow these ? 1. arraylist<? extends object> a1 = new arraylist<object>(); 2. arraylist<?> a2 = new arraylist<integer>(); then, if correct why doesn't allow these ? 1. a1.add(3); 2. a2.add(3); the compiler message : method add(int, capture#1-of ? extends object) in type arraylist not applicable arguments (int) more general 1. a1.add(null e); 2. a2.add(? e); i read hear you. thanks the other amusing point : arraylist<arraylist<?>> = new arraylist<arraylist<?>>(); // correct arraylist<?> = new arraylist<?>(); // wrong. know it's reason have question in mind mentioned above you can't assign list<number> reference of type list<integer> because list<number> allows types of number

.net - Invoke a ContextMenu to open -

i need google maps (but in wpf ): when rightclick on map have contextmenu. when rightdoubleclicking have unzoom action. so, apparently, little difficult in wpf... after struggling , searching lot, read people compains "we can't predict future" (i ask myself how google predict it), decided "wait" systeminformation.doubleclicktime , display contextmenu. surely, not ideal, human-observable, don't know other method. so, problem have following code (i have custom canvas): contextmenueventargs lastcontextmenueventargs = null; bool? lastcontextmenueventargshandled = null; protected override void oncontextmenuopening(contextmenueventargs e) { lastcontextmenueventargs = e; lastcontextmenueventargshandled = e.handled; e.handled = true; //base.oncontextmenuopening(e); } bool rightmouseclickedonce = false; protected override void onpreviewmouserightbuttonup(mousebuttoneventargs e) { //base.onpreviewmouserightbuttonup(e);

ASP.NET AJAX 4.0 Live binding - Issue with Sys.registerComponent -

i trying design client template using ajax 4.0 framework live binding. i have wcf service defined called vesseldata (will provide code if needed) returns datatable class called vesselcollection. also, referencing following scripts in master file: microsoftajax.debug.js, microsoftajaxdatacontext.debug.js, microsoftajaxtemplates.debug.js. the problem templates donot fill data, , fetchdata method on datacontext goes failcallback method without way know went wrong. moreover, several javascript errors "object doesnt support property or method" on "sys.registercomponent" inside 1 of .js files. please, need here.. code : < %@ page title="" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codebehind="vessels.aspx.cs" codefile="~/vessels.aspx.cs" inherits="sampleajaxdatabinding.vessels" %> < %@ register assembly="ajaxcontroltoolkit" namespace="ajaxc

computer science - Implementing a queue by Turing machine -

how can implement queue turing machine? just in case other students come looking answer question, here's idea... we'll use multi-tape tm make painless possible. let 1 of tapes queue want implement. add queue, move right until hit blank square, add symbol queue. remove queue, move left until hit blank (assuming tape starts single blank square), move right, , remove what's on tape , put blank in place. so, starting blank queue d blank , tape alphabet abc, here's how following transaction sequence look: enqueue(a) ( 1- 3) enqueue(b) ( 4- 5) enqueue(c) ( 6- 7) dequeue(-) ( 7-11) enqueue(c) (12-15) dequeue(-) (16-20) enqueue(b) (21-24) here's trace of tm on queue tape: 1. dd 2. ddd 3. dad 4. dadd 5. dabd ^ ^ ^ ^ ^ 6. dabdd 6. dabcd 7. dabcd 8. dabcd 9. dabcd ^ ^ ^ ^

google app engine - How to disable gae python to check for updates every time I start a server in eclipse? -

i hate seeing 20sec every time run server: appcfg.py:393] checking updates sdk . create or edit file .appcfg_nag in home directory. edit first line be: opt_in: false

Click handler for Android ListView -

i trying find out how implement click handler items in listview in android. i have layout file looks this: <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollview03lr" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="vertical"> <linearlayout android:id="@+id/linear03lr" android:layout_width="fill_parent" android:orientation="vertical" android:gravity="center" android:layout_height="fill_parent"> <!--put form controls here--> <listview android:id="@+id/listview01" android:layout_width="wrap_content" android:layout_height="400dp" /> <button android:

SQL SERVER Query Help (using cursor?) -

the query below calcuates percertage of product between fy2009 vs. fy2010 california. assigned calculate remaining states (please see states table). there way in sql server calculate states percentages? manually calculate each state @ time. wondering if me this. happy holidays everyone!!! (please note, must use states table seperately due data integrity. thinking if cursor it, not there yet.) declare @location varchar(2) set @state = 'ca' select number1/cast(number2 float) percentage ( select count (product) number1 sometable1 location = @state , date >='10/1/2008' , date <' 10/1/2009' )x, ( select count (product) number2 sometable2 location = @state , date >='10/1/2009' , date <' 10/1/2010' )y percentage 1.400742 select state states state ca az tx nv nm ut or co wa you can join on states table. along these lines: select x.state, x.number1/cast(y.number2 float) percent

SQL Server 2005 need to move location of full text catalog? -

i'm looking @ sql server 2005 database has mdb , logs on e drive, reason has full text catalog on c drive. how move e drive? also note production single stand-alone server get name select name, physical_name currentlocation, state_desc sys.master_files database_id = db_id(n'<database_name>'); move alter database directum modify file (name=sysft_directum_main_mbtext,filename='c:\program files\microsoft sql server\mssql.1\mssql\ftdata\directum_mbtext\') go no need physically folders , files. mssql handle on own.

asp.net mvc - two nested model properties of same complex type -

i have customer model 2 complex properties "internaladdress" , "publicaddress" both of same model type address. in view doing following <h2>internal address</h2> <% renderpartial("address", model.internaladdress);%> <h2>public address</h2> <% renderpartial("address", model.publicaddress);%> it gets rendered without exceptions rendered html use same input-names both partialviews... is there smart way handle situation? it's you're combining functionality using partial views, since of time address rendered 1 way. one way display form using mvc2 editorfor , displayfor templates. move partial view form /views/shared/editortemplates/address.ascx (and display-only portion if have 1 /views/shared/displaytemplates/address.ascx). once that's done, can use 1 of 2 ways. option 1: you can edit viewmodel this: [uihint("address")] public address internaladdress { get; set;

python - Django Templates: Display a date only if it's in the future -

how compare dates in django template? thought of several possible avenues: send today's date in context compared @ template create own template tag have logic in view pass date if it's in future although last option seems easier, rather leave display logic in template in view. not want pass seems trivial today's date in template context. perhaps has option or share implementation of 1 of options mentioned above , why decided go route. i'd go template filter: from datetime import date ... @register.filter def future_dates_only(the_date): if the_date > date.today(): return the_date else: return none then in view like: {{specialdate|future_dates_only|date:"d m y"}}

php - Storing a multidimensional array as an object variable, adding additional keys to the array -

so have multidimensional array stored in object. want add additional keys array. here's have: $object->pathsarray = array( "key1" => array('path' => '/some/path/to/some/file.php', 'action' => 'index'), "key2" => array('path' => '/some/path/to/some/class.php', 'action' => 'method2') ); and here's assumed work did not: $object->pathsarray['key3'] = array('path' => '/some/path/to/some/method/or/script.php', 'action' => 'method3'); my first workaround: $newpathsarray = array("key3" => array('path' => '/some/path/to/some/method/or/script.php', 'action' => 'method3')); $object->pathsarray = array_merge($object->pathsarray, $newpathsarray); another workaround should work: $temppathsarray = $object->pathsarray; $temppathsarray['key3']

dotnetnuke - HTML Module: Set Default Workflow for Site option missing in 5.6 -

i updated dnn 5.6 , noticed in html module option set workflow site default missing. apparently removed in lastest ce release of dnn ( forum here ). is can set via sql in database? it appears ui accidentally removed ce version part of re-organization of html module in 5.6.0. here relevant code htmltextcontroller.updateworkflow case "site" portalcontroller.updateportalsetting(objectid, "workflowid", workflowid.tostring) if replaceexistingsettings 'get tabs aon site each kvp keyvaluepair(of integer, tabinfo) in tabcontroller.gettabsbyportal(objectid) tabcontroller.deletetabsetting(kvp.value.tabid, "workflowid") next 'get modules in current site each objmodule moduleinfo in modulecontroller.getmodules(objectid) clearmodulesettings(objmodule) next end if adding workflowid portal setting needed set workflow whole portal, important ensure tabs (pages) , html modules have specific workflow

django - Problem with ImageField and Admin Panel -

i know, topic there many time, there no clear answer: invalid literal int() base 10 i use django. want see pictures, i've uploaded, admin panel. in model it's imagefield. nothing sophisticated. what url image links point to? should give idea causing problem. make sure set media_url , has trailing / i'm guessing the admin pointing relative url. say... /admin/myapp/mymodel/3/images/my-image.png it's common error django admin because admin site expecting primary key.

Flex: Hide (or Remove) Label Text without Changing the Button Size -

i have button variable-length of label text. have user setting can turn on or off label text on button. how can implement this? note: button's background has gradient color. i tried using blendmode.layer, no luck; i tried using button.resizehandler private function resizehandler(event:resizeevent):void { if (event.oldwidth > this.width) this.width = event.oldwidth; if (event.oldheight > this.height) this.height = event.oldheight; } but worked if initial usersetting value true. how embedded font? don't know how apply button you can extend mx.controls.button add show/hide label function. text field protected property can set visibility on/off in function. leave flex measure correctly itself. if want grow/shrink button when text on or off, can set button width. have calculate width based on textfield width.

https - To use or not to use SSL? Why use SSL always? -

the argument using ssl prevent malicious user has gone through pains of snooping traffic being able read traffic. while may make sense if using unsecured wireless (non wpa2) network use ssl when logging on bank account or giving credit card number, find difficult see it's neccessaity in more common business cases. why bother ssl? (when client not going on unsecured wireless network) the way can snoop particular http connections , data therein if have admin access router (and if there facility monitor/copy traffic), installed tool on machine (a key logger of course pass ssl anyway) or monitor @ isp (for warrant required in jurisdictions). update warning jurisdictions not free may think, particularly 1st , 2nd world, e.g. in uk, government may not require warrant: http://en.wikipedia.org/wiki/communications_data_bill_2008 entail ability read websites historically (i.e. decrypt ssl) , us's "patriot act" http://en.wikipedia.org/wiki/us_patriot_act#title_ii:_s

javascript - Best approach for (cross-platform) real-time data streaming in PHP? -

i've been wondering how "true" (semi) real-time data streaming php. possible applications: chat rooms, auctions, games, etc. by "true", mean data not written somewhere , polled continuously, streaming client somehow. by "semi", mean it's okay if stream server client real-time, , messages client server not. for communication between client , server, i'd stick plain http (ajax) rather other protocol. streaming client http possible manually flushing output buffer. the question connect script on server-side? and once it's connected, blocking read, rather polling changes. the shared memory (shmop) extension work, it's not cross-platform. perhaps memcached work? i'm not sure if there's way blocking read, comes down polling again - although i'm sure memcached pretty fast, don't idea of continuous polling. any ideas? php not suited implementing realtime data streaming. php slow, , not designed b

c# - NHibernate Unit Of Work - Multiple Sessions (WinForms) -

i struggling learning curve nhibernate. we porting our c# winforms application use nhibernate , employing unit of work (unitofwork) detailed gabriel schenker. http://nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx we wish employ unitofwork on "conversational" basis. example when user opens form open unitofwork session , keep open until form closed. forms easier way define business conversation, may change depending upon implementation example, please use form opening , closing example. the problem exists when have scenario of form opening on top of form. in instance should have 2 unitofwork operating. 1 still active underlying form , new unitofwork new form. how implement this? unitofwork functionality provided gabriel allows 1 session per unitofwork? initial thoughts store sessions in dictionary sessions can called form or part of application. your thoughts? read through ayende's building desktop to-do applicat

osx - Get python script to run on boot up in mac -

how python script run everytime computer boots? how run shell script on startup (osx) and in script call program python path/to/yourscript.py edit: since 2010 above link has gone sour. since 2010 have answers popped describe similar methods, eg. running script upon login mac how shell scripts run on startup - yosemite

Compound/Complex C-String in Xcode/Cocoa -

i creating sqlite3 program. creating database within code. have 15 columns. example below: nsstring *createsql = "create table if not exists fields (date text primary key, name text, /*column #1 */ class text, /*column #2 */ ... completed text);"; /*column #15 */ when compile getting "missing terminating character error. did research , saw because c-string process cr\lf continuation character. don't want create line of codes scrolls right margin of screen every time need sql. there way can create string can broken on separate lines without getting error? two things: you need @ character before string begins. nsstring literals @"look this" . your string split on multiple lines, confusing compiler (this error you're seeing). need have entirely on 1 line. if want split this, wrap each line in quotes, this: _ nsstring * foo = @&quo

Export the types of variables in a SAS dataset -

is there easy way capture , export type of each variable in sas dataset? i'm exporting dataset csv format read r, , read.table procedure in latter can work more efficiently if knows data type of each variable. proc contents has out= option ouput dataset variable attributes. type=1 numeric , type=2 character. hth. proc contents data=sashelp.class out=vars; run; proc print data=vars noobs; var varnum name type length; run; /* on lst varnum name type length 3 age 1 8 4 height 1 8 1 name 2 8 2 sex 2 1 5 weight 1 8 */

html5 - Box with multiple borders -

i trying code , style box contain post. problem multiple borders (i guess), trying find best way code this, prefer semantic html5 , css3, if there no other way, can "old style" 3 divs (top, center, bottom) css background: url..., can give me lights please? if please check following url, can check need accomplish. http://dl.dropbox.com/u/3696224/postbox.jpg if notice has: one border around box dark gray (#cccccc); (border) a small space between border , other light gray (#f7f7f7), white; and content white background; any suggestions? sorry english grammar, in advance. regards ps - forgot, don't know if needed or not, around box have box-shadow (i know how part) you need 2 different <div> elements; 1 each border want. html <div class="outer"> <div class="inner"> content </div> </div> css /* colors sampled image linked in op */ .outer { border: 1px solid #c8c8c8;

machine learning - Paraphrase evaluation corpora -

is there corpus other msrpc (microsoft research paraphrase corpus) evaluating paraphrase recognition approaches? i'm using msrpc i'm in need of other corpora evaluating approach. there's twitter paraphrase corpus: http://alt.qcri.org/semeval2015/task1/ you can email organizers ask data.

image - Is it possible to use the default android loading animations on an ImageView? -

i know android uses own loading animations through included android.jar...however have not been able them work imageview correctly. instance, following code gives me error in xml file says image not public...is there anyway work correctly or possible? <imageview android:layout_height="wrap_content" android:id="@+id/loadingimg" android:layout_width="wrap_content" android:paddingtop="6px" android:paddingleft="6px" android:src="@android:drawable/spinner_white_16"> </imageview> i know possible slice loading gif , use animation-list convenient use android's images.

php - converting a timestamp to "X second(s) ago", "X minute(s) ago", "X hour(s) ago" etc -

does if php has built in functionally this? thanks just found function needed http://www.php.net/manual/en/function.time.php#89415

How do I parse a website in python once I know its url? -

if know url of wiki site , how use python parse contents of ? this broad question, first things reach urllib , handle downloading part, , beautiful soup , parsing. gluing them , writing code extract information parse tree you.

mercurial - How to ignore certain folders in HG? -

i have project folder - project. in project have other sub projects - subproject1, subproject2, subproject3. in each sub project have folders, among have bin , obj. however, want latter ignored such when commit don`t have changes made bin , obj. how can that? you'll need edit .hgignore file, , include following lines: glob:bin\ glob:obj\ you want @ least these other things well: glob:*.user glob:*.suo glob:_resharper.*\ there's other examples out there of more complete .hgignore files.

wpf - How to disable a button dynamically -

i want gray out button dynamically. how that? in xaml <button name="mybutton">click me</button> in code behind mybutton.isenabled = false;

c# - Unit testing with Mocks. Test behaviour not implementation -

i had problem when unit testing classes calls other classes, example have class creates new user phone-number saves database , sends sms number provided. like code provided below. public class userregistrationprocess : iuserregistration { private readonly irepository _repository; private readonly ismsservice _smsservice; public userregistrationprocess(irepository repository, ismsservice smsservice) { _repository = repository; _smsservice = smsservice; } public void register(string phone) { var user = new user(phone); _repository.save(user); _smsservice.send(phone, "welcome", "message!"); } } it simple class how go , test it? at moment im using mocks dont it [test] public void whenregistreringanewuser_thenewuserissavedtothedatabase() { var repository = new mock<irepository>(); var smsservice = new mock<ismsservice>(); var userregistr

content management system - Membership/Forum Platform: Turn SMF into Portal, Import into Joomla, or Do Something Else? -

i've 1) php-based membership site , 2) smf forums. want integrate these things, have shared sign-on; want run php functions determine items display specific users, based on individual profiles (as measured values in database). so: would better (easier , less expensive build, more robust) make smf master login , member system, add on smf portal (such tinyportal or simpleportal), , add custom php , custom db tables enable membership functions have in mind... or better off using joomla cms, importing smf forums joomla forum system ninjaboard, , adding custom php... or bridging existing php-membership script (with neat php functions) smf (or mybb), trying hack dual-login system... or using other, integrated cms/forum, viscacha or tikiwiki? i assume using smf, , existing forums, main system robust , elegant way of doing this... i'd appreciate feedback , suggestions. :) best way going integrated solution, rather going bridging multiple solutions. my sugges

c# - How to put underline under button name -

i have button name "itemname", , want put underline under character "i" in "itemname", don't know how should this. please tell me how? you need use ampersand character ( & ) that: yourbutton.text = "&itemname"; see http://msdn.microsoft.com/en-us/library/az5a73z1.aspx .

shell - how to print proper error message -

i have following small shell script. value='testdir/imp' `mkdir -m 755 $value` echo $ the out put is $ ./dir.sh mkdir: failed make directory "testdir/imp"; permission denied 2 here want print error message text file how can this in case $ ./dir.sh 2 > log.file should put error message in file log.file

repository - How can I undo my last git add/commit? -

i edited file , did: git add file.py git commit -m 'fixed bug' i edited file , performed minor bug fix. don't want 2 commits, 1 after other, showing 'bug fix'. want 1 commit 'bug fixes'. how can undo last add/commit , change first commit message? i looking @ git reset , git revert , git undo commands don't want screw repo guess edit: found out how it: http://www.gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html if commited second change, reset first: git reset head^ now head @ first commit, , content of local files unchanged. git add <the file(s) second bug fix> git commit --amend -m'bug fixes' if tracked , changed file included second bug fix, can run instead, usual: git commit -a --amend amending commit this: adds changes in index previous commit (therefore need git add , or -a ) allows change commit message be careful, though: if have distributed first commit, other people'

html - How can give a width to a form tag? -

how can give width form? javier um... same way other element? <form style="width: 500px"> (or equivalent setting in css class, cleaner) this, however, works if form not set display: inline . in case, not able specify width.

java - Get the byte array of a CoyoteOutputStream -

how binary stream out coyoteoutputstream? outputstream out = getoutputstream(); // returns coyoteoutputstream object out.write(binary); out.flush(); is there way byte array in bytearrayoutputstream tobytearray() ? thank you.

Java Swing - How to sound beep before any JOptionPane? -

whenever show joptionpane in swing application fire beep before : toolkit.getdefaulttoolkit().beep(); joptionpane.showmessagedialog( myframe, "message", "title", joptionpane.information_message ); is there way apply first line automatically joptionpane in case forgot write in code ? you create own class has static method showmessagedialogandbeep() calls joptionpane.showmessagedialog , beeps before.

olap - How do I add KPI targets to my cube that are at a higher grain to my fact table? -

i have simple star schema 2 dimensions; course , student. fact table enrolment on course. have kpi values set use data in fact table (e.g. percentage of students completed course). working great. i need add kpi goals though different grain fact table. goals @ course level, should work @ department level, , whatever combination of dimension attributes selected. have numerator , denominators kpi goals want aggregate these when there multiple courses involved - before dividing actual percentage goal. how can implement this? understanding should have 1 fact table in star schema. in case perhaps store higher grain values in fact table? or create dimension these values in? or alternative solution? in cases expect kpi measures calculated existing measures in cube, can away idea of fact table changes, , set kpis calculated members in cube or mdx? your issue complicated kpi granularity being different, yes...but hide kpi measures when such level of granularity being

web services - Get input and output of a webservice? -

Image
i new using webservices , need find out input , output of webservice. have wsdl of webservice , xsd files. there script or utility use list of input fields webservice requires , output fields return? i tried using soapui , checking request 1 see fields of webservice, dunno how tell ones input , ones output. any pointers on appreciated. lot in advance! do mean this? thats design view of wsdl file in eclipse!

iphone - Compiler gives warning on performSelectorOnMainThread:@selector(delegateMethod) -

i have nsoperation wraps web service functionality. nsoperation has delegate messaged when operation over. as nsoperation lives on different thread have make call this: [delegate performselectoronmainthread:@selector(getdealersidsuccess:) withobject:result waituntildone:yes]; it works fine, gives me warning: warning: '-performselectoronmainthread:withobject:waituntildone:' not found in protocol(s) i agree compiler on one, sees delegate, checks protocol, finds no declaration of performselector method. my question is: can remove warning making call in different manner? my 2 guesses (1) write method called - (void) calldelegatemethodonmainthred { [delegate getdealersidsuccess:result] } and call through performselectoronmainthread, find solution cumbersome , extra, hard read, step on top of delegation. the second solution cast delegate type of parent object inside selector, plain crazy , goes against delegate encapsulation pattern. i appreciate

How can I implement a GWT callback url? -

i'm writing gwt application that's going use oauth. oauth provides ability 'callback' website via url pass along access key part of url parameters. my question this: gwt application, how can allow custom url pasted / redirected address bar? server request dead simple using tomcat server jsp, there way handle using pure gwt implementation? i can imagine following posible: write jsp page deployed gwt project store access key redirect user again main page of gwt application is there more pure way gwt? can call directly rpc service task? if call rpc service, supposed redirect user main page? can implement gwt client side code recognizes custom parameters passed url? what think best approach this? see com.google.gwt.user.client.window.location.replace(string newurl), bad news lose internal history. here blog entry of 1 person's experiences oauth , pure gwt solution . there gwt example project oauth .

javascript events - How can I export HTML table to Excel using mozilla 3.6? -

i have table in html format. idnamemonthsavings 101rameshjanuary$100 102ramfeb$200 103ramnamar$300 </body> </html> i using mozilla 3.6 .so on me how can export results excel sheet ? regards joseph i don't think html technology looking for. if have csv file can imported excel view information.

How to create such a gridview like below with Actionscript 3? -

Image
each box click-able label toggles color when clicking. the total number of labels dynamical. how create such grid view pure actionscript 3? if i'd created box class extending sprite , coords-managing container them :)

C# SDK's for IIS -

Image
does know sdk's needed iis6.0 development , download links? keep finding http://msdn.microsoft.com/en-us/library/ms525041%28v=vs.90%29.aspx no link download actual sdk. visual studio 2008 there's nothing download. use system.directoryservices namespace. here's example: http://www.codersource.net/asp-net/asp-net-advanced/iis-metabase-and-programmatic-administration-in-c.aspx update i've never heard of "iis developer toolset". don't think such thing exists. however, might referring iis 6 configuration tools. screen shot shows options iis 7. go add/remove windows features on windows server , install iis admin tools.

c# - Data paging with a data table -

i've got datatable stores number of records. there column called id autoincrememted seed of 1. i have implemented paging control. know id of first , last record need display, don't know how extract specific rows datatable, or whether indeed possible. possible, or need use dataset example? im using cms product called sitefinity, dont have access db use sqldataadapter or similar, this might not elegant solution might work you. i'm assuming you'll able figure out start index , next index based on code below. datatable dt = gettable(); // represents datatable coming datatable temp = dt.clone(); datarow[] rows = dt.select("id >= 1"); //insert next begining index int pagesize = 5; int ctr = 0; foreach(var row in rows) { datarow r = temp.newrow(); r["id"] = row["id"]; r["name"] = row["name"]; temp.rows.add(r); //its neccesary create new datarow or you'll exception if u add row belong

ruby on rails - How can I compute the average request duration? -

i need sizing evaluation application, , 1 key metric average request duration. is there way can run tests (not using rspecs) , framework can tell me average time takes request go through, , tell me slowest requests? there's lots of tools benchmarking... see http://guides.rubyonrails.org/performance_testing.html starting point. if app live, maybe give new relic try well. it's useful tool!

python - What can be used instead of ast module? -

in project evaluate json data extract information. code follows : conn = httplib.httpconnection(host) conn.request("get", "/done_json.php") r = conn.getresponse() data = r.read() tmp = ast.literal_eval(data) list = [] in tmp.keys(): list.append(tmp[a]) how can change python 2.4 compatible ? sample of json : {'key_64': {'size3': 'cndcrncdf3fy09xl7uubcbcptye4h7ybg1i5milnbw172bmhvi.png', 'id': 'cndcrncdf3fy09xl7uubcbcptye4h7ybg1i5milnbw172bmhvi', 'size2': '', 'size1': 'http://dev.geco.com/site/2/cndcrncdf3fy09xl7uubcbcptye4h7ybg1i5milnbw172bmhvi.png'}, 'key_65': {'size3': 'cndcrnehlw2xffcc90pde77eejhjf6rc3r8pevuacb0c34h330.png', 'id': 'cndcrnehlw2xffcc90pde77eejhjf6rc3r8pevuacb0c34h330' (...) don't use ast.literal_eval , it's wrong thing job anyway. use simplejson.load(r) (or standard json module instead of simplejson in ne

data binding - Mixing dynamic and fixed items in Silverlight TreeView -

i'm attempting create treeview in silverlight contains both fixed elements , databound ones. able produce 1 creates desired effect, it's not perfect - highlights parent+child nodes single treeviewitem. the effect trying achieve is: personname |-age: |-hair colour: |-pets | |-petname | | |-species: | | |-size: | |-petname | . |-species: | . |-size: |-friends . |-name: . |-favourite comic: elements 'pets' , 'friends' should appear person, items beneath them. how can these templated? i've looked @ example here has static elements above databound ones. if structure databoundconference-->teams-->teamname,teamname,teamname instead of databoundconference-->teamname,teamname,teamname , it'd wanted. i hope i've explained correctly...

asp.net - How to get the physical controller class file path of the executing action method? -

assume current executing action method index() in home controller. within index(), how obtain physical file path of home controller? assume don't know file structure until runtime. the physical file (controller\home.cs) might not exist, since controller compiled .dll, , convention, stored in bin folder. if .dll want, in bin folder, or use getexecutingassembly within controller. you can find name of controller using: request.requestcontext.routedata.values["controller"]; you can store location of .cs files in web.config, enough find them. (beware of partial .cs files). finding controller method next step, since finding method right name not enough. have match parameters , attribute (httppost / actionname).

sql - c# ConnectionContext and EF will not break DB connection -

i'm creating program transfers database 1 sql server (on 1 pc) local instance. after transferring, api (entity framework) going connect , run things on it. disconnect, , 2 sql scripts ran on via sqlcommand class. after that, database backed , saved , local, temporary database dropped. problem i'm running sqlcommand instance first connects (before transfer takes place) creates database, disconnects without issue (i check active connections via management studio). once entities context connects, context.dispose() call, doesn't disconnect. create server instance run sql scripts (located in sub folder) code similar this: fileinfo file = new fileinfo(filename); string removerecords = file.opentext().readtoend(); file.opentext().close(); server srv = new server(new serverconnection(this.myscriptconn)); serverconnection srvconn = new serverconnection(); srvconn.nonpooledconnection = true; srvconn = srv.connectioncontext; server server = new server(srvconn); server.c

Lua: Why changing value on one variable changes value on an other one too? -

i think running code excactly mean. want register 5 names register( people ). loop 5 times , in each loop have variable newperson supposed save information person , added people register. in example names of people being registered simplicity. problem in end people turn have same name: "petra". playied bit can't reasonable reason behaviour. appreciated! local people={} local person={ name="johan", lastname="seferidis", class="b" } local names={"markus", "eva", "nikol", "adam", "petra"} --people register i=1, 5 --register 5 people local newperson=person local name=names[i] field=1, 3 --for each field(name, lastname, class) if field==1 newperson["name"]=name end --register name end people[i]=newperson end print("first person name: " ..people[1]["name"]) print("second person name: "..people[2]["name&qu

mapreduce - Hadoop namenode : Single point of failure -

the namenode in hadoop architecture single point of failure. how people have large hadoop clusters cope problem?. is there industry-accepted solution has worked wherein secondary namenode takes on in case primary 1 fails ? yahoo has certain recommendations configuration settings @ different cluster sizes take namenode failure account. example: the single point of failure in hadoop cluster namenode. while loss of other machine (intermittently or permanently) not result in data loss, namenode loss results in cluster unavailability. permanent loss of namenode data render cluster's hdfs inoperable. therefore, step should taken in configuration namenode metadata facebook uses a tweaked version of hadoop data warehouses; has some optimizations focus on namenode reliability. additionally patches available on github, facebook appears use avatarnode switching between primary , secondary namenodes. dhruba borthakur's blog contains several other entr

jQuery - Adding a TimeStamp to Injected Content -

i have along lines of: by default these panels empty. user actions can populate panels, , users can switch between panels. the problem have right switching between panels keeps refreshing content server, when it's been loaded, slow ui experience. i thinking of appending timestamp each of panel divs: <div id="panel-1" timestamp="13123131313"></div> and using timestamp determine if should rehit server, if it's under minute don't, if on minute refresh content. what i'm looking for: your thoughts on this? where can safely store time stamp? suggestions doing timestamp comparison. simple jquery solutions? thanks helping me think 1 through. you accomplish easily—with valid markup—using jquery's .data() method. something akin this: // store timestamp on initial ajax load var timestamp = new date().gettime(); $('#panel-1').data('timestamp', timestamp); // how retrieve last timesta

entity framework 4 - Microsoft SQL Server 2008 - 99% fragmentation on non-clustered, non-unique index -

i have table several indexes (defined below). 1 of indexes (ix_external_guid_3) has 99% fragmentation regardless of rebuilding/reorganizing index. have idea might cause this, or best way fix it? we using entity framework 4.0 query this, ef queries on other indexed fields 10x faster on average external_guid_3 field, ado.net query same speed on both (though 2x slower ef query indexed fields). table id(pk, int, not null) guid(uniqueidentifier, null, rowguid) external_guid_1(uniqueidentifier, not null) external_guid_2(uniqueidentifier, null) state(varchar(32), null) value(varchar(max), null) infoset(xml(.), null) --> 2-4k created_time(datetime, null) updated_time(datetime, null) external_guid_3(uniqueidentifier, not null) fk_id(fk, int, null) locking_guid(uniqueidentifer, null) locked_time(datetime, null) external_guid_4(uniqueidentifier, null) corrected_time(datetime, null) is_add(bit, not null) score(int, null) row_version(timestamp, null) indexes p

help me to write php code for this MySQL sql -

create table articles ( id integer not null primary key auto_increment , title varchar(99) not null , dateposted date not null , author varchar(99) not null ); create table article_rel ( this_article integer not null references articles (id) , related_article integer not null references articles (id) , primary key (this_article,related_article) ); i building article site, want show related article. can write code articles table , scratching heads how article_rel table. select a.* articles inner join article_rel ar on ar.this_article = some_article_id_here , ar.related_article = a.id brain fried, think it.

How should I include an external php file in magento module? -

i creating magento module, , need use 3rdparty classes "thiredpartyclassa" , "thiredpartyclassb" in external file "thirdpartycode.php". where should place file thirdpartycode.php ? , how should refer (require_once) if can use within 1 of action handlers ? thanks, eyal i ended creating lib directory under modules main directory. seemed "best of both worlds". $externallibpath=mage::getmoduledir('', 'my_module') . ds . 'lib' . ds .'externallib.php'; require_once ($externallibpath);

javascript - Prototype and jQuery concatenation failure -

edit: i've taken jquery , prototype libs out of equation, problem still remains. simplified test case 1 - without concatenation $ function decalared using window.$ in a.js, , declared in function notation in b.js. b.js loaded second, , overwrites a.js $ function simplified test case 2 - with concatenation combined a.js , b.js, first, , b second. function declaration i found strange when trying concatenate prototype , jquery. seems though when concatenated, $ jquery reference doesn't overwritten prototype. i've built 2 test cases single out, , it's failing in chrome8 , ff 3.6. test case 1 - without concatenation jquery , prototype loaded separately different script tags. jquery loaded first, prototype second. test case 2 - with concatenation jquery , prototype concatenated single file, , loaded single script tag. jquery first in script, , prototype added second. these should act identically, second test throwing errors because $ function in p

c# - How can I rotate triangle (clock-wise ) with CSGL? -

i'm trying make clock-wise rotating triangle, can not. made timer control result same without timer. result, below code not show rotating triangle. how can rotate triangle csgl? namespace windrawcoordinate { public partial class form1 : form { public form1() { initializecomponent(); } private float = 0.0f; private void form1_load(object sender, eventargs e) { timer1.start(); } protected void gosterim() { gl.glclear(gl.gl_color_buffer_bit); gl.glloadidentity(); hesapla(); ucgen(); } protected void ayarlar() { gl.glclearcolor(1, 1, 1, 1); gl.glshademodel(gl.gl_flat); } protected void hesapla() { += 0.5f; this.refresh(); } protected void ucgen() { gl.glcolor3f(0, 1, 1); gl.glrotate

wordpress - Rewriting date-based URL:s with .htaccess - solution? -

i've been able set proper permalink redirections in wordpress entering /%category%/%postname%/ , using below shown snippet .htacccess file. - working great! <ifmodule mod_rewrite.c> rewriteengine on rewritebase /subfolder/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /subfolder/index.php [l] </ifmodule> however when trying access links archived posts, such "december 2010" (shown in sidebar), page: http://localhost/subfolder/2010/10/ how can instead rewrite date-based requests following page? http://localhost/subfolder/archive/2010/10/ thanks ad prior last rule: rewritecond %{request_uri} !subfolder/\d{4}/\d{2} then add new rule e.g. rewriterule subfolder/(\d{4})/\d{2}/) archive/$1 [l]