Posts

Showing posts from March, 2014

Build desktop application with ruby on rails -

how build desktop application via ruby on rails? i know rails scaffold mvc , generate desktop that. check out link : shoe rb it provides various tools can use create desktop apps ruby.

MapReduce on two Collections using MongoDB and C# -

i have 2 collections following details: comments {"_id" : objectid("521588ccb5d44d23aca151a2"), "userid" : "5215862eb5d44d23aca1519d", "comment" : "hello" } {"_id" : objectid("521588ccb5d44d23aca151a3"), "userid" : "5215862eb5d44d23aca1519e", "comment" : "this cool" } "comment" : "hello" } {"_id" : objectid("521588ccb5d44d23aca151a4"), "userid" : "5215862eb5d44d23aca1519e", "comment" : "i mongo" } user { "_id" : objectid("5215862eb5d44d23aca1519d"), "nickname" : "jane"} { "_id" : objectid("5215862eb5d44d23aca1519e"), "nickname" : "jon"} how achieve following using mapreduce (and best task @ hand)? collection ideally large. i.e. hundreds of thousands or millions. { "userid" : ...

windows - Why are there two .NET 4.0 Frameworks showing in IIS Application Pools? -

Image
why there 2 versions of .net framework 4.0 showing in application pool dialog in iis? the server running windows server 2012, iis 8.0 , tfs 2012. it seems strange there v4.0.30319 , .net framework v4.0.30319 . is server running tfs? if yes, 2nd pool created during installation of tfs.

git - gclient sync webrtc for android 'No output for xxx seconds from command' -

i want use webrtc android through native , there problem when command "gclient sync --nohooks". log text 'no output xxx seconds command: git -c core.deltabasecachelimit=2g clone --no-checkout --progress --template=/users/moushou/depot_tools/git-templates https://chromium.googlesource.com/android_tools.git /users/moushou/trunk/third_party/_gclient_android_tools_38zdcb; cwd=/users/moushou'. please me , thank much.

python - access static files as well from uWSGI -

i have application (on openshift) can run python. reach static, eg. html files. when try get: uwsgi error python application not found could please how can make server not interpret files python? uwsgi needs python app serve url. as http://uwsgi-docs.readthedocs.org/en/latest/http.html#can-i-use-uwsgi-s-http-capabilities-in-production said: if want use real webserver should take account serving static files in uwsgi instances possible, not using dedicated full-featured web server. in normal case, clients send http requests nginx or other web server, handles static files' responses , leaves rest uwsgi. you might better ask on https://serverfault.com/about

javascript - Clever way to predict width -

i need way predict width of string if added inside element. the font size 16px. original idea 16px every character ended being wrong.. ideas? you can append string body so: function get_width_of_string() { var div = document.createelement('div'); div.style.position = "absolute"; div.style.marginleft = "-99999px"; div.style.display = "inline-block"; div.innerhtml = "this string"; document.body.appendchild(div); var width = div.offsetwidth; document.body.removechild(div); return width; } this should return width of string

android - Does calling invalidateViews() on Listview re-inflates the view for rows? -

i have been using using listview since long experienced of random behaviour. when call invalidateviews() on listviews, in cases re-inflates views each row , in cases doesn't. random. can tell me how works? ideally should refresh data inside views(rows) , not inflate them again. thanks calling invalidateviews() on listview should not re-inflates listview item views. way force listview re-inflates item views, meaning recycled views cleared, resetting listview adapter ( had dig in source code discover ). if take @ invalidateviews() method implementation (source code in abslistview.java), see (android api 16) : /** * causes views rebuilt , redrawn. */ public void invalidateviews() { mdatachanged = true; remembersyncstate(); requestlayout(); invalidate(); } the method remembersyncstate() implemented in adapterview.java stores listview's position of selected item (if any), can check out. the requestlayout() method takes care of measuring...

Form submit error when using CKEditor plugin for web2py -

i using ckeditor plugin web2py. problem have on form, when clicks dropdown value, form submitted using javascript, id in request.vars used generate new form values(form.vars.body), works fine until code reaches form.accepts(req..., sess..). reason widget value(form.vars.body) changed original value before submit(other form.vars fields change , work fine). question form.accepts(req.., ses..) change or call in widget code again revert particular field original value. query1 = db.contents.event_instance_id==event_instance_id query2 = db.contents.section==section_id contents = db(query1 & query2).select(db.contents.id, db.contents.title,db.contents.body).first() record=contents.id fields = ['id','section', 'title', 'body'] # form # returns correct form.xml right content db.contents.body form = sqlform(db.contents, record, fields=fields, submit_button=t('save content')) if form.accepts(request.vars, session): response.flash = t(...

Validate input type="file" field using javascript -

i have form in user first select if want upload file. if yes 3 upload box displayed them. on click of submit there javascript function checks empty fields. in function, if option upload file selected, checking if input type="file" empty. the error facing after user select file upload, error message upload file still displayed. here html code: <!-- 3rd fieldset starts --> <fieldset class="fieldsetspace"> <legend class="legendtext">&nbsp; upload documents &nbsp;</legend> <span id="yes"><input type="radio" name="rdouploaddocu" id="rdouploaddocuyes" tabindex="23" value="yes" onclick="javascript: showuploaddiv();" /></span> &nbsp;yes have documents upload <div id="divuploaddoc" style="display:none;"> <span class="contact_table">upload document 1 </span> ...

c# 4.0 - Radio button in WPF Application selected but not visible -

i have radio button in wpf application works in windows 7. however in xp machines, radio button selection not visible clicked event fired. why happen? repaint issue or computer settings issue? update problem comes in computer uses windows classic theme you can check template used radio button. make sure brushes/colors used in windows 7 available in xp. these links should provide more help http://msdn.microsoft.com/en-us/library/ms751600.aspx http://msdn.microsoft.com/en-us/library/windows/apps/jj709925.aspx check "checked state"

python - How to assign a 1D numpy array to 2D numpy array? -

consider following simple example: x = numpy.zeros([10, 4]) # 2d array x = numpy.arange(0,10) # 1d array x[:,0] = x # works x[:,0:1] = x # returns error: # valueerror: not broadcast input array shape (10) shape (10,1) x[:,0:1] = (x.reshape(-1, 1)) # works can explain why numpy has vectors of shape (n,) rather (n,1) ? best way casting 1d array 2d array? why need this? because have code inserts result x 2d array x , size of x changes time time have x[:, idx1:idx2] = x works if x 2d not if x 1d. do need able handle both 1d , 2d inputs same function? if know input going 1d, use x[:, i] = x if know input going 2d, use x[:, start:end] = x if don't know input dimensions, recommend switching between 1 line or other if , though there might indexing trick i'm not aware of handle both identically. your x has shape (n,) rather shape (n, 1) (or (1, n) ) because numpy isn't built matrix math. ndarrays n-dimensional; support efficient, consis...

Android: Free Croping of Image -

Image
i want free style of croping on image... image can gallery or can camera... is there solution regarding this? load image gallery or camera on view (using canvas draw image) public class someview extends view implements ontouchlistener { private paint paint; public static list<point> points; int dist = 2; boolean flgpathdraw = true; point mfirstpoint = null; boolean bfirstpoint = false; point mlastpoint = null; bitmap bitmap = bitmapfactory.decoderesource(getresources(), r.drawable.gallery_12); context mcontext; public someview(context c) { super(c); mcontext = c; setfocusable(true); setfocusableintouchmode(true); paint = new paint(paint.anti_alias_flag); paint.setstyle(paint.style.stroke); paint.setpatheffect(new dashpatheffect(new float[] { 10, 20 }, 0)); paint.setstrokewidth(5); paint.setcolor(color.white); this.setonto...

asp.net - Check box inside repeater , How to get command name value in the check changed function -

hi have above html tag in asp.net listview item template , <td> <asp:checkbox runat="server" id="chkstudentstatus" text='<%# getstatusstring(eval("studentstatus").tostring()) %>' commandname='<%#eval("studentid")%>' oncheckedchanged="chkstudentstatus_checkedchanged" checked='<%#eval("studentstatus") %>' autopostback="true" /> </td> while check box value changed command name value in " chkstudentstatus_checkedchanged " function try this: short , simple refrence your check box <td> <asp:checkbox runat="server" id="chkstudentstatus" text='<%# getstatusstring(eval("studentstatus").tostring()) %>' commandname='<%#eval("studentid")%>' oncheckedchanged="chkstudentstatus_checkedchanged" checked='<%#eval("studentstatus") %...

Oracle SQL - error when using GROUP BY -

select i.sicil_no, m.adi, m.soyadi, i.net_tutar, i.odeme_tarihi ibrmt050 i, mismt301 m (i.sicil_no=m.sicil_no , odeme_turu='36' , odeme_tarihi between '01/01/2012' , '30/06/2012') group to_char(i.odeme_tarihi,'mm') , to_char(i.odeme_tarihi,'yyyy') order to_char(i.odeme_tarihi,'yyyy') , to_char(i.odeme_tarihi,'mm'); i want list per month query gives error. "not group expression" what supposed ? according documentation: http://docs.oracle.com/cd/b28359_01/server.111/b28286/statements_10002.htm restrictions on select list select list subject following restrictions: if specify group_by_clause in statement, select list can contain following types of expressions: constants aggregate functions , functions user, uid, , sysdate expressions identical in group_by_clause. if group_by_clause in subq...

c++ - Why is dynamic_cast evil or not ? Should I use dynamic_cast in this case? -

some the use of dynamic_cast means bad design , dynamic_cast can replaced virtual functions why use of dynamic_cast considered bad design? suppose have function name func(animal* animal, int animaltype) , implementation in func like: bool func(animal* animal, int animaltype) { ... /* animal base class of bear, panda, fish .... dynamic_cast animal real animals(bear, panda, fish...) according animaltype. processing specific type of animal, using additional information beyond base class animal. */ } is case proper use of dynamic_cast ? this wrong place use dynamic_cast . should using polymorphism. each of animal classes should have virtual function, say, process , here should call animal->process() . class animal{ virtual void process() = 0; } class cat:public animal{ void process() {cout<<" tiny cat";} } class bear :public animal{ void process(){cout<<"i big bear"; } void func(animal* animal){ ...

openoffice.org - Create openoffice .odt document with Python -

how can create open office .odt file python? i'm looking @ http://wiki.openoffice.org/wiki/python , confused. i've got python 2.7 go here? above link talks open office shipping python. have got it?? , need openoffice? isn't there template, way document needs will recognized odt? need actual editor? i'd https://github.com/mikemaccana/python-docx , open office. sorry open ended question, have looked around , feel missing vital link/understanding required. i use relatorio able produce odt. can have at here

c# - Spreadsheet gear Chart's x axis date is appearing as whole number -

i generating output using spreadsheet gear contains chart output , xaxis has date , y axis has numbers plot chart. @ end, application copies source workbook sheets new workbook's spreadsheet. while doing this, date values in chart's xaxis not appearing date (mm/dd/yy) in sheet have copied (i.e. in new workbook's sheet), instead, getting number (such 39174, 39175, 39176. julian date?). though formatting date column date format (mm/dd/yy), still not referred date in graph. have cross checked right clicking on cell (in date column) , choosing 'format cells' option. showing has used custom formatting (as mm/dd/yy) it. also, have coded update links while copying new sheet, still not working. please advise resolve issue. thanks you can either set format of chart labels using iticklabels interface or set property of axis linked source , set format of range data source: here example of how set chart formatting here detail of properties of iticklabels ...

scala - Find out play! version number (e.g. 2.1.3) in application code -

does know how find out version of play! application running during runtime? thought there might perhaps play.api.play.current.frameworkversion . searched api doc @ http://www.playframework.com/documentation/api/2.1.x/scala/index.html#package useful, not find anything. think hack writing sbt plugin version file during compile/stage can read @ runtime. hoping there less cumbersome way of doing this... cheers, alex how about: play.core.playversion.current(); found in: http://www.playframework.com/documentation/api/2.2.0-m2/scala/index.html#play.core.playversion$

How to get/set values in a private struct in c++? -

i'm having little problem setting values in private struct of class. following: //processimage.h class process_image { private: struct imagedata { mat imagematrix; int v_min; int v_max; imagedata(mat img, int vmin=0, int vmax=255): imagematrix(img), v_min(vmin), v_max(vmax) {} }; public: bool set_v_min(int value); }; //processimage.cpp bool process_image::set_v_min(int value) { if(value>0&&value<256) { imagedata.v_min=value; //it not working setting return true; } return false; } where wrong? think should possible set value in struct way don't know i'm missing. please give me hint or direction how right way. you haven't created structure yet, described it. have constant structure inside class write down this: class process_image { private: struct imagedata { mat imagematrix; int v_min...

exception - Why am I getting java.util.ConcurrentModificationException? -

as run following code : import java.util.linkedlist; class tester { public static void main(string args[]) { linkedlist<string> list = new linkedlist<string>(); list.add(new string("suhail")); list.add(new string("gupta")); list.add(new string("ghazal")); list.add(new string("poetry")); list.add(new string("music")); list.add(new string("art")); try { for(string s : list) { list.add(0,"art"); list.remove(6); system.out.println(list); } }catch(exception exc) { exc.printstacktrace(); } } } i exception says : java.util.concurrentmodificationexception @ java.util.linkedlist$listitr.checkforcomodification(unknown source) @ java.util.linkedlist$listitr.next(unknown source) @ tester.main(tester.java:14) why getting excepti...

progress - Issue with custom seek bar in Android -

Image
i having problem custom seek bar not getting same expect, using 2nd image progress drawable , first thumb, when use wrap content small , when use fill parent repeating , seek bar different 2nd image in ui? you should use nine-path graphics. android automatically resize image based on borders provide in graphics.

android - How to add a drop down menu on Actionbar without the preselected item occupying space -

i add on android actionbar drop down menu without preselected option. more precisely arrow next application's icon on actionbar. far code is: protected void oncreate(bundle savedinstancestate) { . . . actionbar actionbar = getactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_list); spinneradapter spinneradapter = arrayadapter.createfromresource(this, r.array.logo_options, android.r.layout.simple_spinner_dropdown_item); actionbar.setlistnavigationcallbacks(spinneradapter, null); } how can rid of text on actionbar? you can create popup menu drops down whenever click on action bar button: view menuitemview = findviewbyid(r.id.apps); popupmenu popupmenu = new popupmenu(this, menuitemview); popupmenu.getmenuinflater().inflate(r.menu.popup, popupmenu.getmenu()); popupmenu.setonmenuitemclicklistener(new onmenuitemclicklistener() { ...

internet explorer - Got security prompt for "yui.yahooapis.com" with security set to High on IE -

i include yui library locally, when have ie security set high got alert saying yui.yahooapis.com not trusted. how can rid of http request , make library totally local? thanks, this design. when have ie security set high, javascript disabled. ie security settings set high - javascript not working

javascript - How to draw a line on a web page using dojo -

i'm new dojo , javascript. trying figure out basics. if have number of <div> objects, there way draw and/or animate line between them? i see dojox/drawing/tools/line can used draw within dojox.drawing.drawing, don't have drawing in want add line. instead, want draw arrow between 2 locations on web page. suspect dynamically creating , adding <div> , turning "line" using dojo, styling it, , positioning correctly. have tried stylesheets? here's fiddle : http://jsfiddle.net/kjjny/ first div <div id="first" style="width: 100%; height: 10px; border-bottom:2px; border-bottom-style:solid"></div> <div>this second div</div> <div id="second" style="width: 100%; height: 10px; border-bottom:2px; border-bottom-style:solid"></div> <div>this third div</div> it's simpliest way define border between 2 divs. regards, miriam

php - How to display foreign key data -

i have 3 table (leave, employee, department) here database employee table: { emp_id (pk), emp_fname, emp_lname, contactno_hp, contactno_home, emp_email, dept_id(fk)} leave table: { leave_id (pk), date_apple, leave_type, leave_start, leave_end, status, emp_id(fk)} department table: { dept_id (pk), dept_name, dept_desp} when click "detail" come out new page. specific <tr> <td><?php echo $row["leave_id"];?></td> <td><?php echo $row["emp_id"];?></td> <td><?php echo $row["date_apply"];?></td> <td><?php echo $row["leave_type"];?></td> <td><?php echo $row["leave_start"];?></td> <td><?php echo $row["leave_end"];?></td> <td><?php echo $row["status"];?></td> <td><a href="app_status.php?id=<?php echo $row[leave_id];?>...

bytearray - how to convert bit array into hex contanning 8bits in java -

i have binary array converted hex using stringbuilder sb = new stringbuilder(); (byte b : bytes) { sb.append(string.format("%02x ", b)); } system.out.println(sb.tostring()); but gives me hex code respective bit. i want hex containing 8bits. please me. you want this- biginteger bint = new biginteger(1, bytes); string hexstring = string.format("%0" + (bytes.length << 1) + "x", bint); for lower case hex digits, can use- string hexstring = string.format("%0" + (bytes.length << 1) + "x", bint);

Bluetooth Connection to Fora D15B from Android -

i working on android app connects fora d15b (2-in-1 blood pressure/glucose monitor). i have tried many combination purpose till none has worked. here tried. bluetoothdevice device = btadapter.getremotedevice(bhmacid); string devicename = device.getname(); log.v("bp", "device : " + devicename); try { method m = device.getclass().getmethod("createrfcommsocket", new class[] { int.class }); socket = (bluetoothsocket) m.invoke(device, integer.valueof(1)); // socket = device.createinsecurerfcommsockettoservicerecord(uuid.fromstring(hs_uuid)); // socket = device.createrfcommsockettoservicerecord(uuid.fromstring(hs_uuid)); socket.connect(); log.v("bp", "connected"); } catch (exception e) { e.printstacktrace(); } i have created socket using 3 different ways both none works given below exception java.io.ioexception: connection refused @ android.bluetooth.bluetoothsocket.connectnative(native method) i have tried androi...

c++ - Porting threads to windows. Critical sections are very slow -

i'm porting code windows , found threading extremely slow. task takes 300 seconds on windows (with 2 xeon e5-2670 8 core 2.6ghz = 16 core) , 3.5 seconds on linux (xeon e5-1607 4 core 3ghz). using vs2012 express. i've got 32 threads calling entercriticalsection(), popping 80 byte job of std::stack, leavecriticalsection , doing work (250k jobs in total). before , after every critical section call print thread id , current time. the wait time single thread's lock ~160ms to pop job off stack takes ~3ms calling leave takes ~3ms the job takes ~1ms (roughly same debug/release, debug takes little longer. i'd love able profile code :p) commenting out job call makes whole process take 2 seconds (still more linux). i've tried both queryperformancecounter , timegettime, both give approx same result. afaik job never makes sync calls, can't explain slowdown unless does. i have no idea why copying stack , calling pop takes long. confusing thing why cal...

Alter table query plan for sql server 2008 -

i trying query plan alter table query in sql server management studio sql server 2008. the alter query like: alter table mytable add my_timestamp datetime not null default(getdate()) when try see 'estimated execution plan' query, shows result : estimated operator cost 0%. when try 'actual execution plan' query, no result shown. how can see query plan query? the plan not available ddl statements, alas. assume want know whether statement scan or update rows, or whether metadata operation. way find out is: read docs test it

access an array stored inside another array excel vba -

i create array inside function (arraya), function (store). function store return array a, , store functions return value in larger array arrayb. after print out each of arraya's elements stored in arrayb element (1). please help, many thanks, code below. dim arra() variant dim arrb() variant redim arrb(1) arrb(1) = store(arra) = 1 ubound(arrb(1) debug.print arrb(1)(i) next function store(a() variant) redim a(1 3, 1 3) a(1,3) = "1" a(1,2)="2" store = end function to print contents of arra you'll have iterate through this: for = 1 ubound(arrb(1)) j = lbound(arrb(1), 2) ubound(arrb(1), 2) debug.print arrb(1)(i, j) next next the 2nd argument of lbound / ubound functions used choose dimension want; in case, want 2nd 1 because outer for going through 1st.

java - Create generic Interface restricted to own class -

i create generic interface 2 classes i'm not sure how specify generics right way. public class thinga implements thing { public thinga createcopy(thinga original); } public class thingb implements thing { public thingb createcopy(thingb original); } i tried this. public interface thing<v extends thing<v>> { public v createcopy(v original); } but i'm still able things this, shouldn't allowed. public class thingb implements thing<thinga> { public thinga createcopy(thinga original); } there no this key-word generics (nor methods parameters , return values declaration) , cannot want. in other words interface permit ensure methods in class use consistent types, not reference class type itself.

idl programming language - How LINFIT in IDL is represented in R? -

i have code written in idl want convert r. within code found function: result = linfit(dum_x, dum_y) y_a= result[0] y_b= result[1] "linfit function" fits paired data { xi , yi } linear model, y = + bx, minimizing chi-square error statistic i wonder if there similar function in r? ideas how can convert line r : y_a= result[0] my guess is result <- lm(dum_y~dum_x) y_a <- coef(result)[1] y_b <- coef(result)[2] but don't have access idl can't check ... give reproducible example idl/linfit results ...

r - Is it a bug in data.table and integer64 I found -

i having lot of difficulties data.table , integer64 (package bit64 )> understanding integer64 cannot yet used in by clause. though might have found bug in " sort ". library(data.table) library(bit64) test4 <- structure(list(idfd = c("360627720722618433", "360627720722618433" ), cdvca = c("2013-03-13t09:36:07.795", "2013-03-13t09:36:07.795" ), numseq = structure(c(1.05397451390436e-309, 1.05397443975625e-309 ), class = "integer64")), .names = c("idfd", "cdvca", "numseq" ), row.names = c(na, -2l), class = "data.frame") str(test4) 'data.frame': 2 obs. of 3 variables: $ idfd : chr "360627720722618433" "360627720722618433" $ cdvca : chr "2013-03-13t09:36:07.795" "2013-03-13t09:36:07.795" $ numseq:class 'integer64' num [1:2] 1.05e-309 1.05e-309 test4 <- as.data.table(test4) str(test4) classes ‘data.table’ ...

java - Create Source Folder Programmatically -

i have tried create 1 source folder in java project below code. iworkspaceroot root = resourcesplugin.getworkspace().getroot(); iproject project = root.getproject(projectname); project.create(null); project.open(null); iprojectdescription description = project.getdescription(); description.setnatureids(new string[] { javacore.nature_id }); project.setdescription(description, null); ijavaproject javaproject = javacore.create(project); ifolder sourcefolder = project.getfolder("src"); sourcefolder.create(false, true, null); ipackagefragmentroot root = javaproject.getpackagefragmentroot(sourcefolder); iclasspathentry[] oldentries = javaproject.getrawclasspath(); iclasspathentry[] newentries = new iclasspathentry[oldentries.length + 1]; system.arraycopy(oldentries, 0, newentries, 0, oldentries.length); newentries[oldentries.length] = javacore.newsourceentry(root.getpath()); javaproject.setrawclasspath(newentri...

iphone - Increasing the font size of a webview conflict with UIScrollView -

i have uiwebview inside uiscrollview. using code increase font size of uiwebview: int fontsize = 150; nsstring *jsstring = [[nsstring alloc] initwithformat:@"document.getelementsbytagname('body')[0].style.webkittextsizeadjust= '%d%%'", fontsize]; [labelnewscontent stringbyevaluatingjavascriptfromstring:jsstring]; nsstring *size = [labelnewcontent stringbyevaluatingjavascriptfromstring:@"return math.max( \ document.body.scrollheight, document.documentelement.scrollheight, \ document.body.offsetheight, document.documentelement.offsetheight, \ document.body.clientheight, document.documentelement.clientheight \ );"]; scrollview.contentsize = cgsizemake(scrollview.contentsize.width, [size floatvalue]); the font increase happens without errors half of text inside uiwebview visible.

Cassandra CQL wildcard search -

i have table structure create table file(id text primary key, fname text, mimetype text, isdir boolean, location text); create index file_location on file (location); and following content in table: insert file (id, fname, mimetype, isdir, location) values('1', 'f1', 'pdf', false, 'c:/test/'); insert file (id, fname, mimetype, isdir, location) values('2', 'f2', 'pdf', false, 'c:/test/'); insert file (id, fname, mimetype, isdir, location) values('3', 'f3', 'pdf', false, 'c:/test/'); insert file (id, fname, mimetype, isdir, location) values('4', 'f4', 'pdf', false, 'c:/test/a/'); i want list out ids matching following criteria: select id file location '%/test/%'; i know not supported in cql, can please suggest approach should take these kind of wildcard search queries. please suggest. datastax enterprise adds full text search...

ruby on rails - RubyTest has no output in Sublime Text 2 -

i have rubytest installed sublime text 2, , when try run tests within sublime, once see log happened, see: traceback (most recent call last): file "./sublime_plugin.py", line 337, in run_ file "./exec.py", line 145, in run oserror: [errno 20] not directory: '/users/myuser/code/ruby/movie_spec.rb' reloading /users/myuser/library/application support/sublime text 2/packages/user/rubytest.last-run package control: no updated packages any ideas? rspec runs fine when use in console. personally, i'd recommend installing zentest , using autotest functionality continually run tests in terminal window. it watches changes in tests , reruns them automatically. it's handy write code , tests.

android - TextViews with dividers in between them -

Image
i trying recrate following layout in android studio: because preety new @ android stuff, first tryed linearlayout, , figured thath wont possible it. trying relativelayout created block color: <relativelayout android:layout_width="fill_parent" android:layout_height="80dp" android:background="@color/red_top"> </relativelayout> now want ask how can divide shown @ image 1 bar @ top , 2 @ bottom in same layout, , how can put same borders? you can using following xml code: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/custom_toast_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width=...

wpf - Passing 'this' from view to viewmodel -

i have button which, when clicked, should open new window modal window. thinking of passing this xaml , in viewmodel, have got parentwindow window.getwindow(parameter) . there equivalent this in xaml? unless in disconnected context can pass window using relativesource binding ancestortype=window .

linux - PHP - ZipArchive is enabled but not found -

Image
when @ phpinfo see zip enabled: extension_loaded('zip') // <- returns true. function_exists('zip_open') // <- returns true. class_exists('ziparchive', false) // <-returns false. when try create ziparchive object, error: fatal error: class 'ziparchive' not found php version 5.4.11 found fix reading mediatemple kb article. had zip.so in /usr/lib64/php/modules/ thing missing extension=zip.so entry in php.ini after adding entry , restarting apache, ziparchive recognized.

javascript - Trying to have a link + checkbox, both clickable and text change on click -

Image
currently i'm using jquery have checkbox , text, text change after checkbox ticked, i'm trying work box or text can clicked , result changed text , checked box? can assist me further? just put label text around checkbox , text, becomes like: <label><input type="checkbox" />add cart</label> this makes text part of checkbox

Highcharts charts don't resize properly on window resize -

i have 2 side-by-side charts on page, , have them resized when window resized: container set 50% width, which, according examples, should enough. a working example of automatically resizing chart can found @ http://jsfiddle.net/2gtpa/ a non-working example did reproduce issue can seen @ http://jsfiddle.net/4rrzw/2/ note : have resize frame several times reproduce issue (smaller>bigger>smaller should do) i think lies in way declare containers... pasting html code js code highcharts doesn't seem relevant here... (same in both examples) <table style="width:100%;"> <tr> <td style="width:50%;"> <div id="container" style="height: 50%"></div> </td> <td style="width:50%;"></td> </tr> </table> i forked fiddle working solution @ http://jsfiddle.net/axynp/ important code snippet there this: $(window).resize(function() { heigh...

navigation - Navigating from a BasicPage to a BasicPage in c# metro application -

hi working on metro app school assignment having problems navigating basicpage basicpage. i keep getting value cannot null error. code in button: this.frame.navigate(typeof(basicpage1), null); . can me? immediate response appreciated if don't want pass navigation argument, use following. this.frame.navigate(typeof(basicpage1));

c++ - gcc error "expected ')' before '[' token" -

i receiving these errors while attempting compile program gcc , i'm not sure whats causing them. functions.h:21: error: expected ')' before '[' token functions.h:22: error: expected ')' before '[' token functions.h:23: error: expected ')' before '[' token functions.h:25: error: expected ')' before '[' token functions.h:26: error: expected ')' before '[' token functions.h:27: error: expected ')' before '[' token my program compiles fine in visual studio 2012. heres header file seems causing errors. struct subject { char year[5]; char session; char code[8]; char credit[3]; char mark[4]; }; struct data { char name[30]; char id[30]; char cc[30]; char course[80]; struct subject subjects[30]; int gpa; }; void displayrecord(data [], int); int namesearch(data [], char [], int [], int); void editrecord(data [], int, int); char getchar(con...

css3 - How to fix the css red notification bubble -

Image
i have html follows created using twitter bootstrap. <div class="row-fluid" style="padding-top:10px;"> <div class="noti_bubble"><@= friendrequestcollection.size() @></div> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="icon-eye-open icon-white"></i> <span class="caret"></span> </a> <ul class="dropdown-menu"> <@ friendrequestcollection.each(function(user) { @> <li id="user-list-<@= user.get('username') @>"><a href="#"><@= user.get('firstname') @></a></li> <@ }); @> </ul> </div> i trying create red notification bubble on eye icon not looking good. my css notification bubble. .noti_container { position: relative; /* show container ends */...

shopping cart - Cassandra row level locking support while accessing same row by concurrent users -

we in design phase of our shopping cart application considering cassandra inventory database. multiple users need able access same product row in inventory db @ same time. for example product table containing: productid =1000, productquantitiy = 1 productid =2000, productquantitiy = 5 if first user selects product 1000 , add product quantity 1 in shopping cart, other users should not able select product until gets discarded first user (who updates product quantity 0). alternatively if first user selects 3 of product 2000, other users accessing same product should not able select same amount of product until discarded first user (who updates product quantity 2). does cassandra provide row level locking support kind of scenario ? cassandra not have built in support locking yet . astyanax api provides recipes implementations common use cases, 1 of which, distributed row lock , such locking.

css - Table Layout - Bootstrap Progress Bar -

Image
i trying following effect: essentially have done make div with display: table; and populated divs containing font awesome icons with display: table-cell; js fiddle: http://jsfiddle.net/abehnaz/wchbc/1/ my problem right can't figure out how line go center of 1 table-cell center of other table cell. can point me in right direction? edit: here how got looking for: http://jsfiddle.net/abehnaz/wchbc/8/ . pretty wordy solution, job. thing left me try figure out how gap in between top line , bottom line. thoughts? check solution: http://jsfiddle.net/wchbc/5/ basically created new div line , restored structure simple div layout: .line{ width:100%; position:relative; top:25px; left:0px; height:10px; background:#00f; z-index:-1; } if don't want symbols transparent background, add background color: .icon-star, .icon-rss{ background:#fff; }

qt - Setting input to QWebElement -

i have html page <input type=file> i'm using qtwebkit , i'm able qwebelement of input type. how set value specific string (file path) can submit form? a naive thing set value attribute of input element. element->setattribute("value", "path"); this not work, though, since you're not allowed set attribute unless you're "the browser". probably way go use mozsetfilenamearray , so: const qstring filepath = "/foo/bar/baz"; // or "c:\foo\bar\baz" const qstring js = qstring( "var filearray = {'%1'};" "this.mozsetfilenamearray(filearray, filearray.length);" ).arg(filepath); element->evaluatejavascript(js);

What is this boolean operation? -

a , b - bool-variables. ? - unknown operation find operation in expression a ? b following results: 0 ? 0 = 1 0 ? 1 = 0 1 ? 0 = 0 1 ? 1 = 1 that looks truth table xnor, aka logical equality. see https://en.wikipedia.org/wiki/truth_table#logical_equality .

object - Python dict entries not being referenced properly -

i'm trying create new objects on screen new data way: spawnedobjectdict = dict() while true: # main loop if mouseclicked == true: rectanglename = "rectangle" + str((len(spawnedobjectdict))) spawnedobjectdict[rectanglename] = spawnedrectangle spawnedobjectdict[rectanglename].positionx = mousex spawnedobjectdict[rectanglename].positiony = mousey this should creating new objects , assigning them coordinates equal mouse. however, keeps assigning of them new mouse coordinates, stack on top of each other. @ first assumed drawing one, or 1 object in dict reason, added make sure: def drawrectcoords(rectname, thedict, x, y, size_x, size_y): in iter(thedict): basicfont = pygame.font.font('freesansbold.ttf', 20) textsurf = basicfont.render(str(thedict['rectangle0'].positionx) + ", " + \ str(thedict['rectangle0'].positiony), true, (255, 255, 255), (0, 0,...

Android ListView onClickListener Custom Adapter -

i read posts custom adapters , how index them seems cannot make mine work. overwrite getview , xml contains 1 textview , 2 buttons. made both buttons detected onclicklistener couldnt differentiate listview element 1 triggered clickevent. tried different approach nullpointerexception in onclick method. @override public view getview(int position, view convertview, viewgroup parent){ viewholder holder; if(convertview == null){ layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); convertview = inflater.inflate(r.layout.listexample, null); holder = new viewholder(); holder.textview = (textview) convertview.findviewbyid(r.id.commandline_text); holder.start = (button) convertview.findviewbyid(r.id.test_start_button); holder.stop = (button) convertview.findviewbyid(r.id.test_stop_button); convertview.settag(holder); convertview.findviewbyid(r.id.commandline...

javascript - remove all <div> , when ids are in matching some pattern -

all divs inside of div #main have tree structure of lots of divs.but divs not child of other div, connected 1 line, divs generating @ run time , generating id of div, following pattern id of first child node= id of parent node+"1" , id of second child node= id of parent node+"2" id of root div node id of first child node node1 id of second child node node2 id of first child of node1 node11 id of second child of node1 node12 id of first child of node11 node111 id of second child of node11 node112 ... ... ... requirement: if click on div, child nodes till leaf should deleted. you can use starts attribute selector [name^="value"] child elements have ids starts id of parent. $('#main div').click(function(){ $('[id^='+this.id + ']').remove(); });

machine learning - Modelling steps in a process -

so i'm not new machine learning, i'm faced task have little knowledge of existing solutions. basically, want able learn steps in process. examples, steps go state state z. learn such sequences sequences produced users. example, ten users attempt go z, producing 10 different "traces", , want learn ideal sequence. i know of strips approach, uses logic represent states , steps. know of other approaches? using graphs, or decision trees, or don't know? probabilistic approaches maybe? i'm curious alternatives. i didn't have success in searches far, maybe because lack appropriate keywords. there specific name i'm describing? best;

JQuery/PHP multiple files one at a time with only one input field -

i search through net didn't find things on problem. hope here can help! write in title want upload mutliple files, 1 @ time, 1 input. tried using jquery can see below, doesn't work! can help, please? <!doctype html> <html> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <head> <script> $(document).ready(function() { $(document).on('change', '.file',function(){ $('<input type="file" name="file[]" class="file" size="60" />').appendto($("#divajout")); $("div input:first-child").remove(); return false; }); }); </script> <title>test input file unique pour plusieurs fichiers</title> </head> <body> <form action="" method="post...

c# - How to Store Password? Forms Authentication -

we using forms auth follows: formsauthentication.setauthcookie(userid, rememberme); with can user id. , able user details when need them using user id. with web service call like objregistereduser = cmembership.getbyloginid(sloginid); we know need upgrade site new apis service calls require users password this: objregistereduser = cmembership.getbyloginidandpasword(sloginid, spassword); for "remember" me function, best way remember password? encrypt it, store in cookie, retrieve , decrypt? we can't populate new profile without password. any suggestions? storing password data, encrypted go against best practices? passwords should stored using one-way encryption algorithm (sha). means not able retrieve underlying password. have access hashed value.

Python: filter list of list with another list -

i'm trying filter list, want extract list (is list of lists), elements matches key index 0, list b has serie of values like this list_a = list( list(1, ...), list(5, ...), list(8, ...), list(14, ...) ) list_b = list(5, 8) return filter(lambda list_a: list_a[0] in list_b, list_a) should return: list( list(5, ...), list(8, ...) ) how can this? thanks! use list comprehension: result = [x x in list_a if x[0] in list_b] for improved performance convert list_b set first. as @kevin noted in comments list(5,8) (unless it's not pseudo-code) invalid , you'll error. list() accepts 1 item , item should iterable/iterator

wordpress - jquery scroll the height of hovered div -

i have wordpress loop. every article has class ".post". have button class ".skip" every .post. when button clicked want page scrolled next .post in loop. i'm using $(function(){ $(window).scroll(function(){ $(".post").each(function(){ var height = $(".post").height(); var scroll = $(window).scrolltop(); $(".skip").click(function(){ $(window).scrolltop(scroll+height); }); }); }); }); something done not should! i mean..the page scrolls on click height of first .post (no matter .post .skip button belongs to) help! the .post container wp loop <article <?php post_class(); ?>> <div class="skip">skip</div> <?php if ( has_post_thumbnail()) : ?> <div class="container"> <div> <?php the_post_thumbnail(); ?> </div...

java - Passing 2D Array argument with JACOB -

i have com method i'm trying invoke, there's argument of type 'object' must 2d double safe array, collection of lat/long points. how can create safearray in jacob send through com interface? i've tried passing 2d array object in object list. method doesn't return error, not see results expect in falconview (rendering of polygon). double polypoints[][] = new double[5][2]; polypoints[0][0] = 75.3; polypoints[0][1] = 4.5; polypoints[1][0] = 3.8; polypoints[1][1] = 4.8; polypoints[2][0] = 2.3; polypoints[2][1] = 2.5; polypoints[3][0] = 5.3; polypoints[3][1] = 6.5; polypoints[4][0] = 0.3; polypoints[4][1] = -1.5; // can't recreate variant or safearray double[x][y] array; object[] polygonargs = new object[] {m_mainlayerhandle, polypoints, 1}; variant returnaddpolygon = dispatch.invoke(mainlayerdispatch, "addpolygon", dispatch.method, polygonargs, new int[1]); system.out.println(...

jquery - See if bootstrap checkbox is checked asp.net c# -

i need true or false if bootstrap check-box checked on server side this control: <div id="checkcategoria" runat="server" class="btn-group" data-toggle="buttons-checkbox" runat="server"> <asp:button id="chkinspecao" onclientclick="return false;" text="inspeção" usesubmitbehavior="false" runat="server" cssclass="btn btn-check" /> <asp:button id="chkhipot" onclientclick="return false;" text="hipot" usesubmitbehavior="false" runat="server" cssclass="btn btn-check" /> <asp:button id="chkcalibracao" onclientclick="return false;" text="calibração" usesubmitbehavior="false" runat="server" cssclass="btn btn-check" /> <asp:button id="chkchecageminterna" onclientclick="return false;" text="checag...

Is there a more efficient way of achieving this update using linq? -

by efficient, i'm referring resources. foreach (var n in activenodes.where(x => userapplications.any(y => y.buyerid == x.buyerid))) { n.status = pingtreestatus.duplicate; } linq querying not updating . method fine as-is. linq allow create new collection different property values (saving of overhead of creating new object, adding ti list, etc.), not designed update collection in-place.

linux - Edit a configuration file w/o temp files -

i'm trying write simple script add configuration @ top of of file, , that's how this: #! /bin/bash sudo apt-get install monit # below code i'm interesting change echo ' set eventqueue basedir /etc/monit/eventqueue/ slots 1000 set mmonit http://monit:monit@xxx.xxx.xxx.xxx:8080/collector set httpd port 2812 , use address ec2-xxx.xxx.xx.xx.com allow localhost allow 0.0.0.0/0.0.0.0 allow admin:swordfish ' | sudo tee -a /etc/monit/monitrc_tmp sudo cat /etc/monit/monitrc >> /etc/monit/monitrc_tmp sudo rm /etc/monit/monitrc sudo mv /etc/monit/monitrc_tmp /etc/monit/monitrc # point sudo sed -i 's/set daemon 120/set daemon 20/' /etc/monit/monitrc exit 0 as can see 'm trying add configuration @ top of file. , want know there flag or command me without creating tmp file. looks case sed -i since you're on linux. also, since system administration work, preserve backup. sudo sed -i.bak -e '1i\ set eventqu...

Google Cloud Messaging for Chrome channelId unique per device? -

suppose have extension installed on 2 computers, , logged both same google account. will chrome.pushmessaging.getchannelid return same value both computers? there way request each individual install gets own channel? cannot find information readily available anywhere. the question asked here on stack overflow https://stackoverflow.com/questions/13235810/google-cloud-messaging-and-identity , there no answer given. from observe, channel id unique user's account, not unique install. not sure if intended behavior or can count on being case. i think channel id per application id , stay way. otherwise, think how complex send message to, say, 100,000 installations of app. you'd have keep file of 100,000 channel ids, , take long time invoke api 100,000 times, since channel id part of api call send message. sorry... wrong. quote https://developer.chrome.com/apps/cloudmessaging : "the push messaging service returns channel id client; id linked app id , user....

ios - launch youtube channel in youtube app -

for launching video on youtube app, using below code. nsurl *instagramurl = [nsurl urlwithstring:@"youtube://foo"]; if ([[uiapplication sharedapplication] canopenurl:instagramurl]) { nslog(@"opening youtube app..."); nsstring *stringurl = @"http://www.youtube.com/watch?v=h9vdapqywfg"; nsurl *url = [nsurl urlwithstring:stringurl]; [[uiapplication sharedapplication] openurl:url]; } else { // open in uiwebview in webviewviewcontroller webviewviewcontroller *secondview = [self.storyboard instantiateviewcontrollerwithidentifier:@"webinterface"]; secondview.headerlabel = @"youtube"; secondview.webpath = @"http://www.youtube.com/watch?v=h9vdapqywfg"; [self.navigationcontroller pushviewcontroller:secondview animated:yes]; } now client changed mind , asking put channel in iphone app. for testing, used link http://www.youtube.com/user/richarddawkinsdotnet but when use link , instead of y...

JVM Java Virtual Machine and stacks -

i have query interested in, full explanation though cannot find answers anywhere can explain me how jvm (java virtual machine) uses stacks , stack frames in order organise computations? the java bytecode so-called stack-oriented programming language . model used lot of virtual machines - in contrast architecture of physical machines. here example: public static int foobar(int value) { return value + 42; } the java bytecode of method looks follows: iload_0 bipush 42 iadd ireturn these instructions not use registers . instead use stack computation: push first argument onto stack. push constant 42 onto stack. pop 2 elements stack, add them , push result onto stack. pop top element stack , return it. it's same other java bytecode operations. there no registers can used. operations push and/or pop elements onto , stack.

Best solution in Rails for a 'image selector'? -

i'm working on project similar blog posts have several associated images. i've been conflicted few days best way this, , wondering if there good, standard way of doing or if had better ideas mine far. one option came use simple form f.association combined bootstrap plugin, imagepicker , seems messy , doesn't have solution adding new images except create separate form, link it, save current form in session, , redirect saved form after creating new image. the other option think of render association partials, , include edit/delete links on the partials conditionals show when needed, again needs same solution creating new images, , doesn't handle case user has collection of images , images linked posts via habtm relationship well. so, better ideas? for similar problem, solution decided on: i used simple form f.association pick associated images, moved else out image controller build sort of 'image manager' similar wordpress has. put image mana...