Posts

Showing posts from June, 2012

asp.net mvc - How to do donut caching with c# mvc and Varnish? -

i added varnish config sub vcl_fetch { set beresp.do_esi = true; } } in mvc application i've childaction <div>@* should not cached, change returned value in db *@ 1 @html.action("gethour", "index", new { id = 5 }) </div> <div> 2 <esi:include>@* should cached *@ @html.action("gethour", "index", new { id = 5 }) </esi:include> </div> and added request header request.headers.add("x-esi", "1"); but varnish keeps caching entire page. what miss? i've notice in browser request header x-esi doesn't exist. varnish remove tag <esi:include the code in action gethour pretty simple, retrieve decimal sql server. change this: <esi:include>@* should cached *@ @html.action("gethour", "index", new { id = 5 }) </esi:include> for this: <esi:include src=...

view by newspaper category with rails 4 -

my problem need fill array rails 4 display top 3 results categorized newspaper category of newspaper is: 0,1,2,3 or other, random. parsed_json : 1 array values de newspapers, after news_source fill news newspapers. sql: http://i.stack.imgur.com/dp8bm.png with code last value of array of newspaper. def index if get_api_key @parsed_json = array.new @news_source = array.new #trae todos los datos asociados la llave @emission = emission.where(key: get_api_key) #envío de datos json @emission.each |p| @weather_now = weathernowuy.where(city: p.state) @weather_next_days = weathernextdaysuy.where(city: p.state) @parsed_json << json.parse(p.news_source) end @parsed_json.each |u| @news_source = newsuy.where(newspaper: u).limit(3) end end end example of return, no show newspaper 1 found in array parsed_json . not "news": [ { "title": "con un gol de tevez, boca venció godoy cruz...

ruby on rails - Where is undefined method called? -

i have decisions resource, nested under groups resource. has_many , belongs_to have been defined in models. resources :groups resources :decisions end ...and have edit form @ path: /groups/:group_id/decisions/:id/edit(.:format) i'm getting error in rspec test: failure/error: put :update, {:id => decision.to_param, :decision => valid_attributes, group_id: decision.group.id}, valid_session nomethoderror: undefined method `decision_url' #decisionscontroller:0x007ffeb23482e0> and when navigate form in development environment, similar error: <%= link_to 'edit', edit_group_decision_path(@group, @decision) %> nomethoderror @ /groups/6/decisions/5/edit undefined method `decision_path' #<#:0x007fd1ff569130> i'm using 'better_errors' gem, , cites first line of form_for no method error: <%= form_for(@decision) |f| %> i don't have 'decision_url' anywhere...

android - Get RecyclerView last visible item -

findlastvisibleitemposition returns -1 following sequence: onviewcreated() { recyclerview.setadapter(adapter = new adapter()); adapter.updatecontent(list<content>); // call notifyitemrangechanged post(new runnable() { run() { layoutmanager.getlastvisibleitem(); // == -1 (using runnable or not) } } } it seems children views not ready yet. using tree observer on recyclerview seems solve problem, best approach last visible item after setting content adapter right after creation?

ruby on rails - How can I override a default scope in a has_many :through association? -

override default scope isn't being persisted (in useful way) in has_many :through association. here's relevant stuff models: class user has_one :invitation default_scope where(registered: true) end class invitation belongs_to :user, conditions: { registered: [true, false] } belongs_to :program end class program has_many :invitations has_many :users, through: :invitations end finding users through invitations works expected. invitation.joins(:user) generates this: select `invitations`.* `invitations` inner join `users` on `users`.`id` = `invitations`.`user_id` , `users`.`registered` in (1, 0) given this, i'd assume program.last.users should find relevant users, whether registered true or false. instead, this: select `users`.* `users` inner join `invitations` on `users`.`id` = `invitations`.`user_id` `users`.`registered` = 1 , `invitations`.`program_id` = 52 , (`users`.`registered` in (1, 0)) this sql expect. how create association gives ...

jquery - Semantic UI: Multi Select Dropdown pre-select values -

i'm working on building web page using semantic ui framework. i'm new both ui frameworks , jquery. i'm using multi select dropdown component select roles user. i'm able implement dropdown , select values. but can me set default value(pre-selected) dropdown ? i've tried behaviors specified here , somehow can't work. there i'm missing here ? here fiddle , code. my html : <div class="twelve wide field"> <label style="width: 250px">add roles user</label> <select name="skills" multiple="" class="ui fluid dropdown"> <option value="">roles</option> <option value="role1">role 1</option> <option value="role2">role 2</option> <option value="role3">role 3</option> </select> </div> my javascript : $(".ui.fluid.dropdown").dropdow...

Summing an array of numbers in Objective C -

basically. have array of numbers need sum. here code: - (nsinteger ) sumofintegersinarray: (nsarray *)array { nsinteger sum = 0; (nsnumber *num in array) { sum += [num intvalue]; } return sum; } for reason doesn't work, if nslog sum , print 100 (which sum should be). why doesn't work? the error keep getting is: "incompatible integer pointer conversion return 'nsinteger (aka 'long') function result type 'nsinteger *' (aka 'long *'); take address & (if let correct code return &sum , still doesn't work. - (nsinteger*) sum { nsinteger sum = 0; for(nsnumber *num in array) { sum += [num intvalue]; } return sum; } i think work this. have miss on return type change this - (nsinteger) sum { nsinteger sum = 0; for(nsnumber *num in array) { sum += [num intvalue]; } return sum; }

Good way to replace invalid characters in firebase keys? -

my use case saving user's info. when try save data firebase using user's email address key, firebase throws following error: error: invalid key e@e.ee (cannot contain .$[]# ) so, apparently, cannot index user info email. best practice replace . ? i've had success changing . - won't cut since email's have - s in address. currently, i'm using var cleanemail = email.replace('.','`'); but there going conflicts down line this. in email address, replace dot . comma , . pattern best practice. the comma , not allowable character in email addresses is allowable in firebase key. symmetrically, dot . is allowable character in email addresses not allowable in firebase key. direct substitution solve problem. can index email addresses without having loop on anything. you have issue. in code: var cleanemail = email.replace('.',','); will replace first dot . email addresses can have multiple dots. re...

excel - Record active cell address in new sheet on button click -

i want button click record address of active cell have selected in sheet 1, , place next empty row in column "b" on sheet 2. on button click well, wish msgbox display corresponding row of column "a", contains reference numbers. so far have working button, coding abilities limited , have: private sub cellreferencebtn_click() msgbox "the active cell row , column " & activecell(row + 1, column + 1).address end sub any appreciated! here go: private sub cellreferencebtn_click() activecell sheet2.[offset(b1,counta(b:b),)] = .address msgbox sheet1.cells(.row, 1) end end sub

c# - FirstOrDefault inline null checking -

i have following code : var result = new collection<object>(); result.add( list.select(s => new { s.name, rating = s.performance.orderbydescending(o => o.year).firstordefault().rating }) ); if there's no record found in performance , give me nullexception expected because i'm trying rating property null value question how set null if firstordefault() null , rating value if not. thanks do this: rating = s.performance.orderbydescending(o => o.year) .select(o => o.rating) .firstordefault()

swift - CoreData - PickerView updating a tableView -

look code: models: import foundation import coredata class trainingdetails: nsmanagedobject { @nsmanaged var exercisename: string @nsmanaged var repsnumber: string @nsmanaged var setsnumber: string @nsmanaged var trainingday: trainingday } and import foundation import coredata class trainingday: nsmanagedobject { @nsmanaged var day: string @nsmanaged var dayindex: nsnumber @nsmanaged var trainingdetails: nsset } and function here : func pickerview(pickerview: uipickerview, didselectrow row: int, incomponent component: int) { let currentday = daysarray[row] let fetchrequest = nsfetchrequest(entityname: "trainingdetails") let predicate = nspredicate(format: "trainingday.day == %@", currentday) fetchrequest.predicate = predicate let sort = nssortdescriptor(key: "exercisename", ascending: true) fetchrequest.sortdescriptors = [sort] detailsarray = (moc!.e...

.net - Unable to call WCF service on different server -

we unable invoke wcf service on remote server. working fine whenever restart server.whenever deploy new code services project using teamcity again problem starts. note: if invoke same wcf service using soapui same machine services hosted getting response service. when same system not getting response.

Is there an alternative to using Visual Studio for the Unreal Engine? -

a while had downloaded unreal engine on new pc, , ran it. message popped saying needed visual studio installed use engine. went ahead , downloaded installer visual studio 2013 community edition, upon running it, notified needed 6gb across drives. unfortunately me, don't have more 3gb left on ssd. there alternative using visual studio? it's been while since i've installed ue4, far know, don't need visual studio unless going incorporating c++ game. you're not obligated use c++, can make simple games entirely in blueprint, visual scripting language of engine. being said, can skip message tells need visual studio , continue on installation? if can't, may in bind, because think development environment i've ever seen associated engine.

ubuntu 14.04 server perl POSIX install error -

i don't know perl, needed posix dependency script. have configured cpan answering default questions , then, inside cpan, install posix i have been asked million questions, answered default all, , script installing million modules. need ? i'm concerned if goes wrong possible undo ? update well, feared happened everything date. type '/usr/bin/make test' run test suite. ./perl -ilib installperl --destdir= /usr/local/bin not writable make: ** [install-all] erro 2 rjbs/perl-5.22.0.tar.bz2 /usr/bin/make install -- not ok failed during command: rjbs/perl-5.22.0.tar.bz2 : install no please, how can fix ? posix core module included perl. don't need install separately. why don't install perl via package manager instead of source?

c# - Can't properly align my receipt lines -

i having problems aligning 2 variables in receipt building graphics.drawstring(). trying achieve: <indent>cash....................500.00 <indent>master card............1000.00 <indent>american express.....10,000.00 this have foreach (var item in gc.payment_repo) //entity framework { int typelength = item.type.length; int amountlength = item.amount.length; graphics.drawstring(" " + item.type.padright(20, '.') + item.amount.padleft(typelength)); } here working concept using rectangle , stringformat align text. sample below must in onpaint() of control or printdocument . can create form , override onpaint , paste code below: list<dynamic[]> rows = new list<dynamic[]>(); rows.add(new dynamic[] { "cash", 500 }); rows.add(new dynamic[] { "master card", 1000 }); rows.add(new dynamic[] { "american express", 10000 }); graphics g = e.graphics; font f = new font(...

machine learning - normalize data and it's impact on error of prediction -

could tell me impact of normalization on absolute error , root mean square error? matter of truth, used normalize data , allso un-normalized data regression random forest algorithm, result (absolute error , rmse) differ significently!! example(with normalized data: absolute error=0.1014 , rmse=0.173 unnormalized data: absolute error=4.419 , rmes=7.57) i'm wondering these significant difference between normalized , unnormalized cases! explanation? i found it's because of range of data in normalize , un-normalize form.

mysql - Login Authentication to Database using C# -

newly, i'm working xamarin studio build program using c#. know quite simple question, can't it. want know kind of code have use authenticate login mysql database. thanks using system; using system.data; using mysql.data.mysqlclient; using gtk; public partial class mainwindow: gtk.window { public mainwindow () : base ("repsys icdx 1.0 - login") { setdefaultsize (282, 142); setposition (windowposition.center); deleteevent += ondeleteevent; label uid = new label ("username\t: "); label pass = new label ("password\t: "); entry uide = new entry(); entry passe = new entry (); passe.visibility = false; button login = new button ("log-in"); button exit = new button (stock.cancel); login.setsizerequest (75, 30); exit.setsizerequest (75, 30); fixed fix = new fixed (); fix.put (uid, 20, 30); fix.put (pass, 20, 60...

nginx - SSL meteor Not Working.. Stuck in Spinner (loads nav bar and sidebar but nothing else) -

Image
i've been having issue days , don't know how fix it. i trying setup ssl certificate, , reason site works on http, , when try load https, loads navbar , sidebar, , it's stuck on spinner. when examine @ network connections on chrome, keeps trying load xhr , websockets. in safari error in console websocket connection 'wss://mysite/sockjs/530/72iokiqa/websocket' failed: websocket closed before connection established i trying set headers, in particular x-forwarded-proto header, can't figure out how that. i using mup. // configure environment "env": { "root_url": "https://inslim.com" }, "ssl": { "pem": "./ssl.pem" } for reason, when try add por env variable, won't allow me mup deploy. break , site go down. i confused nginx. installed , set up, don't think it's making difference. if run 'service nginx stop' or service nginx start, doesn't make diffe...

vim - Is there a command to jump Nth line from current line? -

e.g. jump 4000 line when on 3000 line. maybe command like :goto next 1000g there 3 ways go directly line 4000: :4000 4000g 4000gg or can jump down 1000 lines this: 1000j credit lieven keersmaekers , can jump down so: :+1000

sockets - streamsocket.connectasync results in access denied exception from hresult: 0x80070005 on windows phone 8.1? -

i tying connect 2 windows phone 8.1 devices via bluetooth. have 2 buttons, 1 discover peers, , second 1 connect. i sure enabled internet(client & server) , proximity capabilities. here code: (frist button works fine) private async void button_click(object sender, routedeventargs e) { peerfinder.alternateidentities["bluetooth:paired"] = ""; var peerlist = await peerfinder.findallpeersasync(); if (peerlist.count > 0) { t1.text = peerlist[0].displayname + "\n"; } else t1.text= "no active peers"; } private async void button_click_1(object sender, routedeventargs e) { peerfinder.alternateidentities["bluetooth:paired"] = ""; var peerlist = await peerfinder.findallpeersasync(); if (peerlist.count > 0) t1.text = peerlist[0].displayname; try { peerfinder.stop(); ...

ios - navigationController is nil while performing segue? -

i using library called swiftpages . works fine. when perform push segue view controller navigation bar self.navigationcontroller nil ? how can add navigation bar pushed vc ? viewcontroller class coursepagecontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { @iboutlet weak var chaptertable: uitableview! @iboutlet weak var coursedesc: uitextview! var coursename : string! var chapname : [string] = [] var chapid : [string] = [] override func viewdidload() { super.viewdidload() self.title = coursename self.coursedesc.text = coursedescriptionc self.coursedesc.setcontentoffset(cgpointzero, animated: true) hud() chaptertable.estimatedrowheight = 120 chaptertable.rowheight = uitableviewautomaticdimension getdata() } func hud(){ progress.show(style: mystyle()) } func getdata(){ alamofire.request(.get, "http://www.w...

c++ - How to map opencv to eigen with alignment support without allocate the memory? -

i use opencv read big data data set(28*28 rows, 200000 cols) , want map matrix of eigen alignment support without allocate big buffer. cv::mat big_data(28*28, 200000, cv_64f); //...read data , preprocess ematrix map_big_data; //cv2eigen allocate new, big buffer cv::cv2eigen(big_data, map_big_data); is possible map matrix without allocate big memory?it okay resize cv::mat, want avoid 2 big buffer exist @ same time(may throw bad_alloc) cv::mat big_data(28*28, 200000, cv_64f); //read data , preprocess.... using ematrix = eigen::matrix<double, eigen::dynamic, eigen::dynamic, eigen::rowmajor>; using emap = eigen::map<ematrix, eigen::aligned>; //resize cv::mat meet alignment requirement(16bytes aligned),is possible?how align_cols? big_data.resize(big_data.rows, align_cols); //this may or may not crash emap map_big_data(reinterpret_cast<double*>(big_data.data), big_data.rows, big_data.cols); edit : use eigen::aligned_allocator allocate alig...

linux - Sort files according to version -

i have directory names version number such : 1.1.10 1.1.11 1.1.20 2.1.0 1.1.50 3.1.1 1.1.1 how can sort in following way? 1.1.1 1.1.10 1.1.20 1.1.50 2.1.0 3.1.1 if sort command not include --sort=version or -v option (i.e. you're in freebsd or osx or you're using gnu sort earlier version 6.0), can sort individual fields, delimited dot. example: $ text=$'1.1.1\n1.1.10\n1.1.20\n1.2.10\n1.1.2\n1.1.21\n1.1.12\n1.2.1\n' $ echo "$text" | sort -t. -k1,1n -k2,2n -k3,3n

azure storage blobs - Azcopy from a SAS url giving errors -

i trying copy sas url location destination storage account. tried following commands getting few errors: azcopy.exe /source: http://wwwwww.blob.core.windows.net/vhd1/?sv=2014-02-14&sr=c&sig=xxxxxxxxxxxxxxxxx&st=2015-08-05t04%3a00%3a00z&se=2015-09-01t04%3a00%3a00z&sp=rl /dest: https://yyyyyyyy.blob.core.windows.net/vhds /destkey:zzzzzzzzzzzzzzzzzzz filename1.vhd /y the syntax of command incorrect. invalid sas token in parameter "source". 'sr' not recognized internal or external command, operable program or batch file. 'sig' not recognized internal or external command, operable program or batch file. 'st' not recognized internal or external command, operable program or batch file. 'se' not recognized internal or external command, operable program or batch file. 'sp' not recognized internal or external command, operable program or batch file. azcopy.exe /source: http://wwwwwwww...

node.js - Android Chat Push Notifications Socket.Io NodeJS Server -

i built nodejs based chat server socket.io underlying library. chat client in android app , uses https://github.com/socketio/socket.io-client-java currently, push notifications determined based on number of sockets connected. (1:1 chat, ideally, if there 2 , implies both available) i subscribe whenever open chat window or comes focus after going out, disconnect whenever move out of chat window or window goes out of focus. cases handle are: 1. app closed 2. app open user on other app 3. user on app elsewhere not on chat windows 4. user on chat summary window 5. user on 1:1 chat - notifs shouldn't come chats on window 6. user on 1:1 - should push notifs chats else 1 case pending main bug - if user on app , on chat window, closes app, socket connection still alive activity not cleaning entirely. causes subsequent runs break push notifs. what best way resolve ? other solutions ?

c# - ASP.Net web API Help Page - no content -

i installed package nuget, uncommented line helppageconfig.cs- config.setdocumentationprovider(new xmldocumentationprovider(httpcontext.current.server.mappath("~/app_data/xmldocument.xml"))); i've set same file under properties->build->xml documentation file, added new global.asax.cs file in call registration areas under application_start method: protected void application_start(object sender, eventargs e) { arearegistration.registerallareas(); } i've added summary of controllers: public class incidentscontroller : apicontroller { /// <summary> /// summary /// </summary> /// <param name="incidentid">this incidentid</param> /// <returns>it returns something</returns> [route("{incidentid}")] [httpget] public object getincidentbyid(int incidentid) { return incidents.singleordefault(i => i.id == incidentid); } } when run webpa...

How can I remove the "the Location property may not be read from target" error in CMake? -

i trying run cmake script in this post . script cmake print properties of target. however, when tries retrieve "location" property of target, following error observed: the location property may not read target "abc". use target name directly add_custom_command, or use generator expression $<target_file>, appropriate. then tried print property message($<target_file:abc>) , not work either. ideas?

officedev - Adding vbnewline into strings VBA -

ok when able solve (with stackoverflow assistance) arranging entries time function, presented new issue. it no longer followed rules of template have attached it. not huge problem because thought of quick solution not working. i have added function below, purpose: split string passed -thesentence- array -thewords()- find out if string -final- (do while loop adds each word array string 1 @ time) if more 56 length if -final- more 56 length add vbnewline string before adding next word change original string -thesentnce- equal created string -final- should have vbnewline in after approx 56 length .... not working need push in right direction stupid function chcklen(byval thesentence string) dim thewords() string dim final string dim arraycntr integer dim arrayamount integer dim chcker integer arraycntr = 0 thewords = split(thesentence) arrayamount = ubound(thewords) chcker = 56 while arraycntr <= arrayamount if len(final + thewords(arraycntr)) ...

php - LEFT JOIN, ORDER BY and pagination -

the elements of list not displayed in alphabetical order. list displayed page page (pagination : page 1, page 2, page 3 ....). used order by request returns false results. select * structure left join typologie on structure.id_typologie = typologie.id_typologie left join pays on structure.id_pays = pays.id order nom_contact asc examples data: zone attente roissy ap-hp (archives de) ap-hp bureau recherches apprentis d'auteuil mecs saint-jean eudes aptira caroline chateau château de la villette chivilo (mme) cicr genève cicr kinshasa where problem? i see sorting case sensitive. change order by following: select s.* structure s left join typologie t on s.id_typologie = t.id_typologie left join pays p on s.id_pays = p.id order lower(s.nom_contact) asc that should fix problem.

php - Wamp MySQL PhpMyAdmin Remote access configuration issue -

Image
i trying give remote access phpmyadmin, had put wamp online , everthing working fine in localsystem. i can access phpmyadmin ip4 address localhost. using same ip4 address remote not able connect phpmyadmin. i error : connection_timeout here configuration looks in : c:/wamp/apps/phpmyadmin4.3.12/ <directory "c:/wamp/apps/phpmyadmin4.3.12/"> options indexes followsymlinks multiviews allowoverride require granted <ifdefine apache24> require local </ifdefine> <ifdefine !apache24> order deny,allow deny allow localhost ::1 127.0.0.1 </ifdefine> php_admin_value upload_max_filesize 128m php_admin_value post_max_size 128m php_admin_value max_execution_time 360 php_admin_value max_input_time 360 </directory> and in httpd.conf file configured : listen 192.168.3.170:81 listen 0.0.0.0:81 listen [::0]:81 from remote system, ping working shows there no firewall blocking. is there con...

c++ - unsigned long long conflict with uint64_t? -

this question has answer here: c++: long long int vs. long int vs. int64_t 3 answers we use template specialization type parameter like class my_template_class<uint64_t m>: public my_template_class_base<uint64_t> { .... } class my_template_class<unsigned long long,m>: public my_template_class_base<unsigned long long> { .... } this working 64-bit compilation gcc. while when try 32 bit mode, reports "previous definition" above 2 classes. so unsigned long long same uint64_t in 32-bit compilation not in 64-bit compliation? the compilation difference cxx flag -m32 , -m64 so unsigned long long same uint64_t in 32-bit compilation not in 64-bit compilation? yes. in 32-bit mode, long 32 bits , long long 64 bits. in 64-bit mode, both 64 bits. in 32-bit mode, compiler (more precisely <stdint.h> heade...

sql server - Convert MySql query into MSSql query -

here mysql query , want convert mssql. saw answers using microsoft sql server migration assistant mysql. but since pc having issues installation of application, not perform it. can 1 me convert mysql query mssql query? here query : select regno, max(if(subject = 'cmis 1113', eligibility, null)) `cmis 1113`, max(if(subject = 'eltn 1113', eligibility, null)) `eltn 1113`, max(if(subject = 'imgt 1113', eligibility, null)) `imgt 1113` table_name group regno you can use case expression: select regno, max(case when subject = 'cmis 1113' eligibility end) [cmis 1113], max(case when subject = 'eltn 1113' eligibility end) [eltn 1113], max(case when subject = 'imgt 1113' eligibility end) [imgt 1113] table_name group regno

Elm: How would you build and style your UI? -

for last few days i've learning elm, , has been refreshing experience. not want go js land, :-(. my problem still not see way produce web app elm, , love guidance , advise: evancz/start-app great organising app's structure. evancz/effects elmfire can handle talking firebase . but how build , style ui? let's take concrete example: styled select widget semantic-ui . implemented list of divs, js handle dropdown , multi-select. the alternatives have found far are: include semantic's css , js (it requires jquery) , use ports hook widget's js events. include semantic's css , try build functionality in elm. both build functionality , style in elm (adam-r-kowalski/elm-css) . forget semantic , redo site in bootstrap using circuithub/elm-bootstrap-html. are there other alternatives, or widgets reused missing? the theseamau5/tabbedpages container intimidating. others widgets require work? again, i'd love use elm project, not have knowl...

Textpad from Helios used for editing XML or HTML: How to identify closing / corresponding TAG? -

working textpad editor on xml , html-files i'm looking possibility identify corresponding closing tag. ideal if whole area between opening tag , closing tag marked or highlighted. hint: ctrl+m not work (just jumps > < , vice versa). the method should deal following situations: sometimes tag closed (with \>). sometimes same tag used within tag (like in tree descriptions jhm). one part of solution found in macros - @ least marking tag content, not closing tag. because i'm working textpad configured use german language of choice, give translation: open "search". give "<" searched. start makro recorder. in search windows hit button "next" (means next occurance of search string). mark text until corresponding closing ">" using ctrl+shift+m. end recording. save macro. to step through html-code have execute macro. source: of textpad 6.1.3 (32 bit).

java - Error while installing Dbeaver On Ubuntu 14.04 -

i trying install dbeaver on ubuntu (14.04) unable install. seems there issue java installation. installtion process 1. $ sudo apt-get install gdebi 2. $ wget http://dbeaver.jkiss.org/files/dbeaver_3.4.5_i386.deb 3. $ gdebi dbeaver_3.4.5_i386.deb i error when tring install : webwerks@bt-r4p9:~/downloads$ sudo gdebi dbeaver_3.4.5_i386.deb reading package lists... done building dependency tree reading state information... done building data structures... done building data structures... done dbeaver universal database manager want install software package? [y/n]:y selecting unselected package dbeaver. (reading database ... 183011 files , directories installed.) preparing unpack dbeaver_3.4.5_i386.deb ... unpacking dbeaver (3.4.5) ... dpkg: dependency problems prevent configuration of dbeaver: dbeaver depends on java7-runtime. dpkg: error processing package dbeaver (--install): dependency problems - leaving unconfigured processing triggers gnome-menus (3.10.1-0ubuntu2...

python - How to do while() the "pythonic way" -

i want this: from django.db import connection cursor = connection.cursor() cursor.execute("pragma table_info(ventegroupee)") while row = cursor.fetchone(): print(row) i this: file "<input>", line 1 while row = cursor.fetchone(): ^ syntaxerror: invalid syntax what "pythonic" way of doing this? you don't have use while loop @ all, because cursors iterable: for row in cursor: print(row) from "connections , cursors" section of django documentation : connection , cursor implement standard python db-api described in pep 249 — except when comes transaction handling. from mentioned pep 249 : cursor.next() return next row executing sql statement using same semantics .fetchone() cursor.__iter__() return self make cursors compatible iteration protocol

Could I extend git functionality in my ~/bin/ directory? -

as stated in numerous posts this extend git placing program/script in path. working if place script in example /usr/local/bin/ . add commands without being root , if if put in ~/bin/ not found. ~/bin/ in path since added in .bashrc this: export path="${path}:~/bin" i got other stuff in ~/bin/ use regularly path-thing working other things! is there i'm missing or doing wrong here? the missing piece naming convention: git my-custom-made-extension ... → git-my-custom-made-extension that means need have executable file ~/bin/git-my-custom-made-extension (no extension, chmod 755) plus, don't rely on ~ : git shell execute script might not have same ~ user owns script. path should include full path of home. see " shell variable expansion in git config "

javascript - Onsen and AngularJS: Reload List Item and data -

i'm using onsen ui , angularjs. have problem. when page1.html page2.html how call function in page1.html ? page1.html <ons-list> <ons-list-item ng-repeat="user in users" modifier="chevron" class="list-item-container"> content </ons-list-item> </ons-list> <ons-button onclick="navigator.pushpage('page2.html')">go page 2</ons-button> page2.html <ons-toolbar> <ons-back-button>back</ons-back-button> </ons-toolbar> thanks answers guys. problem has solved. solution: http://monaca.mobi/en/blog/lets-make-a-phonegap-app-with-angularjs-onsen-ui/ please try example. $scope.$watch called when leave or enter in page. <!doctype html> <!-- csp support mode (required windows universal apps): https://docs.angularjs.org/api/ng/directive/ngcsp --> <html lang="en" ng-app="app" ng-csp> <head> <meta charset=...

python - For loop, how can i use loop variable outside loop -

lr = int(raw_input()) rpl = [] c1 = [] c2 = [] l1a = [8, 9, 14, 13, 12] l2a =[9, 12, 14, 10, 8] om = [9, 10] l3a = [26] l1b = [27, 32, 26] l2b = [30, 27, 32, 28, 31] l3b = [31, 30, 26] def i(): in l1b: j in l2b: k in l3b: n = * j * k c1.append(n) in om: j in l1a: k in l2a: n = * j * k c2.append(n) def ii(): in c1: j in c2: x = (i / j) * lr rpl.append(x) in program need loop variables i,j,k 'i' function print them in 'ii' function show combination used create x. tried 2 dimensional arrays didnt work well. there easy option work out? the following script think trying do: import operator, itertools lr = int(raw_input()) l1a = [8, 9, 14, 13, 12] l2a = [9, 12, 14, 10, 8] l3a = [26] l1b = [27, 32, 26] l2b = [30, 27, 32, 28, 31] l3b = [31, 30, 26] om = [9, 10] c1 = [(reduce(operator.mul, p), p) p in itertools....

sublimetext - How to control whether the tab key should insert tabs or spaces in sublime text 3 -

i have code, want format , add spaces instead of tabs when press tab $this->data['clients'] = $this->clients_model->selectall(); $this->data['closed'] = $this->activity_model->getclosed(); $this->data['closednum'] = $this->activity_model->closedrows(); how change configuration of sublime that? tried indentation settings in sublime documentation files not same name given in site go view -> indentation -> indent using spaces

database - Zend query sort by multiplication of columns -

i trying query rows mysql database zend framework 1. need columns, want sort them multiplication of columns: $select = $this ->select() ->where('start_date < ' . $currenttime) ->where('end_date >' . $currenttime) ->order('columna * columnb desc'); this isn't working. with zend documentation, i'm getting this: $select = $this->select() ->from(array('p' => 'products'), array('product_id', 'order_column' => new zend_db_expr('columna * columnb')) ) ->order('order_column desc); however, returns product_id , new order_column, need columns. how there? how return columns of selected rows, ordered columna * columnb? too quick. found solution trying: $select = $this ->select() ->where('start_date <...

database - Sybase add current user id on insert and update to the table -

i need track user making inserts , updates on sybase table. what best way of achieving this? please use trigger track inserts , updates. every action store/update user name in particular column say, modifier.

javascript - React.findDOMNode(component) list of methods -

i know there react.finddomnode(component).value/focus() . looking methods can used react.finddomnode . for example, have <input type='checkbox' ref='component' /> tag, , tried react.finddomnode(this.refs.component).selected (i dont know if exists), , there nothing. react.finddomnode described top-level api documentation : domelement finddomnode(reactcomponent component) if component has been mounted dom, returns corresponding native browser dom element. method useful reading values out of dom, such form field values , performing dom measurements. when render returns null or false , finddomnode returns null . the value returned native dom element —not react-specific type, why it's not covered react documentation.

java - No Console output - eclipse application -

i have looked through stack have not found similar problem. developed plugin eclipse , try test via "run eclipse application" function (i use juno btw) before pack , install on different eclipse application. now, have few errors probably, main thing bothering me console not give me output besides usual. original console: ***** desmo-j version 2.3.3 ***** test starts @ simulation time 0.0000 ...please wait... executed eclipse application console: .... [worker-35 ] info : task setting project description. completed in 0.006751573 seconds [worker-35 ] info : task completed in 0.097999197 seconds [worker-35 ] info : task completed in 0.36883489 seconds .... i have tried put system.out.println() code not appear in console. has idea why so? i have tried switching consoles, went through possible views of console, nothing. any ideas? thanks in advance cribber turns out problem code wasnt executed... -.- seemed did, in e...

c - Correspoding gcc option? -

with ibm's cc compiler there 1 option -brtl. cc-brtl ..... this option following:- -brtl tells linkage editor accept both .so , .a library file types. i using gcc compiler on ubuntu. want know corresponding option in gcc achieve same thing? you don't need option gcc . link editor accept both , files default, files being preferred. can think of gcc having opposite behaviour ibm's c compiler: behaviour without options if provided -brtl ibm's c compiler, while option -static turns of dynamic linking (and causes gcc not take files consideration), if didn't specify -brtl ibm's c compiler.

mysql - Innodb: Can't find FULLTEXT index matching the column list when queried more than 1 columns -

i'm trying run simple query on mysql innodb table: select * items match (item_title,item_description) against ('dog') both column item_title , item_description have fulltext index. i keep getting error: can't find fulltext index matching column list my issue: when query just item_title or just item_description works fine. when both @ once in 1 query, shown above, error. any idea wrong? you need third index: fulltext(item_title, item_description)

mysql - How to use between and greater than in sql -

table name:tax slab1 slab2 tax 0 10000 0 10001 50000 10 50001 100000 20 100001 0 30 here 0 represents infinity. my table this.i have find tax of 60000.i dont't know how use between , greater in sql together. i tried this: $query="select * taxsettings $liable2 between tax.slab1 , tax.slab2 or $liable2 > tax.slab1"; $liable2 amount. 1 can how insert infinity value db table try query "select * taxsettings $liable2 between case when tax.slab1=0 $liable2 else tax.slab1 end , case when tax.slab2 =0 $liable2 else tax.slab2 end;"

matlab - Script for a sum of value driven by rules -

thanks guys help. code: clc; t = importdata('data_jana.xls'); result = cell(1, size(t,2)); col = 1:size(t,2) %// length-value pairs [lengths, values] = runlengthencode(t(:,col)); %// compute deltas deltas = 0.2*lengths(values == 0.2); %// remove deltas following 5 zeros idxfivezeros = find(lengths > 4 & values == 0, 1); if(isempty(idxfivezeros)) idxfivezeros = numel(lengths); end deltas = deltas(1:sum(values(1:idxfivezeros) == 0.2)); %// store result column result{col} = deltas; end there no errors. but problem script stop deltas calculation when found 5 zeros consecutively. not want do. 1 example: col1 = 0, 0, 0.2, 0.2, 0, 0, 0, 0, 0, 0.2, 0.2, 0.2, 0, 0.2, 0, 0.2; result_col1= 0.4 1.0; in example, after first 2 0.2 there 5 0 consecutively (the rule stop), script add these 2 values. then, script continue , found 0.2 spaced less 5 0 consecutive add values. thanks. t = importdata('data.xls')...

jwplayer6 - jwplayer captions - close by default -

i don't want caption show on startup. i added this: tracks: [{ file : 'subtitles/file.vtt', kind: 'captions', "default" : false }], captions: { color: '#fff', fontsize: 20, backgroundcolor: '#006666', kind: 'captions' }, this doesn't work. tried without 'default': false (the default off) the "kind" parameter belongs in tracks block, not in captions block. nevertheless, have same problem. whether setting "default" false or omitting parameter, captions on when player starts up. can fix adding playerinstance.setcurrentcaptions(0); after setup. in of configurations prevented player obeying pause command (by javascript), had this: var s = 0; playerinstance.onplay(function() { if(s==0){ playerinstance.setcurrentcaptions(0); s=1; } }); the s variable makes sure captions not turned off on subsequent pause/play actions in case user turns them on....

jquery - Access a specific object in an arraylist at runtime in javascript -

i passing arraylist controller homepage.jsp. displaying values using jstl tags. <c:foreach items="${orglist}" var="item"> <tr> <td> <input type="radio" class="rbutton" name="chooseorg" value="${item.orgid}">&nbsp&nbsp&nbsp <a href="http://localhost:8080/springdemo/deptpage/${item.orgid}"> <c:out value="${item.orgname}" /></a> </td> <td> <c:out value="${item.orgdesc}" /> </td> </tr> this code iterating.it displaying fine. want these values somewhere else in javascript.this tried far: var radiobuttons = $("#orgdisplayform input:radio[name='chooseorg']"); var totalfound = radiobuttons.length; var checkedradiobutton = radiobuttons.filter(':checked'); var selectedindex = radiobuttons.index(checkedradiobutton); selectedindex gives me right index of...

php - If the form (on another website displayed through an iFrame has been sent), allow the user to proceed -

Image
site 1 has contact form. site 2 has content on next page accessible guest users if have filled out , sent form on site 1. does have ideas of how accomplished? just write in php file receive form data if(isset($_post['submit'])) { // whatever want header('location: http://www.your_site2_address.com'); }

ios - GADInterstitialAd not presenting in AppDelegate -

question: (ios) want display gadinterstitialad @ applicationdidbecomeactive in appdelegate. bellow code i'm using - (void)showinterstitial{ gadrequest *request = [gadrequest request]; // here need crate object of gadrequest request.testdevices = @[ kgadsimulatorid ]; gadinterstitial* interstitialad = [[gadinterstitial alloc]initwithadunitid:advertismentid]; interstitialad.delegate = self; [interstitialad loadrequest:request]; } - (void)interstitialdidreceivead:(gadinterstitial *)interstitial { [interstitial presentfromrootviewcontroller:pagerviewcontroller]; } - (void)interstitial:(gadinterstitial *)interstitial didfailtoreceiveadwitherror:(gadrequesterror *)error { // [[uiapplication sharedapplication] setstatusbarhidden:false withanimation:no]; nslog(@"==%@",[error localizeddescription]); } -(void)interstitialwillpresentscreen:(gadinterstitial *)ad{ // [[uiapplication sharedapplication] setstatusbarhidden:true withanimation:...