Posts

Showing posts from February, 2014

asp.net mvc 3 - Allow a controller method from a non-logged user -

asp.net mvc 3 - Allow a controller method from a non-logged user - i have controller every method should restricted role=admin class instantiates with: [authorize(roles = admin)] every method takes on check. know can override attribute method method permit other user roles i'd remove authorization check 1 of methods in class. what's syntax that? thx here 1 approach may work: what's best way protect actions controller except 1 (login)? asp.net-mvc-3 authorize-attribute

php - Removing Break Lines -

php - Removing Break Lines - i've asked question before didn't seem right answer. i've got problem new lines in text. javascript , jquery don't things this: alert('text text); when pull info database table has break line in it, js , jquery can't parse correctly. i've been told utilize n2lbr(), doesn't work when uses 'shift+enter' or 'enter' when typing text message (which problem). still end separate lines when using it. seems correctly apply br tag after line break, still leaves break there. can provide help here? message info jquery , send off php file storage, i'd prepare problem there. this wouldn't problem normally, want pull of users messages when first load inbox , display them via jquery when select message. you utilize regexp replace newlines spaces: alert('<?php preg_replace("/[\n\r\f]+/m","<br />", $text); ?>'); the m modifier match across...

python - sqlobject: leak memory using selectby method -

python - sqlobject: leak memory using selectby method - i had discovered using selectby method sqlobject there leak memory. for example, when execute code: connection = connectionforuri('postgresql://test:test@localhost/test_sql_object') tran = connection.transaction() sqlhub.threadconnection = tran class person(sqlobject): firstname = stringcol() middleinitial = stringcol(length=1, default=none) lastname = stringcol() iteration in range(20): start = datetime.now() key in range(1000): person = person.selectby(firstname='name%s%s' % (iteration,key)) if person: select = person[0] end = datetime.now() print "time ",iteration,':' , end - start and result is time 0 : 0:00:03.328198 time 1 : 0:00:03.382905 time 2 : 0:00:03.690991 time 3 : 0:00:04.436301 time 4 : 0:00:05.021656 time 5 : 0:00:05.393993 time 6 : 0:00:05.791572 time 7 : 0:00:06.151833 time 8 : 0:00:06.517327 ...

java - Does anyone know the name of this "LookAndFeel"? -

java - Does anyone know the name of this "LookAndFeel"? - does know name of "lookandfeel"? or @ to the lowest degree know similar one? it's amazing , wish utilize program. http://www.axbo.com/webstart/axbo.jnlp it called syntheticawhitevision . http://www.jyloo.com/synthetica/themes/ (it 5th on page) how found this: download , save jnlp . jnlp plain text file. open , see somewhere in file this: <resources> <jar href="axbo.jar" main="true"/> <jar href="lib/absolutelayout.jar"/> <jar href="lib/rxtxcomm.jar"/> <jar href="lib/commons-beanutils.jar"/> <jar href="lib/commons-logging-1.1.jar"/> <jar href="lib/commons-digester-1.8.jar"/> <jar href="lib/infactory-utils.jar"/> <jar href="lib/jcommon-1.0.9.jar"/> <jar href="lib/jfreechart-1.0.5.jar"/> ...

php - Wordpress: How to scale large image width? -

php - Wordpress: How to scale large image width? - the big size images break wordpress theme layout (exceeding width of post). have noticed 20 10 theme scale big size images width nicely (by reducing width , height). want same thing, how can that? you need add together functions.php add_theme_support( 'post-thumbnails' ); then utilize smaller image in post like: the_post_thumbnail(). the default size 50/50, can either alter or add together more sizes: to alter default size do set_post_thumbnail_size(); and add together sizes do add_image_size( $name, $width, $height, $crop ); wordpress automatically creates multiple versions of images in different sizes. in later versions there 3 sizes, thumbnail, medium , large, beingness created you. utilize these or size added using add_image_size do: get_the_post_thumbnail($post->id, 'medium'); // utilize medium size, replace medium whatever size. to utilize thumbn...

javascript - ? marks coming from reverse geocoded response -

javascript - ? marks coming from reverse geocoded response - so russian federation made reverse geocoding response website. parse json , concatenate city , state 1 string on client side. concatenated string ended being: ???? ?????-?????????, ?????? is there situation google send ? marks through json reverse geocoded response? latitude/longtitude correct. when made same json post straight through browser got right response: http://maps.googleapis.com/maps/api/geocode/json?latlng=60.0486851,30.3197483&sensor=true anyone have ideas? could because accessing json usa, , accessing russia? edit: concatenation happens here: first results: geocoder.geocode({'latlng': realusersloc}, function(results, status) { if (status == google.maps.geocoderstatus.ok) { if (results[1]) { var loc = getcitystate(results); function getcitystate(results) { var city = ''; var state = ''; var bad = ''; var...

replace - Prolog - Term replacement, Term alteration in workflow graphs -

replace - Prolog - Term replacement, Term alteration in workflow graphs - in link ( meta interpreter ) believe have found nifty way of solving problem have tackle, since prolog bad i'd first inquire if possible have in mind. i want transform parts of workflow/graph depending on set of rules. graph consists of sequences (a->b) , split/joins, either parallel or conditional, i.e. 2 steps run in parallel in workflow or single branch picked depending on status (the status not matter on level) (parallel-split - (a && b) - parallel-join) etc. graph has nodes , edges, form of using terms want rid of edges. furthermore each node has partner attribute, specifying execute it. i'll seek give simple illustration want achieve: a node called a, executed partner x, connected node called b, executed partner y. a_x -> b_y seq((a,x),(b,y)) if observe pattern this, i.e. 2 steps in sequence different partners, want replaced with: a_x -> send_(x-y) ->...

php - about using ajax -

php - about using ajax - i'm displaying cotntent of text file on web page(say between <div id='text'></text> ) file's content edited user view page, utilize ajax write file , display current user, if there users browsing page @ same moment have refreh page see new edited content. want know how utilize ajax create part contain file content remain updated continmuosly without refreshing page <script type='text/javascript'> function change(){ if (window.xmlhttprequest) xhr=new xmlhttprequest(); else xhr=new activexobject("microsoft.xmlhttp"); //ie5 xhr.onreadystatechange=function() { if (xhr.readystate==4 && xhr.status==200) { if(xhr.responsetext=="empty") return; document.getelementbyid("space").innerhtml=xhr.responsetext; } } var str=document.getelementbyid('msg').value; document.getelementbyid("msg...

Django How to work with MultipleChoiceField -

Django How to work with MultipleChoiceField - form.py: checkbox_choices = ( ('value1','value1'), ('value2','value2'), ) class editprofileform(modelform): involvement = forms.multiplechoicefield(required=false, widget=checkboxselectmultiple(), choices=checkbox_choices,) def save(self, *args, **kwargs): u = self.instance.user u.interest = self.cleaned_data['interest'] u.save() profile = super(editprofileform, self).save(*args,**kwargs) homecoming profile it saves in db [u'value1', u'value2'] now, how can render in template show string value1, value2 without [u' '] or there improve way save value string? u.interest = u','.join(self.cleaned_data['interest']) django

php to java connector , where to find good one -

php to java connector , where to find good one - i want utilize powerfulness of java end . i'm using legacy php front end end . know there used php java connector 1 time deprecated . know there php - - java connector using tomcat back-end , xml protocol . not me . there extension based connector ? (fast direct jvm ). the code dosn't related question , way send it public function connecttodb($db_name) { $selecteddbconfig = config::getselecteddb($db_name); dbfactory::getdbconnection(config::db_type_mysql,$selecteddbconfig["host"], $selecteddbconfig["db"], $selecteddbconfig["user"], $selecteddbconfig["pass"]); } have quercus project. php implemented in java , running in application server. maybe fits needs. java php

entity framework - how to create a EF data model like a sql server view -

entity framework - how to create a EF data model like a sql server view - i need create model of union of several sql server tables , have ability of insert , select , update , delete ... (id utilize model same other model) any suggestions ? thanks reading. edit: tried sql server view got fallowing error when want insert sql server view: msg 4406, level 16, state 1, line 1 update or insert of view or function 'viewname' failed because contains derived or constant field. you need create database view + stored procedures insert, update , delete. map view new entity , map imported stored procedures insert, update , delete operations entity. you don't need database view - can write query straight edmx using definingquery requires manual modification of edmx. default ef tools delete manual modification 1 time run update database again. even defining query still need stored procedures. there no other way create entity based on defining query (vi...

configuration - Hudson and build warnings: possible to exclude a project from reporting? -

configuration - Hudson and build warnings: possible to exclude a project from reporting? - i'd hudson send e-mail developers whenever warning encountered in build (vs2010, tfs) the problem solution contains several projects company cannot touch. since part of solution, need built when solution built, don't want hudson count warnings projects (there plenty of them). is there way tell hudson not care warnings in projects? you can utilize ${build_log_regex} token of email-ext plugin filter warnings in projects. configuration hudson compiler-warnings projects-and-solutions

Iterate through rows in SQL Server 2008 -

Iterate through rows in SQL Server 2008 - consider table sample: id integer name nvarchar(10) there stored proc called myproc . takes 1 paramater ( id) given name parameter, find rows name = @nameparameter , pass ids myproc eg: sample-> 1 mark 2 mark 3 stu 41 mark when mark passed, 1 ,2 , 41 passed myproc individually. i.e. next should happen: execute myproc 1 execute myproc 2 execute myproc 41 i can't touch myproc nor see content. have pass values it. if must iterate(*), utilize build designed - cursor. much maligned, if expresses intentions, utilize it: declare @id int declare ids cursor local select id sample name = @nameparameter open ids fetch next ids @id while @@fetch_status = 0 begin exec myproc @id fetch next ids @id end close ids deallocate ids (*) reply has received few upvotes recently, sense ought incorporate original comment here also, , add together general advice: in sql, should...

db2 sql left join table help -

db2 sql left join table help - i have sql query this, select t1.id id, case when t2.field1 = 1102 (t2.field3 - t2.field2) end a, case when t2.field1 = 1112 (t2.field3 - t2.field2) end b, case when t2.field1 = 1113 (t2.field3 - t2.field2) end c, case when t2.field1 = 1106 (t2.field3 - t2.field2) end d table1 t1 left bring together table2 t2 on t1.id = t2.id and result this; id b c d ---- ------ ----- ----- ------ 1773 100 null null null 1773 null 120 null null 1773 null null 200 null 1773 null null null 60 but want show result this; id b c d ---- ------ ----- ----- ------ 1773 100 120 200 60 how can rewrite query? thx help.. just utilize sum() , group id flatten out: select t1.id id, sum(case when t2.field1 = 1102 (t2.field3 - t2.field2) end) a, sum(case when t2.field1 = 1112 (t2.field3 - t2.field2) end) b, sum(case when t2.field1 = 1...

Processing an image for Iphone fax App -

Processing an image for Iphone fax App - i'm looking code cleans document picture, meaning takes out shadows , other noises , turns simple black & white image (black-the writing, white-the background). maybe simple pixel algorithm helpful such as: dividing image rectangles, each defining frequent scale background , and darker pixels actual writing lines. any help highly appreciated. the problem code not distinct between letter , shadow. every dark pixel black regardless of context. the required outcome should filter out noises such shadows clear black & white image. iphone image-processing

user interface - Standard placement order for common buttons -

user interface - Standard placement order for common buttons - i know in microsoft windows, ok/cancel buttons appear in respective order. on other hand, in linux distros, saw cancel/ok instead. what (yes/no), (yes/no/cancel), (add/edit/remove) , other mutual buttons? is there standard placement order these? from microsoft windows user experience interaction guidelines: right-align commit buttons in single row across bottom of dialog box, above footnote area. if there single commit button (such ok). present commit buttons in next order: ok/[do it]/yes [don't it]/no cancel apply (if present) help (if present) from apple human interface guidelines: the buttons @ bottom right of dialog dismiss dialog. button initiates action furthest right. action button confirms alert message text. cancel button left of button. if there’s 3rd button dismissing dialog, should go left of cancel button. if 3rd button result in ...

java - Null Pointer Exception while using putExtra and getExtras -

java - Null Pointer Exception while using putExtra and getExtras - i'm trying utilize putextra , getextras pass info in android game i'm writing (it's score). when i'm passing it, utilize code in 1 class set in information: intent winscreen = new intent(context, winscreen.class); winscreen.putextra("score", "123"); and when i'm getting it, i'm using: intent x=new intent(this, gamecall.class); bundle ebundle = x.getextras(); string score = (string) x.getextras().getserializable("score"); i'm trying test sample score right now, don't think setting value correctly problem. suggestion saw elsewhere why such null pointer occur. know understands "score" extra. stumped info beingness lost! when utilize intent start new activity, must utilize getintent() specific instance of intent. using intent x=new intent(this, gamecall.class); won't work. seek next code: intent x= this.getint...

sql - How do I fix my MySQL error 1093 -

sql - How do I fix my MySQL error 1093 - how prepare error [err] 1093 - can't specify target table 'user_log' update in clause delete user_log user_log updatedate < (select max(updatedate) user_log lookup email = user_log.email) let me know if want delete info of table use: delete [table] [condition]. also max have grouping info first. delete user_log updatedate < (select max(updatedate) user_log grouping email having email = user_log.email) when want utilize status on grouping have utilize having instead of where. mysql sql

Require_once PHP Error -

Require_once PHP Error - i've been programming in php several years , never encountered error before. here's widget.php file: require_once('fruit.php'); echo "i compiling fine!!!"; and fruit.php file: $bvar = true; when these 2 files ^ compiles no errors , "i compiling fine!!!" success message. now, min move fruit.php file 1 directory level up, , alter widget.php file reflect directory restructuring: require_once('../fruit.php'); echo "i compiling fine!!!"; now sudden, php warnings & fatal errors: warning: require_once(../fruit.php) [function.require-once]: failed open stream: no such file or directory in /webroot/app/widget.php on line 1 fatal error: require_once() [function.require]: failed opening required '../fruit.php' (include_path='.:/usr/local/php5/lib/php') in /webroot/app/widget.php on line 1 in years working php, i've never seen require_once() fail before. ideas?...

ruby - Kyoto Cabinet install via rubygems fails -

ruby - Kyoto Cabinet install via rubygems fails - i trying install kyoto cabinet via ruby gems. putting within gemfile gem "kyotocabinet", "~> 1.0" as opposed here when run bundle fails with setting variables ... $cflags = -i. -i/usr/local/include -wall $(cflags) -fpic -o2 $ldflags = -l. -rdynamic -wl,-export-dynamic -l. -l/usr/local/lib $libs = -lkyotocabinet -lz -lstdc++ -lrt -lpthread -lm -lc checking kccommon.h... yes creating makefile create g++ -i. -i/home/gerry/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/x86_64-linux -i/home/gerry/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1/ruby/backward -i/home/gerry/.rvm/rubies/ruby-1.9.2-p136/include/ruby-1.9.1 -i. -dhave_kccommon_h -fpic -i. -i/usr/local/include -wall -o3 -ggdb -wextra -wno-unused-parameter -wno-parentheses -wpointer-arith -wwrite-strings -wno-missing-field-initializers -wno-long-long -fpic -o2 -o kyotocabinet.o -c kyotocabinet.cc kyotocabinet.cc:29: error: ‘int32_max’ ...

security - What do I need to get SSL sockets (SslRMIServerSocketFactory/SslRMIClientSocketFactory)? -

security - What do I need to get SSL sockets (SslRMIServerSocketFactory/SslRMIClientSocketFactory)? - hy, want sslrmiserversocketfactory/sslrmiclientsocketfactory secure rmi calls. mutual way these when client authentication necessary (keystores, certificates, ..)? need generate/ship? edit: secured communication rmi server , client authentication , self-signed certificates. works on machine. submitted certificates, truststores , keystores repository, won't work on other machines. suggested migration broke keystore, can't figure out why? have idea? edit: here finish stacktrace java.rmi.connectioexception: exception creating connection to: localhost; nested exception is: java.net.socketexception: java.security.nosuchalgorithmexception: error constructing implementation (algorithm: default, provider: sunjsse, class: com.sun.net.ssl.internal.ssl.defaultsslcontextimpl) java.rmi.connectioexception: exception creating connection to: localhost; nested exception is: jav...

ios - why can this code not access 'borderWidth' (iphone code attached) -

ios - why can this code not access 'borderWidth' (iphone code attached) - why can code not access 'borderwidth' (iphone code attached) this based on simple test project, did add together quartzcore framework didn't help. still throwing error, see code below. project works fine , can't see difference #import "customview.h" @implementation customview - (id)initwithcoder:(nscoder *)coder { self = [super initwithcoder:coder]; if (self) { // ui layout self.layer.borderwidth = 5; // error error: accessing unknown 'borderwidth' component of property } homecoming self; } you need add together quartzcore framework in order access layer property of uiview. did add together ? add framework next steps if using xcode 4 1. select target 2. build phases 3. link binary library section 4. tap + , find quartz 5. add together framework. now, import ever want access layer property of uicontrol. ...

date - Javascript to change image depending on time -

date - Javascript to change image depending on time - basically, i've got script changes page background depending on time. <script language="javascript"> day=new date() //..get date x=day.gethours() //..get hr if(x>=0 && x<4) { document.write('<style type="text/css">#header{background: white url(images/assets/1st.jpg); color: black}"></style>') } else if(x>=4 && x<12) { document.write('<style type="text/css">#header{background: white url(images/assets/2nd.jpg); color: black}"></style>') } else if(x>=12 && x<18) { document.write('<style type="text/css">#header{background: white url(images/assets/3rd.jpg); color: black}"></style>') } else if (x>=18 && x<24) { document.write('<style type="text/css">#header{background: white url(images/assets/4...

java - How to send a non-local attachment with JavaMail -

java - How to send a non-local attachment with JavaMail - i'm building application using jsp's, servlets, , fun stuff. right now, have form passes through info form html email sent using javamail api. works, trying send attachment, , way have set right not work... <div class="section">upload files: <input id="fileupload" type="file" /></div> i take input's value, pass through servlet , seek send email. problem when file sending, servlet cannot locate file because tag gives path c:\fakepath\file.doc any help amazing. i figured out. fakepath security feature in browsers. happens though tomcat file stored in temp folder within tomcat folder. had play tomcat library, commons.fileupload, , used pull info file, regardless of fakepath location. //handle file upload attachment servletfileupload servletfileupload = new servletfileupload(new diskfileitemfactory()); try{ ...

C# library to populate object with random data -

C# library to populate object with random data - i want populate object random info (for testing purposes), there library it? some kind of reflection method traverse object graph , initialize primitive properties (string, int, datetime, etc) (but deep way, including collections, kid objects, etc) nbuilder (github) fluent-api library generating data. uses rules define , isn't "random" per se. may able randomize inputs api, though, suit needs. since still gets attending think it's worth mentioning project available through nuget (https://www.nuget.org/packages/nbuilder/) well, though hasn't been modified since 2011. c#

c++ - Create two windows in one application? -

c++ - Create two windows in one application? - it might simple question, don't know start search answer. how create 2 individual windows interface in 1 application using native winapi? set 2 createwindow() functions using same hinstance ? if want login screen windows , content page such login screen comes first, , after press button, login screen destroyed, , content page appears. how do such trick? i thinking of using destroywindow , createwindow within button click message. however, mean main while loop (for translate/dispatch msg) in winmain exit loop , cause whole programme exit. way pre-create in winmain , how notify winmain if button clicked , come in sec loop instead of exiting program? you're over-thinking it. create 2 windows, phone call createwindow twice. it's simple. calling destroywindow not cause programme exit message pump. calling postquitmessage that. don't that. when button clicked, destroy 1 window , create other. the...

c# - How to update some COM marshalling code to work on a 64 bit system? -

c# - How to update some COM marshalling code to work on a 64 bit system? - we have .net code phone call out com component (dnsapi.dll) query whether domain has mx records associated validate email addresses entered our site. the problem we've upgrading 32 bit systems 64 bit systems , code marshals between com types , .net types (and cleans after) doesn't work more. the com phone call puts results in memory , returns pointer are. code marshals results .net struct still works fine code cleans memory after corrupts heap , crashes iis app pool. it's 64/32 bit problem because created little console app calls same code , works fine when compile 32 bit displays same heap corruption behavior when compile 64 bit. i found stackoverflow post of having same problem , said solution was: the solution seek create sure win32 struct , c# struct bit(bit size) mapping. can achieved using exact c# type win32 type. i've not done much interop before , not sure needs...

java - What installer solution does the JDownloader project uses to create it's installer? -

java - What installer solution does the JDownloader project uses to create it's installer? - i'm in search installer solution application , installer used jdownloader. what installer solution jdownloader project uses create it's installer? it uses install4j: http://www.ej-technologies.com/products/install4j/overview.html java installer jdownloader

database - Finding correlated or comoving stocks -

database - Finding correlated or comoving stocks - i have table of daily closing stock prices , commodity prices such gold, oil, etc. want find stocks move closely stock or commodity. where start type of analysis - know java, sql, python, perl, , little bit of r. willing purchase , larn new tools matlab if necessary. any guidance highly appreciated. this not homework question. thanks.. the technique looking called cointegration. language not of import @ when computing cointegration of 2 time series utilize whatever comfortable with. i disagree other responses computation not problem. huge problem able compute potentially billions of cointegration coefficients between different time series. using highly optimized library critical. this article on cointegration testing in r should started. also checkout quant.stackexchange.com more info on quantitative finance. database r statistics finance quantitative-finance

c++ - send scancode to my application -

c++ - send scancode to my application - i have question scan code , extended ok . i create simple window in c++ , want observe wm_keyup ( vk_up value ) now run spy++ , press key observe message keydown vk_up crepeat1 scancode 48 extended1 altdown0 frepeat1 up0 now if send message application next message sendmessage ( wnd , wm_keydown , vk_up ,1); keydown vk_up crepeat1 scancode 00 extended0 altdown0 frepeat1 up0 you see different in scan code , other value. my question why different send same message? 2 there way send scan code ( , other value application , same value ) not sure why difference can utilize keybd_event or sendinput function synthesize keystrokes. c++ winapi

iphone - UIPickerView programatic example? -

iphone - UIPickerView programatic example? - how programmatically setup uipickerview in view without using interface builder? having problem understanding how work delegate portions of uipickerview. thanks it goes follows add together uipickerview programmatically: - (void)pickerview:(uipickerview *)pv didselectrow:(nsinteger)row incomponent:(nsinteger)component { if(component == 1) selectedrowpicker1 = row; else if(component == 2) selectedrowpicker2 = row; else selectedrowpicker3 = row; } - (nsinteger)numberofcomponentsinpickerview:(uipickerview *)pickerview { homecoming 3; } - (nsinteger)pickerview:(uipickerview *)pickerview numberofrowsincomponent:(nsinteger)component { if(component == 1) homecoming [list1 count]; else if(component == 2) homecoming [list2 count]; else homecoming [list3 count]; } - (nsstring *)pickerview:(uipickerview *)pickerview titleforrow:(nsinteger)row forcomp...

ios4 - How can I detect when iOS 4 keyboard is on-screen versus Bluetooth? -

ios4 - How can I detect when iOS 4 keyboard is on-screen versus Bluetooth? - i have code moves uitextview out under on-screen keyboard. problem is, people certainly utilize bluetooth keyboard instead. how can observe that what's beingness used input? also, btw: can observe when on-screen keyboard goes away, how approach same intention when it's wireless keyboard? thanks. you can observe when bluetooth keyboard connected registering uikeyboardwillshownotification same way did detecting when keyboard hides. if bt keyboard connected, not receive keyboard show notification when text field or text view requesting keyboard becomes first responder. ios4 keyboard bluetooth

How to improve slow django view involving two related models "through" an intermediate? -

How to improve slow django view involving two related models "through" an intermediate? - i'm trying create view outputs 2d table relating 2 models "through" 3rd intermediate model. runs fine on relatively little querysets becomes increasingly slow larger ones. there improve way of implementing view speed up? i've given analogous version of models , view simplicity if needed can post actual models/view if cause slowdown. please forgive me if i've included minor errors, actual view/models work. thank you. desired output: artist foo bars fubar bas bix joe blow 5/10/1975 12/7/2010 fred noname 12/12/2012 10/2/2010 smith john 2/2/2002 analogous models: class="lang-py prettyprint-override"> class person(models.model): name = models.charfield(max_length=128) class group(models.model): name = models.charfield(max_len...

ANTLR tree construction problem -

ANTLR tree construction problem - if got grammar rule like a: (c|d|e) i can create ast rule attaching rewrite rules each alternative(c, d, e) this: a: (c -> ^(a c) | d -> ^(a d) | e -> ^(a e)) but, if got different grammar rule like a: (a|b) (c|d|e) how create ast every possible match? first tried this: a: (a|b) (c|d|e) -> ^((a|b) (c|d|e)) but, did not work. is there simple way solve problem? thanks in advance. :) you have 2 options: 1 a : (left=a | left=b) (right=c | right=d | right=e) -> ^($left $right) ; or: 2 a : left right -> ^(left right) ; left : | b ; right : c | d | e ; personally, prefer 2nd option. antlr

javascript - How to move code to (and call) functions within your own custom jQuery plugin? -

javascript - How to move code to (and call) functions within your own custom jQuery plugin? - i writing custom jquery plugin able edit record in place. have not done lot of javascript, not familiar how closures , objects work in javascript. in nutshell, how script works: a user clicks on edit link on row. an ajax phone call made html of form. the form html returned has submit button , cancel button. when cancel button clicked, form slides up. when submit button clicked, form submitted (and validated) , slides table row when successful. the code below have far. sense many pieces can moved own functions, i'm not sure how since need bind functions on html elements returned ajax call. how can move of code smaller functions? (function($){ $.fn.editinplace = function(params) { //set default settings, , allow them overridden var config = $.extend({}, { editactionselector: '.edit', deleteactionselector: '.delete...

how to kill a process in java after completion of a job in java -

how to kill a process in java after completion of a job in java - i have code similar to: url url = activator.getdefault().getbundle().getentry("/resources/server.bat"); string fileurl = filelocator.tofileurl(url).tostring(); string commandline = "cmd.exe /c start " +fileurl; process process= runtime.getruntime().exec(commandline); how can kill process work done in java process.destroy() but won't have command on process started server.bat separately started java

javascript - How to: Check if textarea value = 1, do function -

javascript - How to: Check if textarea value = 1, do function - how can function $("#div1").fadeout(); if textarea value == 1. i found doesn't seem work: if(document.getelementbyid('#textarea1').value.length === 1) { homecoming false; } thanks alot you do: if($('#textarea1').val() === '1'){ //do // use: $('#textarea1').val().length }else{ javascript jquery

How do I run a WHOIS lookup with PHP or Python? -

How do I run a WHOIS lookup with PHP or Python? - so anyways, i'm working on little php website/script, , 1 of features i'd able run whois lookup on current domain php script running on. ideally, 1 function phone call , in function run whois, , echo results screen. take in url of site run whois lookup on, or run on current url/domain (which want), although can feed variable website domain if need be. i don't know much whois lookups (well, know do, don't know how run them in php), i'd fine having query website (even 1 of own if can give me code it). whatever works, please allow me know! main thing that, i'd prefer fit in 1 function, , must fit in 1 php file/document. this should want... http://www.phpwhois.org/ i've used class before, doing want! php whois

search - jQuery find similar attributes -

search - jQuery find similar attributes - my page has 2 'tabbed' navigation sections. both independent of one-another, resulting in same outcome. figure easiest way go coding them work together, find `href' attribute same both sections, save in variable, , go on there. my layout looks this. <div id="tab-text"> <a href="tab-1"></a> <a href="tab-2"></a> <a href="tab-3"></a> </div> <div id="tab-arrow"> <a href="tab-1"></a> <a href="tab-2"></a> <a href="tab-3"></a> </div> and have jquery this. jquery('#tab-text a').click(function() { jquery('#tab-text a').removeclass('active'); jquery( ).addclass('active'); } so how can include in jquery if #tab-text a clicked, find value of href attribute, , search value #tab-arrow a ...

apache - .htaccess help, not working when I changed servers -

apache - .htaccess help, not working when I changed servers - i not familiar .htaccess , have searched through net couldn't find explanation have rewriteengine on directoryindex index.php rewriterule ^([a-za-z0-9_-]+)$ index.php?mpage=$1 rewriterule ^([a-za-z0-9_-]+)/$ index.php?mpage=$1 rewriterule ^search-result/([^/\.]+)$ index.php?mpage=search-result&subpage=$1 [l] rewriterule ^search-result/([^/\.]+)/(.*)$ index.php?mpage=search-result&subpage=$1&act=$2 [l] rewriterule ^online-result/([^/\.]+)$ index.php?mpage=online-result&subpage=$1 [l] rewriterule ^online-result/([^/\.]+)/(.*)$ index.php?mpage=online-result&subpage=$1&act=$2 [l] this .htaccess building, worked before on godaddy server when changed server, wont work more. let http://www.mywebsite.com/home worked before, because if can see mpage=$1 replaces 1 on slash right? when alter servers see 404 error. any ideas be? make sure have apache rewrite module enabled, , allowo...

SQL UPDATE Query - Basic stuff but can't see what's wrong? -

SQL UPDATE Query - Basic stuff but can't see what's wrong? - i'm trying update command sql have never used it. have command this: update 'assets' set 'sku' = "another", 'quantity' = "3", 'description' = "another thing", 'value' = "2100", 'location' = "acheroon", 'owner' = "fergus", 'image' = "nope", 'notes' = "" 'index' = "2" i have tried running both through php layer , straight database. what's up? replace ' ` , " ' try this: update `assets` set `sku` = 'another', `quantity` = '3', `description` = 'another thing', `value` = '2100', `location` = 'acheroon', `owner` = 'fergus', `image` = 'nope', `notes` = '' `index` = '2' or ...

linux - Lossy picture with Android emulator "-scale" option -

linux - Lossy picture with Android emulator "-scale" option - i have problem starting emulator scale alternative between 0.4 , 1, not including. $ emulator -avd avd10 -verbose -scale 0.8 and emulator looks http://img225.imageshack.us/i/avdm.png/ it seems working (i can unlock screen, phone call menu, etc.), not usable due lossy picture. other scale options, not between 0.4 , 1 looks fine. technical info: android-sdk_r12 x.org x server 1.10.2 $ uname -a linux laptop 2.6.39-arch #1 smp preempt mon jun 27 21:26:22 cest 2011 x86_64 intel(r) core(tm)2 duo cpu p8600 @ 2.40ghz genuineintel gnu/linux emulator output same, scale alternative , without it. emulator: found sdk root @ /opt/android-sdk emulator: android virtual device file at: /home/a4e6/.android/avd/avd10.ini emulator: virtual device content @ /home/a4e6/.android/avd/avd10.avd emulator: virtual device config file: /home/a4e6/.android/avd/avd10.avd/config.ini emulator: using core hw confi...

ruby on rails - Before_create not working -

ruby on rails - Before_create not working - i have next model setup. can tell in logs, variable beingness saved in db null: class bracket < activerecord::base before_create :set_round_to_one def set_round_to_one @round = 1 end end i create using this: bracket = bracket.new(:name => 'winners', :tournament_id => self.id) bracket.save i did utilize create supposed new , save, didn't work either. presuming round field in brackets table, need phone call setter: self.round = 1 that's because round key bracket 's attributes hash , calling setter value in hash set correctly. further, @round = 1 , you're causing new instance variable called round created first time called. , since activerecord not values in instance variables (it looks in attributes hash), nil happens far saving value of @round concerned. ruby-on-rails ruby-on-rails-3

extjs4 - ExtJS 4.0.2a Window Header Styling -

extjs4 - ExtJS 4.0.2a Window Header Styling - so we've "updgraded" extjs 4.0.2a. i'm trying create simple window fieldset has 3 inputs, , hides on close (as i've done 4.0.1). addmodwindow = ext.create('ext.window',{ title: 'title', frame: true, width: 500, height: 200, closable: true, closeaction: 'hide', layout: { type: 'fit', align: 'center' }, defaults: { bodypadding: 4 }, resizable: false, items: [{ xtype: 'fieldset', labelwidth: 75, title: 'rule values', collapsible: false, defaults: { anchor: '100%' }, width: 490, items: [typecombobox,ruletextbox,notestextarea] }] }); typecombobox, ruletextbox, notestextarea defined above block , don't seem have issues (as i've removed items , still have same problem). when window shown, wi...

jquery - Open page in window of specific size -

jquery - Open page in window of specific size - the next javascript opens window required in ie8, ff4 , safari 5.0.5 not in opera or chrome. function setwindowsize(){ var window_height = 600; var window_width = 600; window.resizeto(window_width, window_height); } i jquery script same, , in both opera , chrome. should not difficult, it's got me beaten. i think seeking for: function popitup(url) { newwindow=window.open(url,'name','height=200,width=150'); if (window.focus) {newwindow.focus()} homecoming false; } edited: sorry seems got wrong, take @ link: other forum jquery

python - How do I add a scale bar to a plot in Mayavi2/VTK? -

python - How do I add a scale bar to a plot in Mayavi2/VTK? - i add together scale bar (showing how big micron example) mayavi plot create mlab. for example, referencing question: how display volume non-cubic voxels correctly in mayavi i can set voxel size of plot using from enthought.mayavi import mlab import numpy np s=64 x,y,z = np.ogrid[0:s,0:s,0:s/2] volume = np.sqrt((x-s/2)**2 + (y-s/2)**2 + (2*z-s/2)**2) grid = mlab.pipeline.scalar_field(data) grid.spacing = [1.0, 1.0, 2.0] contours = mlab.pipeline.contour_surface(grid, contours=[5,15,25], transparent=true) mlab.show() i automated way of adding indicator of scale of object showing is. right adding scale bars hand inkscape exported images, there has improve way. a straightforward mayavi way helpful, if there in vtk it, can utilize mayavi's wrapper. something text3d allow me add together text, , suppose figure out how draw line , compute right scaling hand, hoping there easier...

ios4 - How to increase size of the ViewImage/View -

ios4 - How to increase size of the ViewImage/View - i facing problem in increasing size of imageview/ view. actually want application increment size (0-100) of image/imageview after clicking button through animation. please help !!! you need create cgrect , apply view/imageview here code snippet cgrect previousframe = view.frame; [uiview beginanimations:nil context:nil]; [uiview setanimationduration:0.5f]; previousframe.size.width = 100; previousframe.size.height = 100; view.frame = previousframe; [uiview commitanimations]; paste code on ibaction of button. alter code want. understanding concept. ios4

Insert page header/footer into chapter page in Latex -

Insert page header/footer into chapter page in Latex - i alter chapter style following. set header , footer using fancyhdr bundle before next code. problem chapter page doesn't include page header , footer, rest of pages fine. tell me how insert header , footer chapter page? much. \makeatletter \def\thickhrulefill{\leavevmode \leaders \hrule height 2pt \hfill \kern \z@} \def\@makechapterhead#1{% \vspace*{10\p@}% {\parindent \z@ {\raggedleft \reset@font% \fontencoding{ot1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont% \bfseries\thechapter\nobreak\hspace{1ex}}% {\raggedright \reset@font% \fontencoding{ot1}\fontfamily{cmr}\fontseries{b}\fontshape{n}\fontsize{22pt}{12}\selectfont% \bfseries #1}% \interlinepenalty\@m \par\nobreak \textcolor{orange}{\thickhrulefill} \vspace{26pt} \par\nobreak }} if haven't gotten reply elsewhere already, need utilize \thispagestyle{fancy} , since cover pages set ...

How can express this imperative function in a functional, array-based language like K (or Q)? -

How can express this imperative function in a functional, array-based language like K (or Q)? - how can express imperative function in functional, array-based language k (or q)? in sloppy c++: vector<int> x(10), y(10); // assume these initialized values. // btw, 4 const -- it's part of algorithm , arbitrarily chosen. vector<int> result1(x.size() - 4 + 1); // place hold resulting array. vector<int> result2(x.size() - 4 + 1); // place hold resulting array. // here's code want express functionally. (int = 0; <= x.size() - 4; i++) { int best = x[i + 0] - y[i + 0]; int bad = best; int worst = best; for(int j = 0; j < 4; j++) { int tmp = x[i + j] - y[i + 0]; bad = min(bad, tmp); if(tmp > best) { best = tmp; worst = bad; } } result1[i] = best result2[i] = worst } i see in kdb , q other functional languages welcome. in kona (an open-source k dialect): ...

iphone - How to display different element from different array in different section in single table view? -

iphone - How to display different element from different array in different section in single table view? - i have table 3 sections, 3 sections have different number of rows. cell values should populate different array's. how should find out section in method cellforrowatindexpath:??? please help!!! code: - (nsinteger)tableview:(uitableview *)tv numberofrowsinsection:(nsinteger)section { currentsection = section; int number = 0; switch (section) { case 0: number = self.basic.count; break; case 1: number = allsectors.count; break; case 2: number = 1; break; default: number = 0; break; } homecoming number; } - (uitableviewcell *)tableview:(uitableview *)tv cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tv dequeuereusablecellwithidentif...

TFS merge changeset into file with pending change -

TFS merge changeset into file with pending change - i have feeling stupid question, can't find reply anywhere. so have dev branch , qa branch. merge bunch of contiguous changesets dev qa, , resolve conflicts. want merge in later changeset, on changes merged (not having checked in changes first merge). no dice, says tfs: the item $/my/path/to/the/file.vb has incompatible pending change. what's problem? why won't give me merge conflict alternative merge new changeset files pending changes? don't want check in first merge can merge in changeset. tfs doesn't allow merge multiple non-contiguous changesets if same file changed in both of them. best alternative checkin first set of changes, merge. tfs merge

Connection via ODBC to SQL Server failing -

Connection via ODBC to SQL Server failing - i have unusual issue. can connect 1 terminal server sql server admin. can connect server via straight sql connection normal user. when seek , log on server using odbc receive next error. 07/08/2011 10:49:14,logon,unknown,login failed user ''. reason: effort login using sql authentication failed. server configured windows authentication only. [client: 10.0.0.25] 07/08/2011 10:49:14,logon,unknown,error: 18456 severity: 14 state: 58. the sql server in mixed mode , user set in connection. must permissions issue. probably user tries login not have permission database he/she trying connect. go sql server > security > select user - right click > properties > user mapping , there select database user needs access (check box in map column) i'm pretty sure error had happened me before that's how fixed it. assuming true server setup mixed mode already. sql odbc database-connection

objective c - If Statement not Running -

objective c - If Statement not Running - i new objective c , cocoa, have spent lot of time c++, , have never run across issue before. my application needs identify mounted disk name. here code: //this code run whenever new disk mounted computer -(void) scanforkindle:(nsnotification *) notification { nsmutablearray *mounteddisks = [[nsmutablearray alloc] init]; mounteddisks = [workspace mountedremovablemedia]; nsmutablearray *ebookdevices = [[nsmutablearray alloc] init]; nsdictionary *fileattributes = [[nsdictionary alloc] init]; int currentdisk; (currentdisk = 0; currentdisk < [mounteddisks count]; currentdisk++) { nslog(@"name: %@", [mounteddisks objectatindex:currentdisk]); if ([mounteddisks objectatindex:currentdisk] == @"/volumes/kindle") { nslog(@"kindle has been identified"); } } } i have gotten work if statement in loop. wont run. ideas why? sure simple ...

foreign keys - Django - ForeignKey issue. How many DB accesses? -

foreign keys - Django - ForeignKey issue. How many DB accesses? - i using django , model this. class city(models.model): name = models.charfield(max_length=255, primary_key=true) url = models.urlfield() class paper(models.model): city = models.foreignkey(city) name = models.charfield(max_length=255) cost = models.integerfield() class article(models.model): paper = models.foreignkey(paper) name = models.charfield(max_length=255) i trying city object, several paper objects , several article objects filtering through city name , cost of paper. to search through city table can this: cities = city.objects.get(pk='toronto') to paper objects: papers = paper.objects.filter(city=cities, cost < 5) or combine two: papers = cities.paper_set.filter(city=cities, cost < 5) (will more efficient?) the problem find efficient way articles above 'papers'. i can't utilize papers.article_set since pap...

website - how to verify whether a site has mobile compliant pages -

website - how to verify whether a site has mobile compliant pages - many of web sites have mobile compliant pages mobile browsers. have few urls , want know whether pages pointed these urls have mobile compliant pages. opened these urls in browser on mobile , checked whether browser loading huge page or little mobile friendly page. right way of checking or there improve ways of doing it? use smartphone simulators iphone http://www.testiphone.com/ website mobile-website

7zip command line self extractor not asking for path -

7zip command line self extractor not asking for path - i've created self extracting .exe file 7zip command line using the 7z -sfx <name.exe> <filelist...> commands when run windows explorer not inquire me location extract files to, places within current directory. the target users not command line savvy don't want them have open prompt , utilize command line options set in directory. the non command line 7zip has functionality i'm looking when checking box create sfx archive file, command line not seem have it. as lastly resort can create .bat script call 7z x -o<location> <name.exe> but i'm trying avoid users used installing form executable. 7z -sfx7z.sfx <name.exe> <filelist...> http://sourceforge.net/projects/sevenzip/forums/forum/45798/topic/3777973 7zip self-extracting

jquery delegate passing variable -

jquery delegate passing variable - i want pass object of beingness clicked handler. this: $selector.delegate('.test','click',func1( ?? )); //this reusable function function func1(obj){ //do obj ..... } so in case, should pass $('.test') function. can give me hand here, lot. use $(this) within func1 . this object on event occurred. jquery delegates

Git magic references -

Git magic references - i'm playing around project-workflows , git , i'd figure out nice way "talk" main-repository. one thing i'm wondering how realize magical reference "for" used gerrit commits force "refs/for/xxxx/topic" in order set final target branch without placing things straight there. there way pre/post receive hooks our special feature of java implementation? cheers refs/for/branch "magic" feature of gerrit git server. far i'm aware, there's no way replicate using default git-receive-pack or git-http-server implementations. git

sql - CREATE XML SCHEMA COLLECTION problem with simple quotes -

sql - CREATE XML SCHEMA COLLECTION problem with simple quotes - i'm trying next in microsoft sql server: create xml schema collection [dbo].[xyzschema] n'schema content' go the problem schema content contains quote (') in regexp , breaking instruction: n' ..... <xsd:pattern value="\w+([-+.'] ..... ' is there way escape quote , maintain correctnes of regexp, or declare expresion of create xml schema collection in other way? you're writing varchar (well, nvarchar) literal. way escape single quotes within such literal double them up: n' ..... <xsd:pattern value="\w+([-+.''] ..... ' from constants: if character string enclosed in single quotation marks contains embedded quotation mark, represent embedded single quotation mark 2 single quotation marks. sql sql-server escaping xsd

xaml - WPF Layout Control -

xaml - WPF Layout Control - i new wpf. have wpf window contains grid dynamic in size along columns. window supposed little utility type window ontop. the issue user types richtextbox expands of bottom of page, scroll bar appear. i have tried placing in container doesnt work. i want grid resize if user decides resize window. <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" height="202" width="927" windowstyle="toolwindow" showintaskbar="true" topmost="true"> <grid> <grid.columndefinitions> <columndefinition width="*"></columndefinition> <columndefinition width="auto"></columndefinition> <columndefinition width="*"></columndefinition> <columndefinition width="auto"></colu...

apache - Exclude a a directory in php open_basedir on nginx webserver -

apache - Exclude a a directory in php open_basedir on nginx webserver - i trying set php open_basedir website , have 2 locations execute php script , need disable php on sub folder within document root. don't know if possible. are doc roots requires php execution /home/bastian/html /home/bastian/meatalheavy i need disable php exection on next dirs /home/bastian/html/ass_ests /home/bastian/html/images/ php.ini open_basedir = "/home/bastian/html" ; "/home/bastian/meatalheavy" the setting of open_basedir php manual sets access directory tree, not specific directory. if you'd restrict subdirectory, must not allow of it's parents. note: depending on directory layout (and php version) looks want not possible or @ to the lowest degree not w/o big amount of configuration (allowing files , subfolder individually). php apache nginx

theme_status_messages() is not firing in my Drupal 6 theme -

theme_status_messages() is not firing in my Drupal 6 theme - i have template.php file theme called themename_status_messages it's not beingness called/invoked theme. when utilize devel themer info on test dsm output, told candidate functions are: theme_messages_alter_status_messages() themename_messages_alter_status_messages() i'm not sure why status_messages() phone call isn't beingness called during page load. ideas? looks problem there module enabled changed how handled, , didn't know module there , did that. module messages alter. taught me less on in check modules page mysteries. drupal drupal-6 drupal-theming

python - tkinter photoimage constructor -

python - tkinter photoimage constructor - i forced utilize plain photoimage class, since had many troubles installing pil on osx machine utilize - can live it, resorting utilize gif files. trouble is, there's place need create new image of given color, size: simple colored square. there way it, à la image.new('rgb', size, color) ? from tkinter import * #from tkinter root = tk() = photoimage(width=100, height=100) l = label(root, image=i) l.pack() i.put("{red}", to=(4,6,80,80)) root.update() root.after(3000) i.put("{blue}", to=(4,6,80,80)) root.mainloop() python tkinter

jsp - get path of deployed project on server -

jsp - get path of deployed project on server - i want remote address or server address project deployed. allow suppose http://www.myname.com/ : host deployedproj : deployed web app name foldername : there folder within web app want access address : http://www.myname.com/deployedproj/foldername you can 1 thing using requestdispatcher... 1.in servlet action class: req.getrequestdispatcher("/your_webapp_name/folder_inside_project").forward(req,res); e.g req.getrequestdispatcher("/deployedproj/foldername").forward(req,res); 2. in jsp, <%=request.getrequesturl()%> jsp servlets

objective c - about RegexKitLite linebreak -

objective c - about RegexKitLite linebreak - i'm utilize regexkitlite match texts: xxx*[abc]*xxx and want match [abc],and utilize regular: nsstring *result = [@"xxx[abc]xxx" stringbymatching:@"\\[(.*)?\\]" capture:1]; then, result [abc].but, if have linebreak in there: xxx[ab c]xxx it's dosen't work. utilize ([\s\s]*), dosen't math [abc]. how can match text? give thanks you the . not match new lines default. utilize ... stringbymatching:@"(?s:\\[(.*)?\\])" ... // ^^^^ ^ or supply rkldotall alternative -stringbymatching:options:inrange:capture:error: method. alternatively, utilize greedy variant @"\\[([^\\]]*)\\]" // \[ ( [ ^\] ] ) \] objective-c line-breaks regexkitlite

objective c - Does video recording supports in iphone 3g(programatically) in iphone sdk? -

objective c - Does video recording supports in iphone 3g(programatically) in iphone sdk? - i using code below recording video worked smoothly in iphone 3gs , iphone 4.but in iphone 3g not working. - (void)imagepickercontroller:(uiimagepickercontroller *)picker1 didfinishpickingmediawithinfo:(nsdictionary *)info { printf("\n inside......didfinishpickingmediawithinfo"); nsstring *mediatype = [info objectforkey:uiimagepickercontrollermediatype]; printf("\n mediatype = %s",[mediatype utf8string]); if ([mediatype isequaltostring:@"public.movie"]) { nslog(@"got movie"); videourl = [info objectforkey:uiimagepickercontrollermediaurl]; newurl = [videourl copy]; nslog(@"video url = %@",videourl); movieplayer = [[mpmovieplayercontroller alloc] initwithcontenturl:newurl]; if (movieplayer) { //[movieplayer setcontrolstyle:mpmoviecont...