Posts

Showing posts from April, 2012

python - If and only if all given conditions are true -

import numpy np def data_verify(source): rows = [x.strip().split(' ') x in open(source)] columns = zip(*rows) blocks = np.array(rows).reshape((3,3,3,3)).transpose((0,2,1,3)).reshape((9,9)) #check iff, see further return rows, columns, blocks else: return false got sudoku grid in txt such: 3 2 7 4 8 1 6 5 9 1 8 9 3 6 5 7 2 4 6 5 4 2 7 9 8 1 3 7 9 8 1 3 2 5 4 6 5 6 3 9 4 7 2 8 1 2 4 1 6 5 8 3 9 7 8 1 2 7 9 3 4 6 5 4 7 5 8 1 6 9 3 2 9 3 6 5 2 4 1 7 8 the function collects relevant data , return respective rows, columns , blocks iff length of rows same columns' (got few other functions determine whether puzzle legit). figured enough compare first row columns (or vice versa, doesn't make difference). how can create check goes like: for in range(len(rows)): if len(row[0]) == len(column[i]): #do if of lengths check out use all : if all(len(row[0]) == len(colum

javascript - if element has opacity=1 not working -

i have piece of code that's not working , can't figure out why. here's simplified code: html: <div id="objinfo"> <div id="button"></div> <img src="img/x.png" class="obj_x"> </div> css: #objinfo { opacity: 0; display: none } javascript: if ($('#objinfo').css('opacity') != "1") { $("#button").click(function(){ $("#objinfo").css("display", "block"); $("#objinfo").animate({opacity: 1, top: "-25px"}); }); } else { $(".obj_x").click(function(){ $("#objinfo").css("display", "none"); $("#objinfo").animate({opacity: 0, top: "+25px"}); }); } so basically, wanna have popup (#objinfo) appears when #button clicked , disappears when .obj_x clicked. , also, want #objinfo disappear when click outside of

Android stack is not getting clear -

i have got stuck in situation please me .here problem .i have menu screen in application.now have given option go menu screens has not come directly menu screen .for example go activity b menu ->activity -->activity b. have written on pressing backtomenu button. this.finish(); startactivity(new intent(selectstateactivity.this,menuscreen.class).setflags(intent.flag_activity_clear_top)); i not finishing activity because want on activity when press button on activity b.so on stack when press menu button on activity b. come menu screen fine when press on menu screen come activity a.which not wanted.i tried this.finish(); startactivity(new intent(selectstateactivity.this,menuscreen.class).setflags(intent.flag_activity_clear_task|intent.flag_activity_clear_top)); and startactivity(new intent(selectstateactivity.this,menuscreen.class).setflags(intent.flag_activity_clear_task|intent.flag_activity_new_task)); but haven't worked.please me. you can solve issue

Facebook friends list is empty, just for one specific user -

simply executing query aiming list friend's friends: get https://graph.facebook.com/hisfacebookuserid/friends?return_ssl_resources=1&access_token=hisaccesstoken i obtain empty data entry. => if had 0 friends. (but has 800). however, works many other users. what might reason? since v2.0 of facebook api, can friends authorized app too. it´s (privacy) feature, not bug. https://developers.facebook.com/docs/apps/changelog also, it´s not necessary use id call, because can friends of authorized user anyway: /me/friends btw, don´t forget authorize users user_friends permission.

android - When exchange Activity black screen -

i have problem when call activity. screen goes black, , when done preload layout shows activity. the problem layout needs load heavy. how can manage thing not good? this code, tried various tests: 1 syncronize 2 asinktask if (tab.getposition() == 0) { /* * ----------------- tab data ----------------- */ try { system.gc(); //initialize class needs load activity mylayout = new tablemainlayout(this); //i tried give time load, that's not good! synchronized (this) { wait(5000); } setcontentview(mylayout); } catch (exception e) { log.i("link", "errore actionbartabs update series: " + e); } } but no avail. can tell me solution? or advice? edit : update code: tablemainlayout.java my problem can not figure out when layout ready. tried put in async nothing, tried syncronize nothing.

ios - Redefinition of enumerator in two seperate frameworks -

i have 2 frameworks included in 1 of files #import "sclalertview.h" #import "actionsheetstringpicker.h" these frameworks unfortunately fighting against each other , trying define same constant. typedef ns_enum(nsinteger, sclactiontype) { none, selector, block }; typedef ns_enum(nsinteger, actiontype) { value, selector, block }; is there easy solution redefinition of enumerator? change code, prefer not to, since update of frameworks revert changes , require me redo once again. thank in advance. i've removed 1 of frameworks.

tableview - JavaFX8 - Remove highlighting of selected row -

Image
when click on row within tableview row highlighted blue. how possible disable feature? i've tried set background white, problem row-color isn't white in every row. know do? best regards edit: in image below see blue color of second row. highlighting should removed. if want (i agree @kleopatra in comments make life difficult user) can revert colors selected rows external css file: .table-row-cell:filled:selected { -fx-background: -fx-control-inner-background ; -fx-background-color: -fx-table-cell-border-color, -fx-background ; -fx-background-insets: 0, 0 0 1 0 ; -fx-table-cell-border-color: derive(-fx-color, 5%); } .table-row-cell:odd:filled:selected { -fx-background: -fx-control-inner-background-alt ; }

windows - Using a batch program to search for a keyword and copy offset content to a file -

i trying figure out way code windows batch program search file keyword. every time keyword found, line 3 lines below content found, , letter 5 12 copied file. using example input file below: example_input.txt bla bla bla bla bla bla bla bla bla bla bla keyword bla bla bla bla bla bla bla bla bla bla bla bla bla content1bla bla bla keyword bla bla bla bla bla bla bla bla bla bla bla bla bla content2bla bla i wish following output file example_ouput.txt content1 content2 the input file never have keyword before content offset reached. may necessary copy multiple content items per keyword. i have searched , found couple of single elements of process, have been unable combine these working script. therefore highly appreciate help. i wrote efficient program called findrepl.bat designed find strings in files in advanced ways. use straightforward, can see in example session below: c:\> type input.txt bla bla bla bla bla bla bla bla bla bla bla keyword bla bla bla

javascript - Capture user input without input field -

i want capture user input in webpage without having input field. screen used mobile device can scan barcode , rfid. capturing input using input field. <input id="rfidcontainer"/> <div class="footer-btn confirm td-div"> <img src="img/done.png" /> f1 - confirm </div> however, user shouldn't able see data scans because has no added value see number. i'm wondering how can capture input without input field? not relevant current code process input looks this: views.rfidview = backbone.view.extend({ events: { "click .confirm": "doconfirmscan" }, initialize: function() { this.template = _.template(utils.templateloader.get('rfid')); }, render: function(eventname) { $(this.el).html(this.template(this.model.tojson())); this.$("#rfidcontainer").focus(); return this; }, doconfirmscan : function(

c++ - How can I add custom widget as Popup menu for ToolButton? -

i have created custom widget,it has displayed popup menu when click on toolbutton. how can in qt 5.1.1 ? you should create custom qwidgetaction add popup menu. this sample qwidgetaction : #include <qwidgetaction> class mycustomwidgetaction: public qwidgetaction { q_object public: explicit mycustomwidgetaction(qwidget * parent); protected: qwidget * createwidget(qwidget *parent); }; mycustomwidgetaction::mycustomwidgetaction(qwidget * parent):qwidgetaction(parent) { } qwidget * mycustomwidgetaction::createwidget(qwidget *parent){ mycustomwidget * widget=new mycustomwidget(parent); return widget; } you can add widget tool button displayed in popup menu: mycustomwidgetaction * widgetaction = new mycustomwidgetaction(this); ui->toolbutton->addaction(widgetaction); mycustomwidget can widget. can add multiple instances of mycustomwidgetaction toolbutton.

c - Get char in the middle of the string YACC -

my question kinda simple, suppose. here code, %{ #include <stdio.h> #include <ctype.h> #include <stdlib.h> int yylex(void); void yyerror(char const *c); int yywarp(){ return 1; } %} %token letter mid %% input: {printf("enter polindrom:\n");} | input line; line: anal '\n' {printf("good\n\n");} | error '\n' {yyerrok;} ; anal: mid mid { printf("%d %d\n", $1, $2); if($1!=$2) yyerror; } |letter anal letter { printf("%d %d\n", $1, $3); if($1!=$3) yyerror; } ; %% int yylex(void) { int c; char a[10]; c = getchar(); if(c == 'a'){ yylval = c; return mid; } if(isalpha(c)){ yylval = c; return letter; } if(c == eof) return 0; return c; } void yyerror(char const *c) { fprintf(stderr, "%s\n", c); } int ma

perl - how do I list contents of local directory on ftp? -

i trying send files remote host via perl script. want list local directory choose files upload iterate through files list using following commands: my @files = '!ls'; not work @files = 'lls'; not work either then want do: foreach $file (@files) { next if -d $file; next unless $file =~ /^gateway_data/; $ftp->put($file) or warn "failed '$file': $! ($^e)"; } is there command, apart 2 above, make list of files in local directory? assistance appreciated. opendir(my $dir, './') or die $!; @files = readdir($dir); foreach $file (@files) { next if -d $file; next unless $file =~ /^gateway_data/; $ftp->put($file) or warn "failed '$file': $! ($^e)"; } this should work.

java - Error while executing maven project -

i create maven project http error: 503 problem accessing /. reason: service_unavailable powered jetty:// i got following error org.springframework.beans.factory.parsing.beandefinitionparsingexception: configuration problem: unable locate spring namespacehandler xml schema namespace [ http://activemq.apache.org/schema/core] offending resource: servletcontext resource [/web-inf/spring/app-jpa-config.xml] @ org.springframework.beans.factory.parsing.failfastproblemreporter.error(failfastproblemreporter.java:68) <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:jms="http://www.springframework.org/schema/jms" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org

html - styling difference between IE11 and chrome -

i've simple button + or - content <button></button> button::before { content: '-'; } button.active::before { content: '+'; } in browsers have installed on mac (chrome,safari , firefox) button styled correct, check out in ie11 (or firefox on windows 8.1 not perfect) styling bad demo can explain me wrong in css, or maybe (most likely) wrong ie11. there fix, or should change css , don't use position: absolute maybe? you forgot add left , top properties on absolutely positioned element. add them , ie behave expected. updated fiddle

Python yield a list with generator -

i getting confused purpose of " return " , " yield " def countmorethanone(): return (yy yy in xrange(1,10,2)) def countmorethanone(): yield (yy yy in xrange(1,10,2)) what difference on above function? impossible access content inside function using yield? in first return generator from itertools import chain def countmorethanone(): return (yy yy in xrange(1,10,2)) print list(countmorethanone()) >>> [1, 3, 5, 7, 9] while in yielding generator generator within generator def countmorethanone(): yield (yy yy in xrange(1,10,2)) print list(countmorethanone()) print list(chain.from_iterable(countmorethanone())) [<generator object <genexpr> @ 0x7f0fd85c8f00>] [1, 3, 5, 7, 9] if use list comprehension difference can seen:- in first:- def countmorethanone(): return [yy yy in xrange(1,10,2)] print countmorethanone() >>> [1, 3, 5, 7, 9] def countmorethanone1(): yield [yy yy in xrange

php - How to callback ajax request separate -

i'm learning way work ajax php send request with; $.ajax({ url: 'check_exists.php', type: "post", data: registerform.serialize(), success: function(data) { console.log(data) registermsg = $('.registermsg'); if (data == 'nickname_exists') { nickname.addclass('error'); } else if (data == 'email_exists') { email.addclass('error'); } else { registermsg.html(''); } } }); now send php file , checks if data exists if input nickname nickname_exist , if same email email_exists back. but if both data console.log nickname_existsemail_exists way doesn't trigger if statement. i send php file like; require_once('db_connect.php'); if(isset($_post['nickname'])){ $nickname = $_post['nickname']; $st = $db->

Android battery temperature and voltage wrong values -

i have tested code. on 2 phones, work´s ok , give me right values. on tablet same code returns temperature value 0 , voltage value 3 (wrong values). can give me understand ? each code try, return values. thank´s. @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub view rootview = inflater.inflate(r.layout.battery_fragment1, container, false); rootview.setlayoutparams(new layoutparams(layoutparams.match_parent,layoutparams.match_parent )); getactivity().registerreceiver(mbatinforeceiver, new intentfilter( intent.action_battery_changed)); battemp=(textview)rootview.findviewbyid(r.id.batterystatus); return rootview; } private broadcastreceiver mbatinforeceiver = new broadcastreceiver() { @override public void onreceive(context c, intent intent) { level = intent.getintextra(batterymanager.e

java - Is there a way to not implement Serializeble for MyBatis domain objects -

if want map sql object in mybatis, need implement serializable interface. this: public class user implements serializable { otherwise throws notserializableexception when try map sql results object. is there way congigure mybatis such allows me have domain object not implementing serializable? i found reason why mybatis needs serializable object. normally, when not use tag, works fine without implementing serializable interface. the reason mybatis need read/write object via serialization. this link may https://mybatis.github.io/mybatis-3/sqlmap-xml.html

python - Creating Fortran/C/Matlab function/(sub)routine for numerical symbolic matrix/array evaluation -

i evaluate numerically symbolic matrices created in python (sympy) using external function generated automatically. my goal generate such subroutine subroutine my_fun(y, x, z, m, c) implicit none real*8, intent(in) :: x real*8, intent(in) :: y real*8, intent(in) :: z integer*4, intent(in) :: m real*8, intent(out), dimension(1:m) :: c integer*4 :: line line=1 c(line) = x + y*z line=line+1 c(line) = y*z-x end subroutine i try use codegen in following way c = symbols('c', cls=indexedbase) m= symbols('m', integer=true) = idx('line', m) [(c_name, c_code), (h_name, c_header)] = codegen(('my_fun', eq(c[line],x+y*z)),\ 'f95', 'test10', header=true, empty=true) but result quite far subroutine my_fun(x, y, z, m, c) implicit none real*8, intent(in) :: x real*8, intent(in) :: y real*8, intent(in) :: z integer*4, intent(in) :: m real*8, intent(out), dimension(1:m) :: c integer*4 :: line line = 1, m c(line) = x + y*z end end su

Android application for text and voice communication between devices on a same LAN -

i want develop android application feature allows people on lan text , mae voice call communicate each other. if there tutorial regarding topic, please suggest me. here 2 sample projects can refer. 1 ] audio chat 2 ] text chat

android - What will happen if i run a apk with high api compiled in a low api device? -

now have project, is compiled api 14 . "is compiled", mean project.properties file has line "target=android-14". but, defined android:minsdk=8 in androidmanifest.xml. in project, used high api features, android.animation.valueanimator, android.app.actionbar. project, of course, run in high api device. since minsdk 8, can install apk in 2.x devices, happen then? valueanimator , actionbar erased? or cannot install apk in 2.x devices? if app loaded memory logcat warnings if classes/methods cannot resolved. example: i/dalvikvm﹕ not find method java.lang.string.isempty, referenced method eu.lp0.slf4j.android.loggerfactory.getconfig w/dalvikvm﹕ vfy: unable resolve virtual method 524: ljava/lang/string;.isempty ()z d/dalvikvm﹕ vfy: replacing opcode 0x6e @ 0x0010 d/dalvikvm﹕ vfy: dead code 0x0013-0044 in leu/lp0/slf4j/android/loggerfactory;.getconfig (ljava/lang/string;)leu/lp0/slf4j/android/loggerconfig; if app trying execute code not supported device

how to check data is either video or image in android? -

i using intent picking image or video gallery in android app. i using following code string filetypestring = "image/* video/*"; intent selectfileintent = new intent(intent.action_pick, mediastore.images.media.external_content_uri); selectfileintent.settype(filetypestring); startactivityforresult(selectfileintent, uploadimageasynctask.media_picker); now how can find result either image or video? edit: uploadimageasynctask.media_picker request code have generated elsewhere. call below method parameter of filepath. public string getmimetype(string filepath) { string type = null; string extension = getfileextensionfromurl(filepath); if (extension != null) { mimetypemap mime = mimetypemap.getsingleton(); type = mime.getmimetypefromextension(extension); } return type; }

mysql - SQL query to filter saturday and sunday -

i have complex sql query calculates working hours of 2 times. working hours follow monday-friday 9am 6pm saturday 9am 1pm sunday off two columns created , closed . if created date of saturday should calculate created time till 1pm + (closed-9am) of monday.sunday should 0. how achieve that?? $ select `id` 'no', `subject`, `status`, `created`, `closed`, case when (date(ot.`created`) = date(ot.`closed`)) concat( '0 days ', floor(hour(timediff(`closed`, `created`))),' hours ', (case when minute(timediff(`closed`, `created`)) < 10 concat( minute(timediff(`closed`, `created`)), ' minutes') else concat(((floor(minute(`created`)/10)) +1), '0 minutes')end)) when (date(date_add(ot.`created`, interval 1 day)) = date(ot.`closed`)) case when hour(`created`)>'18' concat( floor(((hour(`closed`)-9) )/9),' days ',

javascript - Meteor Dynamically Create Objects and refer to them? // Is there a simple way to do this -

so, im new both javascript , meteor, know handful of things. learning both, javascript , meteor set myself challenge make 3 3 field of individual counters in them, count, if click cell. i reached first goal: http://9fields.meteor.com/ the second goal set myself try make expandable. say, want make same field 7x7. every cell has own template. <template name="zelle1"> <td class="box"> <p class="textinbox">{{counter}}</p> </td> </template> every cell has own counter , every cell has 1 event handler , 1 helper register click template.zelle1.helpers({ counter: function () { return session.get("counter1"); } }); template.zelle1.events({ "click td": function() { return session.set("counter1", session.get("counter1")+1); } }); i pasted

Getting Sitecore Template Error -

i getting exception in following line item.template.id.tostring(); and getting item sitecore, template shows null.so unable find issue, why template becoming null.in sitecore, item there , template there.

c# - How to see if (for example) array[3] exists -

i want type strings in console. example "hello im 20", , want split line little strings. strings want something. when put in "hello im", should possible write line like: "forgot put in ago"so tried (words[2] == null), doens't work. string line line = console.readline(); string[] words = new string[3]; words = line.split(' '); foreach(string word in words) { if (words[2] == null) { } else { int = int32.parse(words[2]); //do here } } the item in array @ position 3 fourth item, since start counting @ 0 (as say, arrays 0-based). so have check if length @ least 4 ( 0 , 1 , 2 , 3 ). since length integer, , integers c

javascript - Setting a function as a ng-model -

i have complex structure of data (products of shopping cart), this: items = [ { id_product: 5, combinations: [ { id_product_attribute: 35, quantity: 1, price: 25.60 }, { id_product_attribute: 38, quantity: 4, price: 25.60 } ] }, { id_product: 5, combinations: [ { id_product_attribute: 35, quantity: 1, price: 28.60 } ] } ]; i have ng-repeat lists, in li elements, every combination of product retrieved $resource . each li element looks this: <li>combination {{ combination.id }} - price {{ combination.price }} - in shopping cart {{ function_goes_here(product.id, combination.id) }}</li> i'm wondering if it's possible write kind of function search in shopping cart data structure (b

c++ template NULL undeclared identifier -

i having problems in c++ templates , null. trying make bst in c++ using templates. have class element, treeelement , binarysearchtree. a binarysearchtree has treeelements nodes. each treeelement has linkedlist of elements. each element has long indentify , check whether it's <, > or ==. now error: null undeclared identifier. don't know how it's possible. here's code of treeelement error: template <class t> class treeelement { private: treeelement* lefttree; treeelement* righttree; treeelement* parent; element<t>* value; public: //here error!! treeelement(element<t>* element){value = element; lefttree = null; righttree = null; parent = null;}; ~treeelement() { element<t>* nextelement; if (value != null) { while (value->getnextelement() != null) { nextelement = value; value = nextelement->getnextelement(); delete nextelement

sql - Count how many percent of values on each column are nulls -

is there way, through information_schema or otherwise, calculate how many percent of each column of table (or set of tables, better yet) null s? your query has number of problems, importantly not escaping identifiers (which lead exceptions @ best or sql injection attacks in worst case) , not taking schema account. use instead: select 'select ' || string_agg(concat('round(100 - 100 * count(', col , ') / count(*)::numeric, 2) ', col_pct), e'\n , ') || e'\nfrom ' || tbl ( select quote_ident(table_schema) || '.' || quote_ident(table_name) tbl , quote_ident(column_name) col , quote_ident(column_name || '_pct') col_pct information_schema.columns table_name = 'my_table_name' order ordinal_position ) sub group tbl; produces query like: select round(100 - 100 * count(id) / count(*)::numeric, 2) id_pct , round(100 - 100 * count(day) / count(*)

Monitoring SAS loads into SQL -

quick question, super new sas programming language , have been googling way around. wanted know if possible monitor loads of sas, how have in sql - etl jobs etc. asked create polling on dataset loads in sas. once done creates entry in sql stating that dataset done. thanks in advance :) it's possible, i'm not sure i'm clear enough on want. sas has log, indicates when load done , how many rows have been loaded, how long took. note: data set work.test has 10 observations , 4 variables. note: data statement used (total process time): real time 0.00 seconds cpu time 0.00 seconds you can add data step commands (if you're using data step , not proc sql) note in log when number of rows loaded, perhaps timestamp. for example: *create data play with; data load_me; _x = 1 1e6; output; end; run; *pretend loading somewhere; data load_here; set load_me; if mod(_n_,100000)=0 do; *every 100000th row, put out line

some issue about the aggregator module. (spring integration) -

i made aggregator using spring integration. , if count of requests same group key 7, aggregator has released going next channel. but, if count becomes 7, aggregator doesn't release. weird thing is.. sometimes, worked.. the jdbc-cache-store table, 'int_message_group' -> complete 1 released 0 group_key region marked complete last_released_sequence created_date updated_date 57eba5ba-dfdb-3901-a03d-4324942cdcfe default 0 1 0 2014-11-19 22:37:01.272 2014-11-19 22:41:37.935 need see <aggregator> configuration , understand groups. if use same correlationkey (static) should use expire-groups-upon-completion="true" sure after 7 release aggregator ready collect fresh group same correlationkey .

url rewriting - IIS URL Rewrite re-appears after deployment -

i using "application request routing" (arr) , url rewrite 2.0 implement reverse proxy in iis. server set this: server - no url rewrite rules specified, arr proxy enabled app 1 - bound 8080 , hostname app.site.com, no url rewrite rules specified redirect - bound *:80 , *:443, url rewrite configured (.*) http://localhost:8080/{r:1} this works fine, until deploy new version of "app 1" using web deploy. @ point unexpected url rewrite rule appears in configuration "app 1" value /(.*) , breaks everything. noticed rule re-inserted whenever click "revert parent" in configuration, parent (which assume server node) doesn't have rules configured. why rule appear? if ever happens you, it's because iis interface lying url rewrite rules configured server node. absolutely sure rewrite rules in applicationhost.config : open configuration node server in iis open management -> configuration editor go "system.webserver

Scala design suggestion needed -

i design client talk rest api . have implemented bit call http methods on server. call layer, api layer. each operation server exposes encapsulated 1 method in layer. method takes input clientcontext contains needed information make http method call on server. i'm trying set interface layer, let's call clientlayer . interface 1 users of client library should use consume services. when calling interface, user should create clientcontext , set request parameters depending on operation willing invoke. traditional java approach, have state on clientlayer object represents clientcontext : for example: public class clientlayer { private static final clientcontext; ... } i have constructors set clientcontext . sample call below: clientlayer client = clientlayer.getdefaultclient(); client.executemymethod(client.getclientcontext, new mymethodparameters(...)) coming scala , suggestions on how have same level of simplicity respect clientcontext instantiation while

powershell - WMI parsing not expected result -

i wrote script ip address of remote machine, working intended. problem i'm trying show ipv4 address , not ipv6 address created logic not working, doing wrong here? get-wmiobject -computername remoteserver win32_networkadapterconfiguration | ? { $_.ipaddress -ne $null -and $_.ipaddress -ne 'fe80*' } | select -expandproperty ipaddress looking @ below, can see ipaddress property of win32_networkadapterconfiguration object, it's object array: dhcpenabled : false ipaddress : {192.168.3.1, fe80::8c4a:cfd3:6c30:5695} defaultipgateway : dnsdomain : servicename : vmnetadapter description : vmware virtual ethernet adapter vmnet1 index : 5 ps> ((get-wmiobject win32_networkadapterconfiguration | select ipaddress ).ipaddress).gettype() ispublic isserial name basetype -------- -------- ---- -------- true true object[]

python - invalid character in identifier (urls.py, line 5) in Django -

this first time learning django , getting following error. invalid character in identifier (urls.py, line 5) in django error occuring application urls.py this how app urls.py looks like: from django.conf.urls import * maasapp import * urlpatterns = [url(r’^home/’,'maasapp.views.home',name='home'),] please can me... you putting wrong quotes. replace: r’^home/’ with: r'^home/'

c# - Rerun method as soon as it has finished -

right i'm using timer trigger method. how can make service run method has finished? private timer timer; public service() { initializecomponent(); } protected override void onstart(string[] args) { dosomething(); timer = new timer(); timer.enabled = true; timer.interval = 60000; timer.autoreset = true; timer.start(); timer.elapsed += timer_elapsed; } protected override void onstop() { base.onstop(); } private void timer_elapsed(object sender, elapsedeventargs e) { dosomething(); } get rid of timer , use recursion: public service() { initializecomponent(); dosomething(); } private void dosomething() { // code takes while execute // make recursive call self dosomething(); } edit answer accepted won't work in context of service (actually, execute, service forever stuck in 'starting' status, , generate 1503 error

Websphere console - Monitor server events such as server restart -

i absolutely not familiar websphere , haven't found within last 30 of minutes web research. is there view can obtain list of server events such starts-, stops- or restarts in web console of 8.5 application server? what tried: 30 minute web research. my workaround :i used our splunk filter example "starting application..." identify time application started based on log events. apply similar filters recognize server restarts. by default there no such view. there @ least 2 potential solutions, use, workaround might easier ;-) : enable runtime messages in web console go troubleshooting > runtime messages > runtime information. enable info level, save , restart. able filter massages using filter in table , providing message fragment. use hpel logging , filtering you can switch default logging hpel in logging , tracing > server1 > switch hpel . after logging done in binary form (much better performance) , able searches based on eve

Schedule net user command using at in Windows -

in windows 7, trying schedule following command run net user testuser /active:no when type at 4:20 "net user testuser /active:no" command line interpreter see job scheduled , command looks correct yet after time has passed, user's status still active. when run net user testuser /active:no command line works desired. how @ run net user command?

Ranking according to value across two variables - r -

i have dataframe: df<-data.frame( var1 = c(rep(c(rep(1,2), rep(2,3), rep(3,2), rep(4,1)),2), 1), var2 = c(rep(1,8), rep(2,8),3) ) df var1 var2 #1 1 1 #2 1 1 #3 2 1 #4 2 1 #5 2 1 #6 3 1 #7 3 1 #8 4 1 #9 1 2 #10 1 2 #11 2 2 #12 2 2 #13 2 2 #14 3 2 #15 3 2 #16 4 2 #17 1 3 i make third variable rank. rows highest rank if 1) have lowest numbers in var2 - , according how low numbers in var1 . e.g. rows 1 , 2 var2=1 , var1=1 should ranked 1. whereas, rows 9 , 10 var2=2 , var1=1 ranked 5. if data arranged in ascending order of var2 , var1, did following using favorite r function rle achieve ranking i'm after: rle(df$var1) n <- length(rle(df$var1)$lengths) df$ranks <- rep(1:n, rle(df$var1)$lengths) df var1 var2 ranks #1 1 1 1 #2 1 1 1 #3 2 1 2 #4 2 1 2 #5 2 1 2 #6

android - Unable to refresh listView from other class -

in main fragment, have listview called noteslistview . noteadapter populates noteslistview . when user long clicks on 1 of noteslistview 's elements, dialog shows , asks if user wants remove item. if agrees, item removed database. if not - life goes on. the issue dialog other class (other fragment). class, pass database object , noteadapter object well, remove item database , notify noteadapter data has changed. sounds enough, doesn't work, , have absolutely no idea why. give please , me out. this method in mainfragment, handles mentioned listview: public void handlenotes(final listview noteslistview) { if (database.getnotecount() != 0) { noteslistview.setadapter(noteadapter); noteslistview.setonitemlongclicklistener(new adapterview.onitemlongclicklistener() { @override public boolean onitemlongclick(adapterview<?> adapterview, view view, int i, long l) { textview textviewid = (textview) view.findviewbyid(r.id.textviewi

python - lxml modify tags prevent -

how prevent lxml modify tags from lxml import etree lxml.html.soupparser import fromstring html = '<iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>' root = fromstring(html) print etree.tostring(root,encoding='utf-8') it prints short version of tag '<iframe width="560" height="315" src="" frameborder="0" allowfullscreen/>' how prevent this? needed output '<iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>' ? use tostring() method="html" : print etree.tostring(root.find('iframe'), encoding='utf-8', method="html") demo: >>> lxml import etree >>> lxml.html.soupparser import fromstring >>> >>> html = '<iframe width="560" height=&

wordpress - a format specification for argument 2, as in 'msgstr[0]', doesn't exist in 'msgid_plural' -

i have following code: public function bulk_updated_messages ( $bulk_messages = array(), $bulk_counts = array() ) { $bulk_messages[ $this->post_type ] = array( 'updated' => sprintf( _n( '%1$s %2$s updated.', '%1$s %3$s updated.', $bulk_counts['updated'], 'yosilose' ), $bulk_counts['updated'], $this->single, $this->plural ), 'locked' => sprintf( _n( '%1$s %2$s not updated, editing it.', '%1$s %3$s not updated, editing them.', $bulk_counts['locked'], 'yosilose' ), $bulk_counts['locked'], $this->single, $this->plural ), 'deleted' => sprintf( _n( '%1$s %2$s permanently deleted.', '%1$s %3$s permanently deleted.', $bulk_counts['deleted'], 'yosilose' ), $bulk_counts['deleted'], $this->single, $this->plural ), 'trashed' => sprintf( _n( '%1$s %2$s moved tra

python - How to handle dependency on scipy in setup.py -

i trying create setup.py project depends on scipy. following setup.py reproduces this: setup( name='test', version='0.1', install_requires=['scipy'] ) when installing using python setup.py develop generates following error: importerror: no module named numpy.distutils.core however, when install scipy using pip , installed wheel, , works fine. so, questions is, how can create setup.py depends on scipy? why won't setuptools install dependencies wheels? work better when using python 3 (we plan migrate anyway, if works there, i'll wait until migration complete). i using python 2.7.8 on mac os x 10.10.1 setuptools 3.6 , pip 1.5.6. ultimately, worked me: #!/usr/bin/env python setuptools import setup, extension setuptools.command.build_ext import build_ext _build_ext # # cludge necessary horrible reasons: see comment below , # http://stackoverflow.com/q/19919905/447288 # class build_ext(_build_ext): def finali

mysql - Insert Into WHERE Data in a column is specific -

i trying copy data (columns, too) table1 in table2 column1 xyz. i have like: insert table2 select * table1 column1='xyz' this errors telling me column1 unknown field name. your column names must match, alias them come out of table1 match table2 insert table2 select table1_column1 table2_column1 table1 table1_column1='xyz'

javascript - Remove :checked from the input with the text of the button -

i duplicate values checkpoint block. clicking on new element, must removed , filter selection, too. please find mistake. $('.views-exposed-widget').on('change', 'input', function () { var self = $(this), name = this.name, text = self.closest('.form-type-radio').find('label[class="option"]').text(), target = $('.duplicate-filter').find('[data-for="'+ name +'"]'); if (target.length == 0){ target = $('<span class="o_filt" data-for="'+name+'"></span>').appendto('.duplicate-filter'); } target.text( text ); $('.o_filt').on('click', function(){ var l = $(this).text(); m = $('.views-exposed-form .form-type-radio label.option'); $(this).remove(); m.each(function(){ if(

vagrant / puppet init.d script reports start when no start occurred -

so, struggling major problem, i've tried multiple different workarounds try , working there happening between puppet , actual server boggling mind. basically, have init.d script /etc/init.d/rserve copied on correctly , when used command-line on server works (i.e. sudo service rserve start|stop|status ), service returns correct error codes based on testing using echo $? on different commands. the puppet service statement follows: service { 'rserve': ensure => running, enable => true, require => [file["/etc/init.d/rserve"], package['r-base'], exec['install-r-packages']] } when puppet hits service, runs it's status method, sees isn't running , sets running , presumably starts service, output puppet below: ==> twine: debug: /schedule[weekly]: skipping device resources because running on host ==> twine: debug: /schedule[puppet]: skipping device resources because running on host ==> twine: debug: s

How do I save an inkPicture as an image using VBA for Excel 2013? -

i creating excel 2013 spreadsheet needs capture client , employee signatures. able add inkpicture controls onto vba form , signature action working. want make after 2 people sign inkpictures on form, signatures saved images on worksheet. after that, code lock worksheet. i developing on workstation, used on tablets. can see, inkpicture controls don't display on worksheet on non-mobile versions of os (or maybe it's excel?). employer hasn't gotten me tablet yet, can't tell happens on tablet. that's why i'm looking save signatures in image controls on worksheet. i don't think can use commercial signature packages, can see, these lock entire file, not single worksheets. i have seen quite few articles around web, seem use vb.net or c#.net , haven't been able translate examples vba. again, issue is: how save inkpicture strokes onto image on worksheet? thanks! sorry don't have code show here, did work on in office, i'm posting home (yes, on

c++ - returning bool from member variable pointer -

so i'm working code looks this: class someclass : public somebaseclass { somepointertoclass * p; public: someclass(somepointertoclass* p = null) : p(p) {}; void start(somepointertoclass* sp) { p = sp; } bool hasstarted() { return p; } } i simplified stuff make short code example, think returning bool member variable pointer bit of codesmell. should change or form of c++ convention? hasstarted() fine: in c++, pointer automatically converted bool on zero/not-zero basis. † some people prefer write return (p != nullptr) or return static_cast<bool>(p) instead, in order explicit intent, i'm not terribly fussy in cases this. † however, behaviour implementation-defined in c, not rely on there!

awk - How to filter on column value in bash -

i'm facing problem while trying grep (filter) logfile on value of integer. logfile.log: 2014-11-16 21:22:15 8 10.133.23.9 proxied ... 2014-11-16 21:22:15 1 163.104.40.133 authentication_failed denied ... 2014-11-16 21:22:15 15 163.104.40.134 authentication_failed denied ... 2014-11-16 21:22:16 9 163.104.124.209 proxied ... i have int in column 3 : 8 , 1 , 15 , 9 . i need grep if: value > 10 . something like: cat logfile.log | grep {$2>10} 2014-11-16 21:22:15 15 163.104.40.134 authentication_failed denied ... this should make! $ awk '$3>10' file 2014-11-16 21:22:15 15 163.104.40.134 authentication_failed denied ... with $3 refer 3rd field, $3>10 means: lines having 3rd field bigger 10. if accomplished, condition true , hence awk performs default behaviour: print line. you of course say: print specific field, saying awk '$3>10 {print $1}' file , example.

python - Error when trying to use `assert not mock.method.called` -

i'm trying assert method not called using python mock. unfortunately, can't seem past error: attributeerror: mockcallable instance has no attribute 'called' i'm running python 2.7.1 , python mock 0.1.0 tests. google says: no results found "attributeerror: mockcallable instance has no attribute 'called'". how can resolve error? here's test: import unittest2 import main mock import mock class testcli(unittest2.testcase): def setup(self): self.mockview = mock() self.mockfriendmanager = mock() self.mockedcli = main.cli(self.mockview, self.mockfriendmanager) [...] def testclidoesntgetfriendpropertieswhennotselected(self): view = mock( { "requestresponse":2 } ) friendmanager = mock() cli = main.cli(view, friendmanager) cli.outputmenu() assert not friendmanager.getfriendproperties.called, 'hello' you must update mock library pip . attrib

Ideas for android navigation bar (below action bar) -

i have design app have row of buttons below action bar. each button open different fragment. aware of viewpagers , not want swipe between fragments functionality. know can disable functionality, @ point worth using viewpager? know pretty common design paradigm, how apps handle sort of thing? it seems viewpager provide nice functionality out of box, switching between fragments , not. so, leaning towards using one, hoping provide feedback on approach. thanks! keep buttons in layout of main activity. have them call function lets loadfragment(button button) on click. this function handles switching of fragments, , can change display of navigation buttons inside function highlight appropriate button or equivalent.

ssas - How to calculate average based on distinct counts in MDX -

my ssas cube has following fact , dimensions columns shown below factactivity datekey, userkey, activitykey, activitycount dimdate datekey, date, week, year dimuser userkey, username, gender dimactivity activitykey, activityname i have created distinct count measures of users , dates follows [distinct users] count(nonempty([dimuser].[userkey].[userkey].members, [measures].[activitycount]) [distinct dates] count(nonempty([dimdate].[datekey].[datekey].members, [measures].[activitycount]) both these measures working correctly expected when slice/pivot activityname. now wanted calculate average days per user, created metric follows [avg days per user] avg([dimuser].[userkey].[userkey].members, [measures].[distinct dates]) but giving me wrong results.! tried divide([measures].[distinct days], [measures].[distinct users]) still wrong results...what i'm doing wrong? maybe adding in existing help? avg( existing [dimuser].[userkey].[

Survival analysis using R -

on running survival model using survival package encountered strange error message unable understand. the error message error in surv(time, event) : time , status different lengths the number of observations in each column used in model1 same. > mydata3<-read.csv(file.choose()) > attach(mydata3) > event<-event > time<-time > x<-cbind(wdcl,age,sex) > ch<-coxph(surv(time,event)~x,method="breslow") thanks , regards. you need specify formula correctly, adding arguments. try this: coxph(surv(time, event) ~ wdcl + age + sex, method="breslow", data = mydata3)

jquery - Upload files using Blueimp file upload only if condition is true -

i have requirement need upload multiple files using blueimp file upload. other requirement have submit data set of fields (textboxes) required fields. for example, users pick couple of files upload , give name, type, date, etc , these fields mandatory. should submit both files , form data together. to this, performed validation of form fields inside submit callback of file upload. $('#fileupload).fileupload({ singlefileuploads: false, autoupload: false, acceptfiletypes: /(jpg)|(jpeg)|(png)|(gif)|(pdf)|(doc)|(docx)$/i, submit: { if(formvalid()) { return true; } else { return false; } } }); this works great if users didn't enter mandatory fields first time , shows validation errors. problem if users correct form after cancelled submit , click save, submit not getting fired unless users select file , hit save again.