Posts

Showing posts from June, 2014

Ruby undefined method 'each' for class -

i getting error when create class of stats , container class. error test.rb:43:in `<main>' undefined method `each' #<boyfriends:0x2803db8 @boyfriends=[, , , ]> (nomethoderror) which makes absolute sense because class indeed not contain method, should ruby search parents , grandparents classes method? script displays desired output; inlays error output so test.rb:43:in `<main>'i love rikuo because 8 years old , has 13 inch nose love dolar because 12 years old , has 18 inch nose love ghot because 53 years old , has 0 inch nose love grats because unknown years old , has 9999 inch nose : undefined method `each' #<boyfriends:0x2803db8 @boyfriends=[, , , ]> (nomethoderror) here code class boyfriends def initialize @boyfriends = array.new end def append(aboyfriend) @boyfriends.push(aboyfriend) self end def deletefirst @boyfriends.shift end def deletelast @boyfriends.pop

javascript - all checkboxes need to be checked and unchecked with the main checkbox -

can me this? i have 2 div s. in 1 div , have checkbox named allcheck , , in other other div , have checkboxes name outcheck . if check multiple , need checked, , if uncheck multiple , should unchecked. input radio class of allcheck . $('.inputradio').click(function(){ $("input[name='outcheck']").each(function () { if (allcheck.checkbox== true) {//multi check checked this.checked = true; } else { this.checked = false; } }); }); html this div main checkbox <div id="actions"><div id="box"> <ul><li class="inputradio"><input name="allcheck" type="checkbox" ></li> <li class="multiple"><a href="#" class="bt btleft">multiple</a></li> this child checkboxes: <ul><li id="outcheckbox"><input name="outcheck" type="checkbo

python - Getting a contour plot to use data from a CSV file -

hi experienced python community. collect magnetic data part of job have wait until field process data check quality. data comes in format:- time,f,ef,fp,easting,northing,height 21:51:02,53169.31,-14.3,-17.79,386330.362,7371876.155,540.939 this can outputted in different formats such txt, xls or in case csv. aim able plot on laptop , check there no contamination data. using google lead me stackoverflow , looking through various posts have come script below. thank these posts. problems can read csv file can't understand how data plotting section , removing unwanted numbers line 27 onwards. sure find rather simple have been going around in circles last 2 weeks due lack of experience. thank reply. import numpy np import matplotlib.pyplot plt import matplotlib.mlab ml f = open("filename.csv") data = np.genfromtxt('filename.csv', dtype=[('time',float),('f',float),('ef',float), ('fp',float),(&#

asp.net - Httpexception The Controls collection cannot be modified because the control contains code blocks -

Image
i try add user control ajax have same problem of this one , , suggested solution remove <%= head of page , master page is: as see there not <%= character in head of page, problem? why error yet? any suggestion? i put target elements in panel or placeholder, , there not more error.

css - 100% width in bootstrap for iPhone -

i'm using bootstrap simple html5, css3 website.(see here: http://skyfistudio.com/project/fsc/ ) .there 3 divs should 100% width. it's looking in desktop , browsers. in iphone , shows aligned left(please see attached image). want stretch 100%. iphone view here: http://skyfistudio.com/project/fsc/hosting/ here code first navigation: ul.fnav { list-style-type:none; margin:0 auto; padding:0; padding-top:8px; padding-bottom:8px; text-align:center; margin-top:0px; background-color:#3b5998; width:100%; } ul.fnav li { display:inline; } ul.fnav a:link,ul.fnav a:visited { font-weight:normal; color:#fff; margin-left:10px; font-size:13px; text-align:center; padding:6px; margin-right:55px; text-decoration:none; text-transform:uppercase; -webkit-transition: 0.5s ease-in-out; -moz-transition: 0.5s ease-in-out; -o-transition: 0.5s ease-in-out; -ms

contextmenu - Context menu not working in flex 4 -

context menu not working datagrid in flex 4.6 sdk. have project developed using flex 3.6 sdk. goal make compatible run in flex 4.6 sdk .its running fine in flex 4.6 context menu not working. idea how implement context menu in datagrid in flex 4.6 . it worked . if assign context menu using id of datagrid context menu works, example if id of datagrid dg, using dg.contextmenu = cm. wonder why doesn't work assigning directly in datagrid using binding.

c - How to add multiple lines in text file -

i trying write program can display contents of file append content dynamically user text file in c. below code, somehow working single line input , not multi-line input in loop. fobj=fopen("test3.txt","a"); if (fobj==null) { printf("error opening file. "); exit(0); } int contd; char buff1[120]; char *chptr; { printf("enter line : \n"); gets(buff1); fputs(buff1,fobj); printf("enter continuation code : "); scanf("%d",&contd); }while(contd!=0); you facing typical stdin issue. can use fflush(stdin); before gets, should work.

css - bootstrap less not reflecting changes -

i using less bootstrap reasons changes make in "variables.less" not reflected in generated css. below code sample: <!doctype html> <html> <head> <meta charset="utf-8"> <title>yazeba - simple property search engine.</title> <link rel="stylesheet/less" type="text/css" href="template/less/bootstrap.less" /> <script type="text/javascript" src="template/js/jquery-1.9.1.min.js"></script> <script type="text/javascript" src="template/js/bootstrap.min.js"></script> <script type="text/javascript" src="template/less-lib/less-1.3.3.min.js"></script> </head> <body> <a href="#">change font color of using variables.less</a> </body> </html> i have checked , files loaded properly, bootstrap.less rendered in <style>..</style> tags, changes made variab

c# - Simple semaphore implementation with form application -

i want show example application of semaphores specific problem homework. added 3 buttons c# form , want show 1 button @ specific time executes bank account function in code. when click 3 buttons in 2 seconds, bank account function must run 1 time. because have thread.sleep(6000) 6 seconds wait in bank account function. 3 of click runs 6 second intervals consecutively. how can change code run 1 time when press 3 buttons consecutively. code is: namespace semafor_form { public partial class form1 : form { semaphore semafor=new semaphore(1,1); delegate void settextcallback(string text); private void settext(string text) { if (this.textbox2.invokerequired) { settextcallback d = new settextcallback(settext); this.invoke(d, new object[] { text }); } else { this.textbox2.text = text; } } public form1() { initializecomponent(); } private void form1_load(object

android - Why does the fragment manager return null here? -

why log-line yield "true" here? added fragment tag "id"! fragmenttransaction ftrans = getsupportfragmentmanager().begintransaction(); ftrans.add(0, new myfrag(), "id"); ftrans.commit(); fragment frag = getsupportfragmentmanager().findfragmentbytag("id"); log.i("", "fragment null? " + (frag == null)); is there delay on commit? if so, there event can listen when commit completed? public abstract int commit () schedules commit of transaction. commit not happen immediately; scheduled work on main thread done next time thread ready. you can try adding fragmentmanager.executependingtransactions() after commit() , before finding tag.

java - Cannot receive a String with socket -

i want send integer , string java server c client. can read integer have problem reading string. server code in java clientnumber++; dataoutputstream dos = new dataoutputstream(socket.getoutputstream()); //dos.flush(); dos.writeint(clientnumber); string randomstring= getrandomvalue(10,20); dos.writeutf(randomstring); this c client code: int to_server_socket = -1; void main ( void ) { char *server_name = serveurname; struct sockaddr_in serversockaddr; struct hostent *serverhostent; long hostaddr; long status; char buffer[512]; bzero(&serversockaddr,sizeof(serversockaddr)); hostaddr = inet_addr(serveurname); if ( (long)hostaddr != (long)-1) bcopy(&hostaddr,&serversockaddr.sin_addr,sizeof(hostaddr)); else { serverhostent = gethostbyname(serveurname); if (serverhostent == null) { printf("gethost rate\n"); exit(0); } bcopy(serverhostent->

shell - How to prevent rsync compression on files with no extension? -

i'm using rsync perform synchronisation between 2 machines on network, have rsync's --compress setting enabled, have various file-types i'm excluded know compressed such .jpg, .mp4 etc, using --skip-compress option. however, have large number of files no extension know have poor compression (due encryption), part of os x's sparsebundle disk image format (where each "block" of image own file no file extension. anyway, don't have many other files should conflict, other files have no extension should either excluded or quite small (so not worth compressing). however, i'm @ loss how should add no extension files rsync's --skip-compress list? going 1 level: how time saving --skip-compress ? on 0.5 megabyte/s network link, 21 megabyte mp3 file suffices mp3 , txt , none tried --skip-compress="[]/gz/foo" , --skip-compress="gz//foo" . not find difference in speed on 5 tries.

c# - SQL Query pauses -

my query seems stalling every many passes through query. status_text.text = "check existing records..."; status_text.refresh(); using (streamreader reader = new streamreader(df_text_filename)) { using (streamwriter writer = new streamwriter(df_text_filename + "_temp")) { while ((product = reader.readline()) != null) { if (product != _aff_svc.dfheaderprod) { df_product = _product_factory.getproductdata(_vsi, product); } status_text.text = "checking existing record of vendor record id " + df_product.sku; status_text.refresh(); if (_pctlr.getbysku(df_product.sku) != null) { continue; } writer.writeline(product); applicatio

How to change camera from front to back and back to front on button click in android -

i working on android tablet application. want change camera front , front on button. how can achieve ? have tried several example not getting proper response. i adding code also. public class photopreview extends activity implements surfaceholder.callback { private camera camera; private imagebutton cameraclick; private imagebutton cameraswap; surfaceview surfaceview; private surfaceholder mholder; boolean previewing = false; string path = ""; layoutinflater controlinflater = null; bitmap bmp; button cameracancel; private sharedpreferences myprefs; private int camid; /** called when activity first created. */ @suppresswarnings("deprecation") @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); system.out.println("photo preview called $$$$$$$$$$$$$$$$$$ "); requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowma

twitter bootstrap - allow twitterbootstrap class-attributes on span and p tags in ckeditor -

for cms want edit content bootstrap-styles. when edit source-code in ckeditor , add class attributes gets stripped off switching wysiwyg-mode. <p class="lead">bla</p> => <p>bla</p> from docs can't find way allow class-attributes value p-tags. my config default: ckeditor.editorconfig = (config) -> config.language = 'de' config.contentscss = '/assets/front/application.css' config.format_div = { element : 'div', attributes : {'data-no-turbolink' : 'true'}} config.toolbar_pure = [ { name: 'document', items: [ 'source','-','save','newpage','docprops','preview','print','-','templates' ] }, { name: 'clipboard', items: [ 'cut','copy','paste','pastetext','pastefromword','-','undo','redo' ] }, { name: 'editing',

MySQL to return multiple differences between many rows -

i have following problem need return multiple differences on values in 1 table based on specifications given in other 2 tables. i'm pretty can accomplished inner joins in right place. greatest problem have fact 1 there might more 2 values need compared , results should returned in 1 row. the differences should returned calculated values in table c , specifications of should compared given in table a. below have made example of situation it's easier show situation , example return row. have tried many tricks without success appreciated. the database uses mysql. thanks in advance! table a: | identifier | type | top_id ------------------------------------- | aaaa | x | | bbbb | y | aaaa | cccc | y | aaaa | dddd | y | aaaa table b: | identifier | is_base -------------------------- | bbbb | true | cccc | false | dddd | false table c: | identifier | t

c++ - *this-> can not be used as a function -

here's excerpt of class have created inside header file : typedef double real; class grid{ public : explicit grid (); explicit grid(size_t level ); grid(const grid & grid ); ~ grid (); const grid & operator =( const grid & grid ); inline real & operator ()( size_t , size_t j ); inline real operator ()( size_t ,size_t j ) const; void fill( real value ); void setboundary ( real value ); private : size_t y_ ; // number of rows size_t x_ ; // number of columns real h_ ; // mesh size real * v_ ; // values }; and here's excerpt code have written declared functions in separate .cpp file. note have included parts relevant error. inline real& grid :: operator ()( size_t , size_t j ){ if( (i >= y_) || (j>=x_ ) ) throw std::invalid_argument( "index out of bounds" ); return v_ [i* x_ +j]; } inline real grid::operator ()( size_t ,size_t j )

Java Servlet Downloading File -

so have 2 files, servlet: package com.servlets; import java.io.file; import java.io.ioexception; import java.net.malformedurlexception; import java.net.url; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.apache.commons.io.fileutils; import com.java.datadownloader; /** * servlet implementation class downloaderserv */ public class downloaderserv extends httpservlet { private static final long serialversionuid = 1l; datadownloader dl; /** * @see httpservlet#httpservlet() */ public downloaderserv() { super(); dl = new datadownloader(); // todo auto-generated constructor stub } /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse response) */ protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo aut

ios - GPUImage render to OpenGL ES texture does not work -

i render video in opengl es texture can apply texture 3d surface in ios program. i'm using gpuimage , not work, no texture seems loaded in output. here .h code : #import <uikit/uikit.h> #import <glkit/glkit.h> #import "gpuimage.h" @interface viewcontroller : glkviewcontroller <gpuimagetextureoutputdelegate> { gluint texture; gpuimagemovie* movie; gpuimagetextureoutput *output; gpuimagepixellatefilter* pixellatefilter; } @end and here parts of the.m file : init - (void)setupgl { [eaglcontext setcurrentcontext:self.context]; [self loadshaders]; _vertexarraybuff = generatesphere(0, 0, 0, 10, 20, 10, &_arraysize); glenable(gl_depth_test); glgenvertexarraysoes(1, &_vertexarray); glbindvertexarrayoes(_vertexarray); glgenbuffers(1, &_vertexbuffer); glbindbuffer(gl_array_buffer, _vertexbuffer); glbufferdata(gl_array_buffer, _arraysize * sizeof(glfloat), _vertexarraybuff, gl_

multithreading - Android SurfaceView Thread with multiple activities -

i have thread part of surface view object: public class gamearena extends surfaceview implements surfaceholder.callback { private gamethread thread = null; // etc } and surface view part of activity. later when user clicks screen, new activity launched, own different surface view. the problem have finding how/when cancel thread when user press' home button in second activity, when start app again thread exists. many thanks you should not have thread created within surfaceview, instead should create thread within activity owns surfaceview. in addition, synchronization needed between thread , activity thread life cycle.

scala - IntelliJ IDEA 12 with Play 2.0. No Java/Scaladocs -

i configured intellij idea 12 work play 2.0 framework: installed scala , play 2.0 plugins , downloaded play 2.0.4 framework (i choosed play 2.0.4 root directory when created new project idea). all works fine, i.e. can run code , see result in browser, miss scaladocs/javadocs in ide (when pressing ctrl+q ) both play 2.0 , scala . how can configure it? try run with-sources option. easiest if enter play console mode. play then run with-sources option idea command idea with-sources=yes

user interface - JavaFX 2 -- Setting the defaultButton property: mutually exclusive? -

in visual basic 6, if set defaultbutton property of form button control true, same property on other button controls in form set false, i.e. property mutually exclusive (like radio button). i getting behavior on gui seems indicate more 1 button in javafx may have defaultbutton property set true, , more 1 button receive vk_enter button events system. the javafx 2.2 documentation setdefaultbutton() method , defaultbutton property not clarify issue. i have 1 anchorpanel bunch of controls , separate bunch of controls. these shown on same stage, , 1 setvisible(true) user depends on information he's working with. i'm wondering if need iterate through button controls on active panes , set defaultbutton property false of them before try set 1 true in order avoid odd behavior resulting more 1 button receiving enter key events. edit 05/05/2013 -- here changelistener code have. had written anonymous inner class attaching directly focusedproperty of textfield control txtdx.

python - Plotting a Pandas DataSeries.GroupBy -

Image
i new python , pandas, , have following dataframe . how can plot dataframe each modelid separate plot, saledate x-axis , meantodate y-axis? attempt data[40:76].groupby('modelid').plot() dataframe you can make plots looping on groups groupby : import matplotlib.pyplot plt title, group in df.groupby('modelid'): group.plot(x='saledate', y='meantodate', title=title) see more information on plotting pandas dataframes: http://pandas.pydata.org/pandas-docs/stable/visualization.html , looping on groupby-object: http://pandas.pydata.org/pandas-docs/stable/groupby.html#iterating-through-groups

codeigniter's pagination offset not working -

in ci's pagination, data index should follow offset. example : if limit 10 2nd index should have 10 offset, means index start 11 20. i followed tutorials, still cant offset thing works correctly. my index reseted 1 each time click differet pagination index. this pagination code, note have tried echo $offset , value true (in 2nd index = 10, in 3rd index = 20, $limit = 10) i dont know why not working : public function index($offset = 0) { //check authorization if(!isset($_session['username'])) redirect('backend_umat/login'); // $offset value true, index still reseted 1 echo $offset; $limit = 10; $result = $this->umat_m->get_umat($limit, $offset); //pagination $config['base_url'] = site_url('/backend_umat/index'); $config['total_rows'] = $result['num_rows']; $config['per_page'] = $limit; $config['

actionscript 3 - Can't find a way to add Game Over in my flash game as3 -

so followed tutorial asgamer flash game . finished tutorial , cant find way how make game when ship goes 0 health must take screen saying game over.i tried code how game on as3 confused how write code ( used as3 classes). add vars var skills:number; var spoints:number; add health deduction function if (health <= 0 && lives <=0) { skills = kills; spoints = points; die(); } add function anywhere function die(); kills = 0; points = 0; health = 100; lives = 10; //basically reset game values besides skills , spoints gotoandstop("gameover"); } i have severall as3 classes engine ship enemyufo dont know insert code in class

c++ - how to effectively allocate memory for 20000*20000 matrix? -

my code follows pca algorithm in order find eigenvectors , eigenvalues of 20000 *35 matrix. in order find eigenvector, need find covariance matrix, on calculation of order of 20000*20000. how process such huge matrix? using opencv code i believe question ill formed; if doing pca, 20000 * 35 matrix has 20000 observations on 35 variables (having 35 observations of 20000 variables not of use, i'm guessing it's not case). if such case, covariance matrix has size 35 x 35, not 20k x 20k. you can compute eigenpairs 35x35 matrix using qr algorithm, jacobi method or other eigenvalue/eigenvector approximating algorithm (many specific real symmetric matrices, case of covariance matrix).

python - How to return resultset with Plpython3 in Postgres -

Image
how can plpython function return result set normal sql query resultset (not text). here function definition - drop function if exists demo_report(); create or replace function demo_report() returns setof <what-type> $$ rv = plpy.execute("select * test") return rv $$ language plpython3u; when execute select demo_report(); should return resultset client rather text.right getting text - i using postgres 9.2 plpython3u on windows. i found way desired result - table : create table public.test ( id serial not null, name varchar(200) not null check (name <> ''), salary int, created date, constraint id primary key (id), ) ( oids = false, autovacuum_enabled = true ); my plpython3u function - create or replace function demo_report() returns setof test $$ resp = [] rv = plpy.execute("select * test") in rv: resp.append(i) return resp $$ language 'plpython3u' volatile;

javascript - On div scroll activate another div's scroll -

jsfiddle i trying activate current scroll while outside scroll, in #divdet here tried: $("div#detdiv").scroll(function () { //i don't know should have here // $("div#scrldiv").scroll(); }); thank you it sounds want respond scroll on 1 div scrolling another. you've determined how hook scroll event. set scroll position of element (the other div ), set element's scrolltop , scrollleft values (which in pixels). if want 2 divs scroll in near-unison, instance, you'd assign source div's scrolltop , scrollleft target div . example: live copy | source relevant javascript: (function() { var target = $("#target"); $("#source").scroll(function() { target.prop("scrolltop", this.scrolltop) .prop("scrollleft", this.scrollleft); }); })(); or alternately ( source ): (function() { var target = $("#target")[0]; // <

tor - Get new Ip in python -

Image
i'm trying new ip via python. i found script on stackoverflow: import urllib2 torctl import torctl proxy_support = urllib2.proxyhandler({"http" : "127.0.0.1:8118"}) opener = urllib2.build_opener(proxy_support) def newid(): conn = torctl.connect(controladdr="127.0.0.1", controlport=9051, passphrase="123") conn.send_signal("newnym") in range(0, 10): print "case "+str(i+1) newid() proxy_support = urllib2.proxyhandler({"http" : "127.0.0.1:8118"}) urllib2.install_opener(opener) print(urllib2.urlopen("http://www.ifconfig.me/ip").read()) i have vidalia running , privoxy. have settings correctly set: in system preference (on mac) : web proxy (http): 127.0.0.1:8118 , same https in privoxy config file have line: forward-socks5 / 127.0.0.1:9051 . and in settings of vidalia have: though still when run code stuck on on case 1 , can

.net - Merge Two or More Entity Framework Entities with Dynamic Columns? -

i've got project uses sqlite database entity framework , vb.net. database complex set accessing data in individual tables. what need way transform (pivot?) data 2 or more tables , resulting table columns generated dynamically based on data in original tables. example, if start 2 tables this: table 1 id data field 1 17 1 1 34 2 1 72 3 2 23 1 2 11 2 2 46 3 3 1 1 3 19 2 3 24 3 table 2 id data field 1 abc 4 1 def 5 1 ghi 6 2 jkl 4 2 mno 5 2 pqr 6 3 stu 4 3 vwx 5 3 yz 6 i need end following resulting table: id field1 field2 field3 field4 field5 field6 1 17 34 72 abc def ghi 2 23 11 46 jkl mno pqr 3 1 19 24 stu vwx yz simplified, obviously, hope general layout clear. @ design time not kno

checkbox - simple_form (rails) displays extra characters (-- "0") -

i used simple_form , devise (ror gems) make new user , edit user form. added checkbox feature users can select payment methods accept. however, after filling , updating form, user page generates dashes, zeroes , other symbols while displaying checked items. example: (when updated form, checked "debit card" , "paypal". comes out: payment methods accepted: --- - debit card - paypal - '' i know might silly question, does know how can rid of unnecessary symbols? i'm complete beginner in ror , struggling understand codes. for edit.html.erb (which user visits view profile page), used following codes: <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:method => :put, class: 'form-horizontal'}) |f| %> <%= f.error_notification %> <%= f.input :name %> payment methods accepted: <%= @user.paymode %> <div class="checkboxes"> <

Encoding problems using PHP Gettext -

i trying start using gettext php project. however, have encoding problems. if use utf-8 encoding in .mo files , use "bind_textdomain_codeset('messages', 'utf-8');" don't see accents in browser. in firefox, in order see them ok, have change browser codification utf-8 (it not default encoding). can't expect visitators change browser encoding, should do? i tried changing iso-8859-15 and, although accents work ok (even browser default encoding), € sign doesn't work. , have read there problemas when using languages russian, doesn't seem right way. how should proceed? thank :) you should instruct browser page sending encoded in utf-8. using header before output content: header('content-type: text/html; charset=utf-8'); of course assumes page is in utf-8 in first place. in general, 1 law can never disregard content in page must in same encoding (and that's encoding use when declaring content-type). if source

php - PDO inserts wrong values -

i using symfony2 , pdo insert values database. private static function insertaction($action, $conn){ $sql = "insert bankactions (clientname, actiondate, currency, value, actiontype) values (clientname, actiondate, currency, value, actiontype)"; $q = $conn->prepare($sql); $q->execute(array(':clientname'=>$action->getclientname(), ':actiondate'=>$action->getdate(), ':currency'=>$action->getcurrency(), ':value'=>$action->getvalue(), ':actiontype'=>$action->getactiontype())); } } this var_dump array actionarray(5) { [":clientname"]=> string(6) "client" [":currentdate"]=> string(10) "1358200800" [":currency"]=> string(3) "ils" [":value"]=> string(3) "ils" [":actiontype"]=> string(7)

php - Cron file working fine in browser but not in command -

i have configured cron job in hostgator. runs web browser fine , works. ( https://www.site.com/cron.php ) scheduled cron job in hostgator not work of these command... php /home/username/public_html/cron.php or php -q /home/username/public_html/cron.php here cron.php file. can help? <?php require_once ('config_inc.php'); define('_valid_mos_', 1); set_time_limit(0); error_reporting(e_all ^ e_notice); ignore_user_abort(true); require_once (docspath . 'includes/eg_cron.php'); if (running_from_commandline()){ run_cronfile(); exit; } require_once (docspath . 'includes/setting_inc.php'); require_once (_eg_language_dir . $config['language_default'] . "/general.php"); $cron = new egcron(); if ($config['cron_investment']) $cron->cron_deposit(); if ($config['mailqueue_enable'] && $config['cron_mailqueue']) $cron->cron_mailqueue

velocity - Edit objects in a page with Xwiki -

i'm trying edit object in wiki page i created class name = "test.message" , single string attribute named "text" i put code in page {{velocity}} {{html clean="false" wiki="true"}} #set($mobj=$doc.getobject("tests.message",true)) $mobj.display("text",$context.action)<p/> {{/html}} {{/velocity}} it show form when save page object not saved/updated. doing wrong? did bind object page?

get src atribute in a code like this with jquery -

<div class="thumb"> <a class="clip-link" data-id="45778" title="title" href="http://mysite.com"> <span class="clip"> <img src="http://mysite.com/17.jpg" alt="pic alt"><span class="vertical-align"></span> </span> <span class="overlay"></span> </a> </div> well know how attributes div, class, etc,, in case want pic src grid given structure, , don't know how reach specific clp span cli-link data-id, help? thanks in advance! $('a[data-id="45778"] > span.clip > img').attr('src');

Haskell - store variables -

i write simple interpreter , store variables. till have: -- myenv map strings integers type myenv = m.map string int type tcm = errort string (statet myenv io) i have definition ms_assgn :: assgn -> tcm() ms_assgn (assgn (ident ident) exp) = map <- w1 <- ms_exp exp put (m.insert (ident w1 map)) and have obtained following mistatkes: interpret.hs:118:5: couldn't match type `envnt' `a0 -> m.map k0 a0 -> m.map k0 a0' when using functional dependencies combine monadstate s (statet s m), arising dependency `m -> s' in instance declaration in `control.monad.state.class' monadstate (a0 -> m.map k0 a0 -> m.map k0 a0) (statet envnt io), arising use of `put' @ interpret.hs:118:5-7 in stmt of 'do' block: put (m.insert (ident w1 map)) in expression: { map <- get; w1 <- ms_exp exp; put (m.insert (ident w1 map)) } interpret.hs:118:20: couldn't match expected type `integer ->

scala - Difficulty writing method with partially applied type parameter and typetag -

i looking way remove type parameter s call apply in following example: object attribute { trait int [s] extends attribute[s] trait boolean[s] extends attribute[s] // etc. } sealed trait attribute[s] trait attributes[s] { protected def get(key: string): option[attribute[s]] def apply[a <: attribute[s]](key: string) (implicit tag: reflect.classtag[a]): option[a] = get(key) match { case some(attr: a) => some(attr) case _ => none } } with above definition, test case be: trait test[s] { def map: attributes[s] map[attribute.int[s]]("foo") } what i'm trying do, modify apply definition allow following: trait test2[s] { def map: attributes[s] map[attribute.int]("foo") // use partially applied attribute type } edit : following on suggestion of marius , comments, why following still producing erasure warning: import reflect.runtime.universe._ trait att

java switch statements using label value -

can refer selected case in switch statements within case-block? as clarification: assume have function output(string) outputs given string. can old code transformed in new code (which not know correct syntax for)? old code: public void switchtest(string string) { case "car": output("car: car"); break; case "cat": output("animal: cat"); break; case "dog": output("animal: dog"); break; case "mouse": output("animal: mouse"); break; default: output("unknown"); break; } proposed code, x being our magical element: public void switchtest(string string) { case "car": output("car: " + x); break; case "cat": case "dog": case "mouse": output("animal: " + x); break; default:

sql - How can I delete all rows within a table in a mysql database, which value = 0 for one of the columns? -

so basically, it's this: the table called phpbb_posts the column name post_approved i want run query deletes rows in phpbb_posts table in post_approved value 0 (all rows contain either 1 or 0 value column post_approved ) i wanted make sure running correct query, before running it. delete phpbb_posts exists( select * phpbb_posts (post_approved = 0) ) please tell me if code correct; or if wrong, please tell me correct code. code fixed (thanks!): delete phpbb_posts post_approved = 0 result: 35743 rows deleted. ( query took 1.3562 sec ) p.s. wondering, removes spam posts phpbb in 1 fell swoop! (assuming don't have valid posts want approve). instead of going through moderator , "disapproving" 50,000 pages, can this! :) :) , yes checked in moderator queue , spam posts never approved gone! yay! just do delete phpbb_posts post_approved = 0

search - Sql advanced searching -

i'm trying create search engine e-shop , want make this: if client writes e.x galaxy white in search bar want execute sql query matches string products not ones title galaxy white s3 titles galaxy s3 white 16 gb. is possible? to more accurate may needed provide "similar phrases" (synonyms). because e.g. you're searching phone on windows phone 8, , may type "wp8", levenshtein distance won't solve problem.

javascript - collisions detection between my player and a block from a 2d-array -

i'm trying make little game fun of have collision problems. i have player drawn on canvas , blocks (16 x 16px) drawn on canvas. but have problem detecting horizontal collisions. ... my problem comes down this: my player uses x y coordinates stored as: var p_x; var p_y; these values players bottom left coordinates in pixels. but blocks in 2d array called: var g_levelarray; and each block 16 x 16 px instance if do: g_levelarray[3][2] = 1; means block drawn @ canvas left: 48px , canvas bottom 32px ... but have code check if block exists (according player) x , y playercoordinates function blockexists(x, y) { var xpos = parseint(x / g_blocksize); var ypos = parseint(y / g_blocksize); $("#checkedblock").html("checked block: " + xpos + " " + ypos); if (g_levelarray[xpos][ypos] != undefined) { return true; } else { return false; } } but check has errors due fact rounds down nu

c# - Updating a record using Linq-to-SQL -

i've done many times , has worked. every example i've found have.. i query... var result = u in tdc.tblusers u.userid == userid select u; and change values want to: foreach (tblusers u in result) { //change values (and no im not changing primary key or foreign keys) } then submit changes tdc.submitchanges(); i have tried way before , got same error tblusers result = (from u in tdc.tblusers u.userid == userid select u).single(); result.address = address; result.phone = phone; tdc.submitchanges(); it ever retrieve 1 record query since userid primary key. when hits submit changes, throws exception row wasn't found or changed. person using there's no other conflicts accessing db or locking. why throw changeconflictexception ? have stepped through debugger , data persists way through process, including changes i'm trying make. you getting error possibly because 1 of f

java - How to get a JTextField to respond to the enter key -

so want jtexfield put text in jtextarea when enter key pressed cursor in it. can help? forget using keylistener swing components. this listener designed use awt components not provide reliable interaction mechanism jtextcomponents . use actionlistener instead - on vast majority of systems actionevent dispatched jtextfield when enter pressed. mytextfield.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { mytextarea.append(mytextfield.gettext() + "\n"); } });

c# - How to invoke dll method on a different machine? -

let's have c dll functions like: void beep(); char* foo(char** whatever); now want able put dll on 1 machine (server) , call different machine (client). client can c# dll (and proxy server) needs regular c. ideal on client: mydllaccess remote = proxylib.getremotedll("192.168.1.10:12100", "mydll.dll"); remote.execute("beep"); // other machine beeps (uses getprocaddress find function) i know i'm reinventing com, etc, but..... there way? if not, why not , simplest way want since have dll? edit: needs work linux shared library, e.g. proxylib.getremote("192.168.10.12100", "mything.so") if need work across different oses, have hard time doing in pretty generic manner. can search "platform independent apis" in wikipedia article: inter-process communication idea. of find heavyweight. one simple way write ad-hoc http rest server (possibly json or xml interchange format). has advantage of being simp