Posts

Showing posts from June, 2015

symfony - symfony2 translation with transchoice -

i'm translating following key in activity.fr.yml user.list.link: '{1}et %count% autre|]1,inf[voir les %count% autres' using tranchoice <a href="{{ morelink }}" >{% transchoice count "activity" %}user.list.link{% endtranschoice %}</a> and following error an exception has been thrown during rendering of template ("unable choose translation.") i think translation has been found otherwise wouldn't error unable choose translation key itself. also other keys same yaml other tranchoice translated. i followed doc , tried adding with {'%count%': count} no success. does have idea what's wrong here ? in advance the syntax fine value pass %count% couldn't negative neither equal 0 because there no {0} defintion in pluralised string. had test make sure value >= 0 , modified string , fixes it. user.list.link: '{0}|{1}et %count% autre|]1,inf[voir les %count% autres'

calllog - Android showing device Call-Log screen after call gets finished/End -

possible duplicate: how make phone call in android , come activity when call done? i trying make/initiate call using (uri intent) following code in android on nexus-s: intent callintent = new intent(intent.action_call); callintent.setdata(uri.parse("tel:"+phoneno)); startactivity(callintent); on nexus-s after call gets finished showing device call logs screen instead of going activity. is there way device native call logs screen should not appear after call ends, , return activity or other activity show? yesterday made simple app , makes call , after ending call come base activity here code may you makephonecallactivity.java package com.rdc; import android.app.activity; import android.content.context; import android.content.intent; import android.net.uri; import android.os.bundle; import android.telephony.phonestatelistener; import android.telephony.telephonymanager; import android.util.log; import android.view.view; import android.vi...

php - dynamic html select boxes need to update mysql -

ok, 1 little confusing. have select dropdowns produced php. can 4 selects, or 30 select dropdowns. there's option values. here's have far <?php while($row = mysql_fetch_assoc($notes)){ ?> <select name="milestone" id="milestone[<?php echo $row['id']; ?>]"> <option value="enrollment date">enrollment date</option> <option value="discharge date">discharge date</option> <option value="a/c start">a/c start</option> <option value="completion date">completion date</option> </select> <?php } ?> if have 4 select boxes, might have arrays follows: milestone[2134], milestone[2222], milestone[225], , milestone[1022] the array number id of mysql table entry need update value of specific select dropdown. thinking maybe use milestone[][id] , loop through that? any ideas since there might 20 select dropdowns? thanks! do want fetc...

ios - Tabbed application won't show Login view -

i have tab bar application in xcode 4.3 , i'm trying insert login screen before tabbar shown. app works ok if presentmodalviewcontroller has animated:yes but if without animation view not showing. @synthesize window = _window; @synthesize tabbarcontroller = _tabbarcontroller; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; // override point customization after application launch. uiviewcontroller *viewcontroller1 = [[firstviewcontroller alloc] initwithnibname:@"firstviewcontroller" bundle:nil]; uiviewcontroller *viewcontroller2 = [[secondviewcontroller alloc] initwithnibname:@"secondviewcontroller" bundle:nil]; self.tabbarcontroller = [[uitabbarcontroller alloc] init]; self.tabbarcontroller.viewcontrollers = [nsarray arraywithobjects:viewcontroller1, viewcontroller2, nil]; self.window....

css3 - Make CSS transition-duration work both ways? -

i realise css transitions apply class that's been added, not removed. i'm wondering if there elegant solution problem. have set of boxes, when hovered, transition circle. when button pressed, grow/shrink. i'd them grow , shrink slowly, turn circle/square quickly. at moment, grow , shrink slowly, turn circle quickly, but turn square again. of course because css transition duration boxes set slow speed, , when circle class removed, revert original speed. have come working solution (not included here) uses settimeout add "quick speed" class moment , take away. solve issue feels ugly me. have guys ever come across issue , thought of better way? or beyond scope of css transitions? css: .box { background: red; width: 100px; height: 100px; margin: 10px; -webkit-transition: 2s; } .big { width: 300px; } .circle { background: blue; border-radius: 50px; -webkit-transition-duration: .5s; } jquery: $('.box').o...

ajax - Instant Transfer file between 2 browser clients via TCP -

is possible create website makes possible scenario: user logs website, uploads file making direct tcp connection user b within same site @ same time downloading file. without passing file trough server. how make user b listen through browser? would violate "same origin policy"? point use browser , no other software p2p clients. is crazy idea possible? i doubt webrtc covers need. you have 2 issues: b, if running web browser, cannot open port receive inbound connection even if b able that, have face nat traversal issues. the solution use/implement relay server: a opens outbound http/websocket connection relay server b opens outbound http/websocket connection relay server a sends data relay server on outbound channel (http post instance) b reads data relay server on response (to http instance) easier said done.... (and yes feature of advanced p2p networks jxta, xmpp, skype..., , yes unfortunately need intermediate server) check ice spe...

Trying to import list from Sharepoint to Excel -

i trying import sharepoint list excel 2010 worksheet. code below worked in 2003 not work in excel 2010. set tempsheet = thisworkbook.sheets.add tempsheet.name = ("temp") set tempsheet2 = sheets("temp") tempsheet2.activate ------ code below issue ---------------- dim src(2) variant src(0) = "https://collaborate.statestr.com/sites/casg/exceptions/_vti_bin/" src(1) = "{72b6638e-0e7b-4b37-a6a5-3142033e4e02}" src(2) = "{163702d0-a380-467f-b883-1195f4f40616}" tempsheet2.listobjects.add xlsrcexternal, src, true, xlyes, tempsheet2.range("a2") i run time error message 1004. initialization of data source failed. i haven't run myself, officewriter has sharepoint plugin exports data lists excel workbooks. see http://www.officewriter.com/sharepoint . disclaimer: didn't work on plugin, did work on last version of officewriter.

iphone - MPMoviePlayerController slow forward and backward motion -

possible duplicate: play/forward video in 2x 3x 4x speed - iphone sdk i working on video based application. i'm using mpmovieplayercontroller play video had recorded in app. question have play video in slow forward , backward motion in mpmovieplayercontroller ? -(ibaction) playslow:(uibutton *)sender{ if (framerate > 1) framerate -= 0.5; else framerate -= 0.25; if (framerate < 0) { framerate=0; } queueplayer.rate = framerate; } -(ibaction) playfast:(uibutton *)sender{ if (framerate < 1) framerate += 0.25; else framerate += 0.50; if(framerate > 4) framerate = 4; queueplayer.rate = framerate; }

operating system - How to get whether OS is 32 bit or 64 bit by UNIX command? -

how know bits of operating system? in advance. in linux, answer such generic question using uname -m or even: getconf long_bit in c can use uname(2) system call. in windows can use: systeminfo | find /i "system type" or examine environment: set | find "programfiles(x86)" (or getenv() in c)

sql - combining 2 tables in mysql -

here looking have doubts if possible or not! i have 2 tables, 1 called users , other answers . need combine results single statement, , order table time . tricky part have time on both tables , need take both time fields account ordering results. this unsuccessful attempt come query: select * ( select id, username, first_name, last_name, time users union select id, answer, pid, uid, time answers ) ab order `ab.time` update i have come following sql query: select username user, '' page , '' content , time users union select (select username users `id`=`uid`) user, pid page, answer content, time answers order `time` desc its looking reason user field in second select query showing null ! idea why? select id, username, first_name, last_name, time users union select id, answer, pid, uid, time answers order 'time` solution have different column name each table select id t1_id, username t1_username, f...

php - Solr sort by function - Unexpected results -

we're trying query solr , sort results based on complex function involves several nested sum(...product(...div(...))) function complex. debug things, ran sql equivalent of sort parameter calculation above , tried match them on same entities returned in same order solr above. didn't see matches. more reliable sql queries returned skewed results. scores jumbled , in no particular order. leads think solr unable sort things here or we're doing wrong. something fishy: fl=*,score yeilds same score values documents returned. factor still being sorted on? can please help? fl=*,score working expected. giving different scores different documents. version of solr using. have tested on 3.6

java - Custom Android Utility Class -

i wondering if can point out android utility class containing static methods various, commonly used android and/or java functions (ex. checking network availability)? not required can found few here ....... https://github.com/kaeppler/droid-fu/tree/master/src/main/java/com/github/droidfu/support http://droid4me.googlecode.com/svn/trunk/droid4me/src/com/smartnsoft/droid4me/ android helper/utility class library you utility writetofile, isnullorempty , other animationutils apputils layoututils ...... http://developerlife.com/tutorials/?page_id=217

Matlab dialog box -

Image
please me: i want user enter file name containing numbers or/and letters (without space). so have 2 problems: 1) tried next code, dialog box opened , opened , opened.... because don't know how edit 'answer' input without call 'inputdlg' again. 2) checking validity of file name: used 'isempty' , 'strfind' functions, know there easier option this. in code, have check each letter in other case: while isempty(strfind(answer,'=')) == 0 || isempty(strfind(answer,'*')) == 0 || ... maybe 'regexp' function, don't know how :/ so code is: prompt={'enter file name:'}; name='input file name'; numlines=1; answer=inputdlg(prompt,name,numlines); while isempty(strfind(answer,'=')) == 0 answer=inputdlg(prompt,name,numlines); end as @bdecaf suggested in comments, use uiputfile function display "save as" type of dialog: [fname,pname] = uiputfile({'*.xlsx' '...

tkinter - Positioning widget buttons and Entry boxes better in Python -

ok, i'm using tkinter module python, , want have 5 entry boxes, each of variable combines single variable, , used serial key automatic installer office (among other software, install script medium-sized office). none of relevant, except give idea of content. i attempting put of entry boxes in small space, preferably 1 or 2 columns (i using 4-6 columns, can check). is possible tkinter? here's code far part of script: label(app, text="office serial key").grid(row=3, column=0) entries = ["e1", "e2", "e3", "e4", "e5"] colnum = 1 item in entries: item = entry(app, width=10) item.grid(row=3, column=colnum) colnum = colnum + 1 i want more professional/like microsoft install. you can lot layout way want it. think way accomplish put label + entry s frame , when grid frame , use columnspan keyword set how wide should respect other widgets in " app ". ( http://effbot.org/tkinterb...

java - GXT Editor Grid not showing any rows -

i have gxt layout container editor grid. data shown in grid fetched via gwt-rpc service , added grid's store. problem grid never shows checked using ide's debugger list not empty (it contains 1 element). here snippets: the dto: public class competitionwinnerdto extends basemodeldata implements isserializable { public static enum status implements isserializable { pending, approved, paid } public static class property implements isserializable { public static final string competition_id = "competitionid"; public static final string competition_winner_id = "competitionwinnerid"; public static final string confirm_date = "confirmdate"; public static final string site_name = "sitename"; public static final string prize_name = "prizename"; public static final string prize_value = "prizevalue"; public static final string paid_date = ...

wpf - LinearGradientBrush with gradientstops outside of the line -

i'm trying draw waveform ones used on soundcloud.com in wpf application i'm doing drawing multiple vertical lines what want lines have same color transition (so horizontally pixels have same color) because not lines have same length each line has different color @ end of line. the lineargradientbrush has lot of constructors, , 1 suited needs seems lineargradientbrush(gradientstopcollection, point, point). msdn article on lineargradientcontstructor with these points seem able set gradientstops outside of drawn line the problem have don't know how use points. var r = new gradientstopcollection(); r.add(new gradientstop(colors.black, 0)); r.add(new gradientstop(colors.red, 0.5)); r.add(new gradientstop(colors.black, 1)); //this main gradient background lines (100%) (int = 0; < 25; i++) { var line = new line { x1 = i, x2 = i, y1 = 0, y2 = 200, stroke = new lineargradientbrush(r), strokethickness = 1 }; waveformcanvas.children.add(line); } //this actual ...

objective c - Weak NSString variable is not nil after setting the only strong reference to nil -

i have problem code : __strong nsstring *yourstring = @"your string"; __weak nsstring *mystring = yourstring; yourstring = nil; __unsafe_unretained nsstring *theirstring = mystring; nslog(@"%p %@", yourstring, yourstring); nslog(@"%p %@", mystring, mystring); nslog(@"%p %@", theirstring, theirstring); i'm expecting pointers nil @ time, not , don't understand why. first (strong) pointer nil other 2 not. why that? tl; dr: problem string literal never gets released weak pointer still points it. theory strong variables retain value point to. weak variables won't retain value , when value deallocated set pointer nil (to safe). unsafe unretained values (as can read name) won't retain value , if gets deallocated nothing it, potentially pointing bad piece of memory literals , constants when create string using @"literal string" becomes string literal never change. if use same string in ma...

Using VBA to Select and Highlight Excel Rows -

how can tell excel highlight rows row number. instance, let's wanted row 6, 10, 150, 201 highlighted. thanks. here 1 based on mote's .entirerow.interior.colorindex this 1 doesn't restrict enter row numbers gives user flexibility choose rows @ runtime. option explicit sub sample() dim ret range on error resume next set ret = application.inputbox("please select rows color", "color rows", type:=8) on error goto 0 if not ret nothing ret.entirerow.interior.colorindex = 6 end sub followup is there way write macro read row numbers list , highlight rows? yes there way. let's list in cell a1 a10 can use code option explicit sub sample() dim long, sh worksheet on error goto whoa application.screenupdating = false '~~> set sheet rows need colored set sh = sheets("sheet2") '~~> change sheet1 sheet has list sheets("sheet1") = 1 10 ...

machine learning - Mahout: RowSimilarity vs Clustering -

i trying cluster documents using kmeansclustering approach , created clusters. saved cluster id corresponding particular document recommendations. whenever wanted recommend documents similar particular document, query documents in particular cluster , return n random documents cluster. however, returning random document cluster did not seem appropriate , read somewhere should returning documents nearest document in question. so started searching calculating distance between documents , stumbled upon rowsimilarity approach returns 10 similar documents each document, ordered distance. approach relies on similarity metric loglikelihood etc calculate distance between documents. now question this. how clustering better/worse rowsimilarity given both approaches use similarity distance metric calculate distance between documents? what i'm trying achieve i'm trying cluster products on basis of titles , other text properties recommend similar products. appreciated. ...

jasper reports - JasperReports: Subreport properties "Print In First Whole Band" -

Image
first sorry english - it's not native me. i've create report subreport. subreport print records, each textfield surrounded border (it should table). , when textfield 's height large - breaks , continue print text on next page - , thats ok, other textfield elements in row left on previous page - , borders don't show on new page. cause report alone textfield in row (first row on new page). see attach: red line - text carry on new page. green markers - text fields left @ prev page. i've tried use print in first whole band property avoid row breaking, subreport don't react on it. jasperreports issue. please advice how can make report looks fine, without empty spaces instead of borders when starting new page ?

Python 2.7 64 bit and PyOpenGL-3.0.1.win32 installation -

i'm new python. have installed python 2.7 64 bit on win7 64 bit machine. want install pyopengl there win32 version available. when i'm trying install pyopengl says "no python installation found in registry" how proceed form here now? try pyopengl-3.0.1.win-amd64-py2.7.‌exe http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopengl

javascript - saveas dialogue in Servlet -

i found many of answers in these forums useful me request check issue of mine. i'm trying save .csv file servlet called jquery method. though i'm setting header , content-diposition . i'm not getting dialogue box in browser after stream writing data. function popup(data) { $.post("cisco-fetch-devices", { orderid : data}, function(data) { alert("data loaded: " + data); }); }); } the above jquery code calling below servlet post method: public void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("text/csv"); response.setheader ("content-disposition", "attachment;filename=\"tableincsv.csv\""); java.io.printwriter out = response.getwriter(); out.print("test data"); } after data sent browser, dialogue box not displayed. data set in servlet out.print displayed corr...

c++ - How do I use the wmain() entry point in Code::Blocks? -

i did fresh install of code::blocks (i installed the 1 windows 7 comes gcc compiler (codeblocks-10.05mingw-setup.exe)). tried compile simple code: int wmain(int argc, wchar_t* argv[]) { return 0; } i got error message: c:\development\ide\codeblocks\mingw\bin..\lib\gcc\mingw32\4.4.1......\libmingw32.a(main.o):main.c|| undefined reference `winmain@16'| ||=== build finished: 1 errors, 0 warnings ===| when try run code main() entry, runs expected without errors or warnings. how can use wmain() in code? modifications have do? mingw not support unicode. there wrapper available if feel trying out. https://github.com/coderforlife/mingw-unicode-main

Can't compile Android/Java project using command line -

i'm new using other eclipse compiling java projects. trying use command line compile java file uses android have been unsuccessful. i've been trying variations of following (where root directory project directory): javac -classpath c:\program_files\java\jdk1.7.0_04\bin; c:\program_files\android\android-sdk\platforms\android-15\android.jar src\package1\package2\projectname.java it hasn't been working. lot of errors saying: package android.content not exist package android.database not exist package android.net not exist package android.os not exist package android.util not exist am doing drastically wrong here? how can recognize android packages? point me in right direction here? i've read bunch of documentation on javac, command-line , classpaths, can't seem pinpoint main problem here. thank you. new i'm not sure if information make difference... when run program in eclipse, uses android 2.2 directory...

javascript - Backbone Router + RewriteRule not triggering route with a "/" -

i convert links example.com/action example.com/index.html#action parsed backbone router. however, new page, signup/:inviteauthhash (eg. signup/9d519a2005b3dac8802d8e9e416239a1 ) not working; thing renders index.html , , none of breakpoints in router met. .htaccess: # not file or directory rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # example.com/home => example.com/index.html#home rewriterule ^(.+)$ index.html#$1 [l,qsa] router.js var approuter = backbone.router.extend( { routes : { /* pages */ // beta 'request_invite' : 'request_invite', 'signup/:inviteauthhash' : 'signup', // default '*actions' : 'defaultaction' }, /* pages */ // eta request_invite : function() { new betalayout; new requestinviteview; }, signup : function(inviteauthhash) { // validate auth hash if(!inviterequest.is...

How to make SQL server return last rows first in select not using order by -

i have table 350 000 rows. when search top 50 50 oldest rows. there way make sql server start bottom last 50 rows bin inserted? we have performance issue cant use syntax loop through records. if add order id takes 14 sec instead of 1 sec. use dynamic sql solve search functionality dynamic table structure. alter procedure [cs.core].[spdynamicsearchinsurancedemocar] @chassisnumber nvarchar(50) = null, @firstowner bit = null, @groupid int = null, @insurancenumber int = null, @insuredid int = null, @model nvarchar(50) = null, @owneryearofbirth int = null, @registrationnumber nvarchar(12) = null, @stakeholderid int = null, @statusid int = null, @userid int, @languageid int set nocount on; begin declare @sql nvarchar(max),@paramlist nvarchar(4000) select @sql ='select top 50 insurance.insuranceid, isnull(productcaption.captiontext, [cs.core].entity.name) product_462, stakeholder.refstakeholdername stakeholder_1093, insurance.validfrom validfrom_925, in...

App widget on Android default Lockscreen? -

Image
i want know whether possible add widget our android lock screen. selecting widget options in menu in home screen, add our own or default widgets home screen. possible add following widgets our lock screen. possible....? have gone through many sites regarding lock screens, didn't got correct information. gave information related customized lock screens. as per image, main thing want time & date, can display our own widget. don't want customized or our own created lock screen. can add widgets default lock screen given android...? waiting reply, in advance..... android supports lockscreen widgets in android 4.2+. screenshot in question shows device running old version of android(i'm not sure which), not work on that.

How to write table.column in MySQL with PHP? -

how can write table.column in php? for example giving me error there no such column in table. $acolumns = array( 'a.timestamp'); how write can work in php , mysql? when put code inside mysql acting normally. idea? and when put 1 column $acolumns = array( 'timestamp'); is working normally. edit: what want achieve table.column . maybe syntax not correct. when put code in mysql example: select a.id,b.id a,b this working when same thing in php showed before keep getting error edit2: $acolumns = array( 'a.id','b.id','c.id'); /* indexed column (used fast , accurate table cardinality) */ $sindexcolumn = "id"; /* db table use */ $stable = "a,b,c" ; $swhere="a.id=b.id , c.id=a.id" this example need here go: select a.id a_id, b.id b_id inner join b on (a.id = b.id) the trick here column aliasing , allows avoid naming conflict in resultset.

unix - Data manipulation using a script -

i have data in following format : key1:value1 key2:value2 key3:value3 b c d key1:value4 key2:value5 key3:value6 a1 b1 c1 key1.. and on. number of keys three, , in same order. no lines between values a,b,c,d in original data set. i want output in format value3, b c d value6, a1 b1 c1 . . . any thoughts on script might able use done regular expressions can depends on type of values in general can write match key3: [pattern match value] , graph , successive lines before next key1 can grabbed manually loop , stop until new key line , repeat each section. pseudocode: current_key = "" while !eof: line = next_line() if line has regular expression "key3: value": process value current_key = value else process line regular abcd value , print or whatever there isn't error checking helps going.

api - How to post JSON data using curl over basic http auth? -

i want post data using curl unix command got googling doing below: curl --dump-header - -h "content-type: application/json" -x post --data '{"description": "this prbbly lst post.", "transaction_id": "2011-05-22t00:46:38", "account": "another-post"}' http://127.0.0.1:8000/api/transaction/ but returning following response header below: curl: (6) not resolve host: post; nodename nor servname provided, or not known http/1.0 401 unauthorized date: sat, 09 jun 2012 18:50:37 gmt server: wsgiserver/0.1 python/2.7.1 content-type: text/html; charset=utf-8 what doing wrong you don't need write "post" make curl(1) post - automatically if give --data argument. instead, mistaking "post" url want send to, , failing might imagine. drop word , should good.

design - Educational project for Database systems like PintOS? -

pintos project educational experience me. idea of making set of test cases pass , working live system. are there educational projects database systems? edit: focus create dbms engine i presume need code project (more specifically, dbms?) focused on being educational , easy read? i haven't found overly useful on matter. usually, "free" courses , online resourses provide, example, notes on efficient sql usage, while others focus on development of simple (and quite focused) dbms systems. take, example, db-class there are, more or less, 2 "schools" of educational/academic dbms systems: the first one, , more popular, based on elmasri , navathe's "fundamentals of database systems", considered "bible" of field. these courses promote creation of "stack of components", (from low level high level): disk block , intermediate memory management record , index management query parsing, optimization , utilities v...

java - EditText.setText error -

resolved! problem used this.findviewbyid, use dialog.findviewbyid. tnx , beg pardon! i've strange (for me) problem. try write in edittext string readed cursor, , know that's correct way: edittext mytext; final dialog dialog = new dialog(this); dialog.setcontentview(r.layout.login); dialog.settitle("login"); dialog.setcancelable(true); cursor lista=db.listaparametri(); try { while (lista.movetonext()) { if (lista.getstring(0).equals("username")) { mytext = (edittext) this.findviewbyid(r.id.username); log.d("log", lista.getstring(1)); mytext.settext( lista.getstring(1) ); } } } { lista.close(); } but when try write whit settext() return error: 06-10 09:43:01.829: e/androidruntime(279): fatal exception:...

java - How can I reduce the memory used for perm gen in web-app -

i use tomcat7. web-app contains: hibernate log4j jdom upload jar mysql driver ... the total of lib 30 jar files. hoster says: " a lot of memory allocated program(for perm gen , heap). please reduce amount of memory consumed ". how reduce memory requirements of program? how can reduce perm gen memory? please me. you should attach memory profiler first , see type of memory being used , why. the answers question list bunch of profilers try. heap memory allocate storing objects in java. every time use "new" allocate on heap , memory become garbage collected time after last reference cleared. here typical things might reduce heap usage: switch in-memory parsing api streaming one, perhaps using stax or sax instead of jdom. fix memory leaks or longer-than-necessary object retention cleaning in block object no longer needed. optimize sql queries make them return necessary data app, perhaps adding max row constraint or more restrictive clause...

asp.net - "List.Remove" in C# does not remove item? -

hello how can remove item generic list here code im trying right dont know make mistake;/ users us_end = new users(); foreach (var variable in ((list<users>)application["users_on"])) { if(variable.id == (int)session["current_id"]) { us_end.name = variable.name; us_end.id = variable.id; us_end.data = variable.data; } } list<users> = ((list<users>)application["users_on"]); us.remove(us_end); application["users_on"] = us; you have same object remove, not copy. users us_end; foreach (var variable in ((list<users>)application["users_on"])) { if(variable.id == (int)session["current_id"]) { us_end = (users)variable; break; } } if (us_end != null) { list<users> = ((list<users>)application["users_on"]); us.remove(us_end); application["users_on"] = us; } edit: just clarify address here,...

sencha touch check login before every method -

in sencha touch, need check user login before every action in controller. config "method" not good, because requires action called route. use call action function this.fireevent(). updated: i want call checklogin() before onnewnotecommand(), onsavenotecommand(), ondeletenotecommand(), don't want place checklogin() inside these function because have call checklogin() many other functions. how can it? thank you. ext.define('note.controller.note',{ extend:'note.controller.basecontroller', config:{ refs:{ notelistcontainer:'noteslistcontainer', noteeditor:'noteeditor' }, control:{ noteslistcontainer:{ newnotecommand:'onnewnotecommand', editnotecommand:'oneditnotecommand', onnodelistdisclose:'oneditnotecommand' }, noteeditor:{ savenotecommand:'onsavenotecommand', deletenot...

python - Make reverse diagonals white in heatmap -

Image
i'm trying seen on image given below, just setting reverse diagonals white color left. couldn't set them white. chart takes integer values , don't know integer value corresponding of white color. thank! edited: here code; import math matplotlib import pyplot plt matplotlib import cm cm import pylab import numpy np matplotlib.collections import linecollection class heatmap: def __init__(self, selectedlines): self.selectedlines = selectedlines def getheapmap(self): figure = plt.figure() if len(self.selectedlines) != 0: self.map = self.createtestmapdata(len(self.selectedlines), len(self.selectedlines)) maxvalueinmap = self.findmaxvalueinmap(self.map) x = np.arange(maxvalueinmap + 1) ys = [x + in x] ax = figure.add_subplot(111) ax.imshow(self.map, cmap=cm.jet, interpolation='nearest') ''' left s...

vtd xml - vtd-xml: Autopilot: declareVariableExpr -

java vtd-xml has following api class autopilot{ declarevariableexpr(java.lang.string varname, java.lang.string varexpr); } register binding between variableexpr name , variableexpr expression i have used simple variable bindings like: abc => "some value" and autopilot can run expressions like ap.selectxpath("concat(/a/b/text(), $abc)"); ap.evalxpathtostring() my question is: the api says binds variable variable expression. how bind variable expression? , usage of binding 'expression'? try this. ap.declarevariableexpr("my_expr","/a/b/c");

java - How to unit test a class which extends/inherits a 3rd party class -

i have created new class extends 3rd party abstract class. new class calls methods in abstract class. problem have when trying write unit test, i'm not sure how write test not know exact details 3rd party class requires. the abstractdecoratormapper below sitemesh specific class have extend sitemesh work correctly. far can tell documentation can't use composition. public final class partnerdecoratormapper extends abstractdecoratormapper { @override public void init(config config, properties properties, decoratormapper parent) throws instantiationexception { super.init(config, properties, parent); } @override public decorator getdecorator(httpservletrequest request, page page) { if (super.getdecorator(request, page).getname().equalsignorecase("default")) { return getnameddecorator(request, "externalpartnerdefault"); } return super.getdecorator(request, page); } } i use jmock if the...

QTP,VBScript, Public Function -

i want know difference between "public function" , "function" if can , , highly appreciated.. thanks in addition answer of ekkehard.horner, in qtp possible load qtp function libraries (qfl) .qfl or .vbs files. a function , const or variable in qfl private, can not used in qfl, module or action, while public 1 can. functions, constants , variables default public: ' public: dim myvariable public myothervariable const pi = 3.1415 function gethello gethello = "hello" end function sub sayhello msgbox gethello end sub ' private: private myprivates private const hello = "hello!" private function gethellotoo gethellotoo = hello end function private sub sayhellotoo msgbox gethellotoo end sub class dog public function bark print "bark! bark! bark!" end function end class yes, classes private in module. have return function make them public available: ' placed in same modul...

javascript - Store positioning data before animating -

i want animate div jquery's animate() , load new content via ajax , animate original position. animate later back, i'm storing left position via data() . that's code far: (function($){ //transition out $.fn.ajaxtransitionout = function() { var origin = this.css('left'); var amount = $(window).width()*-1; return $(this).data('origin',origin).stop().animate({left:amount, opacity:0}, 400); }; })(jquery); second try: (function($){ //transition out $.fn.ajaxtransitionout = function() { var origin = $(this).css('left'); $(this).data('origin',origin) var amount = $(window).width()*-1; return $(this).data('origin',origin).stop().animate({left:amount, opacity:0}, 400); }; })(jquery); problem: storing of old position slow , in data 'origin' value while animating object. (any minus-value) if delay animation right value stored, that's not want. any appreciated. ...

How to merge vectors into a list in R? -

what is: > list("",rep(0,2)) [[1]] [1] "" [[2]] [1] 0 0 but expect this: [[1]] [1] "" [[2]] [1] 0 [[3]] [1] 0 does know how merged result? thanks! you want: c(list(""),rep(0,2))

Batch file Programming Help required -

i writing batch file program gets username , password user , checks them comparing them 2 files, username.dat , password.dat . the username stored in %username% , password in %password% . i'd know is, how check these variables against files username.dat , password.dat? i've tried using this: echo %username% >u.dat echo %password% >p.dat comp u.dat username.dat but value check? mean in c or c++ can check return value, comp ? storing username , password in files seems bad idea me. assuming going way... there no need echo variables temporary files prior doing comparison. there multiple ways comparison more directly. here 1 method. i'm using delayed expansion supports special characters & | etc in password (or username). setlocal enabledelayedexpansion set userpassok=1 findstr /x /c:"!username!" username.dat || set "userpassok=" findstr /x /c:"!password!" password.dat || set "userpassok=" if defined ...

c# - How to give Csharp Webbrowser default Path to download files -

i making web browser in c sharp, want files downloaded user on web browser web sites, web browser saves in 1 default folder (i.e c:\users\abc\downloads) currently when try download file url pops dialogue box asking path, , annoying thing have wants give 1 default path saves file automatically without asking user path. like have default download path mozila firefox , google whenever user download file web browser saves in 1 default folder. how can achieve in .net 4.0 csharp web browser. i'm afraid can't webbrowser control, maybe take @ http://www.mono-project.com/webbrowser first don't use ie, , can more if i'm right regards, corné

Scala regex youtube video id -

i trying extract video id youtube url using following: val youtuberegex = """v=([^&]+)""".r "v=iqj13vfyou8&feature=g-all-lik" match { case youtuberegex(videoid) => videoid case _ => throw new nosuchfielderror("impossible find youtube id") } saddly not work ... ideas ? lot isn't supposed that? val youtuberegex = """v=([^&]+).*""".r // need specify there remainder "v=iqj13vfyou8&feature=g-all-lik" match { case youtuberegex(videoid) => videoid case _ => throw new nosuchfielderror("impossible find youtube id") } so iqj13vfyou8 part without options.

bash - Haskell Noob In Need of Assistance -

this bit long, bear me! i'm having bit of trouble working haskell program, have use part of uni project. reference, it's casper . so, you're supposed execute script, bash script invoke hugs interpreter this: exec $hugsbin/hugs $hugsargs +p"casper> " $files where $files points main.lhs file. after this, need invoke function "compile" path file, in interpreter. i need perform above in scripted manner. need automated because i'm writing program call on casper in background. so compiled .lhs file. want execute "compile" function have no idea how done. try: ./main compile <a path> from command line returns me error file "test" not found. upon investigation, see these lines in main.lhs file: >main :: string -> io() >main = compile "test" >compile :: string -> io() >compile s = catch (compile0 false s) handler [...snipped] the 2nd line solves question. question is, how invo...

jquery - Hover for class in two tables? -

<table border=2> <tr class="here1 yes"> <td>aaa1</td><td>bbb1</td> </tr> <tr class="here2 yes"> <td>aaa2</td><td>bbb2</td> </tr> <tr class="here55 yes"> <td>aaa3</td><td>bbb3</td> </tr> </table> <table border=2> <tr class="here1 yes"> <td>ccc1</td><td>ddd1</td> </tr> <tr class="here2 yes"> <td>ccc2</td><td>ddd2</td> </tr> <tr class="here55 yes"> <td>ccc3</td><td>ddd3</td> </tr> </table> .yes:hover { background-color: red; } live: http://jsfiddle.net/kzzw8/ the above table generated following php: `<tr class="here<? echo $i ?> yes">` i mouseover on tr.her...

django - How can I change user group without delete record -

on website user have 1 group. , user can change group. it's made user.groups.clear() and user.groups.add(new_group) but it's not efficient, because there 2 sql query: delete, insert. how can change group update query? user , group related each other using manytomanyfield . means intersection table exists relating both entities, , if don't specify model map (using through attribute) django creates 1 you. looking @ sources django.contrib.auth.models see that's case. fortunatly, can access intermediary model using through attribute of manager (in case, user.groups.through ). can use regular model. example: >>> alice = user.objects.create_user('alice', 'alice@example.com', 'alicepw') >>> employee = group.objects.create(name='employee') >>> manager = group.objects.create(name='manager') >>> alice.groups.add(employee) >>> alice.groups.all() [<group: employee...

winapi - Starting a windows-application with focus -

i'm writing small windows application in visual c++ without mvc. small, contains 1 textfield, ok-button , cancel-button. the application started background-process when user starts printing. when opening application doesn't focus, isn't visible. for user it's importend application directly in focus, have lease clicks possible use it. i tried many many things application in focus: setwindowpos(hwnd, hwnd_topmost, 0, 0, 0, 0, swp_nomove | swp_nosize); setforegroundwindow(hwnd); showwindow(hwnd, sw_restore); setfocus(hwnd); i repeated calls in timer. of doesn't work. found remarks on msdn: the system restricts processes can set foreground window. process can set foreground window if 1 of following conditions true: the process foreground process. process started foreground process. process received last input event. there no foreground process. foreground process being debugged. foreground not locked (see locksetforegroundwindow). foreground loc...

Non rigid transformation between 2 differents 3D meshes -

i'm looking optimal method match vertices of 2 different meshes. different in density, size , maybe other reasons. the 2 meshes represent human head, anatomical differences can many. the problem minimization. maybe minimization of mean distance or energy. i can find on web few methods registration interest point in 2d images, not in 3d. does have idea non-rigid transformation? i'm working find each dual vertex of vertex of each mesh in other one. thanks lot. i not sure if paper below works different number of points can check following paper global correspondence optimization non-rigid registration of depth scans hao li, robert w. sumner, mark pauly

ios - clang: error: no such file or directory: ASIAuthenticationDialog.m -

i have error: clang: error: no such file or directory: '/users/usuario/desktop/echonest-echoprint-ios-sample-b937c04/classes/asihttp/clang: error: no such file or directory:' i want run " echoprint-ios-sample " project , import asihttp files i don´t know problem :( someone can me? thanks! if u've deleted h or m files, go through project navigation(command + 1) in xcode, there may reference(will in red color) in project navigator. u can delete it. there'll not such error. hope you. else, have @ this link

concatenation - Concatenate Mat in OpenCV -

i have couple of images in mat objects same dimensions i'd create 1 bix cv::mat object hold them all so dimension of new matrix is: widthnew = widthold x number of matrices , height remains unchanged. i found such copy done using: void cvcopy(const cvarr* src, cvarr* dst, const cvarr* mask=null) but then, how mask defined 3 different times 3 matrices?. regards, moataz you use roi define image region of destination image , copy that. see copy cv::mat inside roi of one

javascript - Google Maps directions mvcobject getting a individual step -

i using directionsservice directions via google maps javascript api. issue want individual steps , yet have them part of mvc object when click on them render on map default directionsdisplay.setdirections(response); does. code: var directionsservice = new google.maps.directionsservice(); directionsdisplay.setmap(map); var request = { origin : a, destination : b, travelmode : google.maps.directionstravelmode.driving }; directionsservice.route(request, function(response, status) { if (status == google.maps.directionsstatus.ok) { directionsdisplay.setdirections(response); //instead of setting directions panel want //set 1 panel , yet have link //map above does. }}); the idea must iterate on each leg of route, on each step in leg , render own html represent it. see following code (assumes have map , directionsdisplay , , directionsservice , , request defined): directionsservice...

An alternative to MySQL fulltext search -

i read mysql fulltext search can cause table locking . means people can't insert or update table when it's being searched on. i read there many search servers (lucence , sphinx) can without table locking , faster. requires many configuration , hard implement . is there other way use fulltext or searching without using search service? don't want configure 1 more server other mysql. create table used perform fulltext searches. in code have ensure data , actions (create, update, delete) replicated table. solution handy if data tables running e.g. innodb engine.

android - Selected Item of row in ListView -

hi using listview in application , created separate xml layout of each row of listview . each row contains 2 imageview , 1 one textview . want imageview clicked on row. put tag each imageview in getview function of adapter.... imageview.settag(postion); and in onclick view received......

css - What is a top shadow for text? -

i got requirement text looks this: top shadow: 2px, #000, 75% what mean? text-shadow ? what's 75% mean? it not valid text-shadow . may need such example (with correct syntax): text-shadow: 0 0 2px rgba(0, 0, 0, .75); or text-shadow: 0 2px 2px rgba(0, 0, 0, .75); /* down shadow */ notes: rgba(0, 0, 0, .75) = #000 75% opacity updates: @ xander found technique asked about. in box-shadow css generated content using: body:before { content: ''; position: fixed; top: -1px; left: 0; width: 100%; height: 1px -webkit-box-shadow: 0 2px 2px rgba(0, 0, 0, .75); box-shadow: 0 2px 2px rgba(0, 0, 0, .75); z-index: 100; }

css - Applying margin-bottom to an element -

i tried positioning div element using margin-bottom. reason margin-bottom doesn't appear affect position of element. tried searching answer, though answers had position:absolute , , still couldn't work. however, did manage position using negative margin-top, i'm still curious know causes not work. heres fiddle showing html/css. (what i'm talking image. margin-bottom set 100px.) try put position absolute property in div class "productimage". this, example: .productimage { display: block; float: left; position: absolute; left: 450px; top: 60px; } using i've manipulated image sucessfully. hope can you.

api - How to intercept node.js express request -

in express, have defined routes app.post("/api/v1/client", client.create); app.get("/api/v1/client", client.get); ... i have defined how handle requests inside client controller. there way can pre-processing requests, before handling them in controller? want check if api caller authorized access route, using notion of access levels. advice appreciated. you can need in couple of ways. this place middleware used before hitting router. make sure router added app.use() after. middleware order important. app.use(function(req, res, next) { // put preprocessing here. next(); }); app.use(app.router); you can use route middleware. var somefunction = function(req, res, next) { // put preprocessing here. next(); }; app.post("/api/v1/client", somefunction, client.create); this preprocessing step route. note: make sure app.use() invokes before route definitions. defining route automatically adds app.router middleware chain, may pu...