Posts

Showing posts from September, 2014

java - Unable to set JPanel's Background in my Swing program. -

i set jpanel contentpane of jframe. when use: jpanel.setbackground(color.white); the white color not applied. but when use: jframe.setbackground(color.white); it works... surprised behaviour. should opposite, shouldn't it? sscce: here sscce: main class: public class main { public static void main(string[] args) { window win = new window(); } } window class: import java.awt.color; import javax.swing.jframe; public class window extends jframe { private container maincontainer = new container(); public window(){ super(); this.settitle("my paint"); this.setsize(720, 576); this.setlocationrelativeto(null); this.setresizable(true); this.setdefaultcloseoperation(jframe.exit_on_close); maincontainer.setbackground(color.white); //doesn't work whereas this.setbackground(color.white) works this.setcontentpane(maincontainer); this.setvisible(true); } }

git - Continuous integration workflow - emergency use cases -

let me first describe simple ci workflow (we use git, jenkins, maven, nexus): project, creates branch master branch, makes changes, verification , code review done. puts request change. the following automated. changes merged master , queued release. deploy, every item in queue, binary built master branch (using tag or commit id), run test suite, , deploy 1% traffic. within 12 hours, have automatic analysis of performance numbers , business numbers, @ point give 100% traffic. pick next item in queue. this separation of 1 change per 100% release important because becomes difficult debug wrong if multiple changes in 1 release. this work fine, until breaks. say push feature1 1% traffic, find numbers bad, , in 12 hours takes figure out, feature2 has been merged master. in case, git revert needs done on feature1, if want feature2 go , revert buggy feature1 till fix bugs. in above case, feature1 important, , found wrong , know fix. need revert feature2 master, merge feature1 fi

java - Hbase Scheme design- Best Practice -

Image
i have switched hbase rdbms handling millions of records.. newbie not sure efficient way of designing hbase scheme. actually, scenario have text files have hundred, thousands , millions records have read , store hbase. so, there 2 set of text files(rawdata file, label file) linked each other belong same user, these files have made 2 separate tables(rawdata , label) , storing info there. rawdata file , rawdata table this: so can see in rawdata table have row key file name of text file( 01-01-all-data.txt) row number of each row of textfile. , column family random 'r' , column qualifiers columns of text files , value values of column. how inserting record in table , have third table(mapfile) store name of textfile row key user id of user column qualifier , total number of records of textfile value looks this: 01-01-all-data.txt column=m:1, timestamp=1375189274467, value=146209 i use mapfile table in order read rawdata table row row.. what sugge

email - Meeting Invite on Lotus notes using Java API -

i getting problem while sending meeting invite in lotus notes.i trying see in accept/decline feature format instead coming add calendar feature only.so if can me great.here code properties props = new properties(); props.put("mail.smtp.host", smtp_host_name); props.put("mail.smtp.auth", "false"); authenticator auth = new smtpauthenticator(); session session = session.getinstance(props, auth); session.setdebug(debug); mimemessage msg = new mimemessage(session); msg.addheaderline("method=request"); msg.addheaderline("charset=utf-8"); msg.addheaderline("component=vevent"); internetaddress addressfrom = new internetaddress(from); msg.setfrom(addressfrom); if (!(recipients == null)) { internetaddress[] addressto = new internetaddress[recipients.length]; (int = 0; < recipients.length; i++) {

database - Django Query extremely slow -

Image
i got problem django application. queries on model scope extremly slow , after debugging still got no clue problem is. when query db scope = scope.objects.get(pk='esoterik i') in django takes 5 10 seconds. database has less 10 entries , index on primary key. way slow. when executing equivalent query on db select * scope title='esoterik i'; ok, takes 50ms. same problem happens if query set of results scope_list = scope.objects.filter(members=some_user) , doing e.g. print(scope_list) or iterating on elements of list. query takes few ms print or iterating of elements takes again 5 10 seconds set has 2 entries. database backend postgresql. problem occurs same on local development server , apache. here code of model: class scope(models.model): title = models.charfield(primary_key=true, max_length=30) ## semester scope linked assoc_semester = models.foreignkey(semester, null=true) ## grade of scope. can null if scope not class assoc

asp classic - How to add the email sending script -

i'm new vbscript. have make form uploading file , sending specified email attachment. uploading used script http://www.freeaspupload.net/freeaspupload/viewsource.asp application saves file server. second part looks this: <% option explicit if request.cookies("quoterequest") = "quote" dim filename dim strmsg dim mail dim strsubject dim strfrom dim strreply dim strchoice dim addcheck dim mycheckdate dim strmailblindcopy dim smtpserver dim youremail dim public_mailer dim public_password smtpserver = "" youremail = "" public_mailer = "" public_password = "" addcheck = request.form("str_xxrand234myanswer") 'use next line if want blind copy send records 'strmailblindcopy = "info@ciupac.com" 'if addcheck = "" or null if len(addcheck)>2 or len(addcheck)<1 or isnumeric(add

php - Change index feed appearance of custom post types for twentytwelve theme? (wordpress) -

is possible , how should done? custom post appears , works fine, , can customize permalink page index page stays same. tried making content-[posttype].php + single-[posttype].php along amending get_templatepart code single-[posttype].php filebut didn't have affect on appearance of custom post type when viewd in main index feed. if want customise custom post type's archive page need create template called archive-[posttype].php , , in this, call content-[posttype].php template part have created. for example if post type 'movies' create archive-movies.php , in call (assuming content-movies.php present): <?php get_template_part( 'content', 'movies' ); ?> an invaluable reference when working out template files use 'official' wordpress template hierarchy page in codex: http://codex.wordpress.org/template_hierarchy

Get range of active object (image) in excel/VBA -

i know incredibly simple, can't seem figure out or find answer elsewhere. ill want range of selected image. in advance help. here sample how top-left , botton-right cells of picture on excel sheet. picture has selected. sub test() if (vba.typename(selection) = "picture") dim pic excel.picture set pic = selection dim topleft range set topleft = pic.topleftcell debug.print topleft.address dim bottomright range set bottomright = pic.bottomrightcell debug.print bottomright.address end if end sub

How to Focus at Marker in google map in android -

i want know whether can focus @ added marker in android application or not. if yes, how? or there alternative way task done. lets have added marker using below code : map.addmarker(new markeroptions() .title(title) .snippet(snippet) .icon(bitmapdescriptorfactory.defaultmarker(bitmapdescriptorfactory.hue_blue)) .position(pos) ); how focus @ marker maximum zoom. , if add 1 more marker should adjust zooming(maximum possible zoom) in such way both marker display @ once. trying failing @ line map.movecamera(cu); . import java.util.arraylist; import java.util.list; import android.content.intent; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.view.menu; import com.google.android.gms.maps.cameraupdate; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.googlemap.cancelablecallback; import c

python - Autobahn Websocket: listen to local port and transfer messages to clients connected to a public port -

i'am new autobahn , websockets. i'm trying build following setup: processing service (java based blackbox): waits data twitter's streaming api if new messages recieved, message send mainservice (ws://localhost:9999) {id, latitude, longitude} does magic processing data (which can take few minutes) mainservice listening on ws://localhost:9999 incomming messages processing service if message comes in (from processing service), broadcasted clients connected on ws://:9000 javascript clients connected mainservice on ws://:9000 displaying messages on map is possible write mainservice autobahn listening on 1 port , delivering messages on port? (from performance view might better combine processing , mainservice...but shouldn't point here.) sure, can run multiple services on different ports or can run multiple services on 1 port. latter, see here . former, create multiple factories , call listenws multiple times.

ruby on rails - Why isn't my view variable interpolated inside brackets? -

i have code inside rails views/comments/_comments partial: <%= render :partial => 'comments/#{@type}' %> also, passing @type variable through local get: missing partial comments/#{@type} it works if replace following: <%= render :partial => 'comments/post' %> so @type not evaluated inside views. can explain that? string interpolation in ruby works strings defined double quotation marks ("). should work: <%= render :partial => "comments/#{@type}" %> or shorthand applicable if want interpolate value of instance variable: <%= render :partial => "comments/#@type" %>

python - Create a list of integer elements from list of objects -

i need create list of non-duplicated integer elements list of objects. for example: there object 2 attributes: 'id' , 'other_id': first = [elem.id elem in objects_list] second = [elem.other_id elem in objects_list] print first [0,1,2,3,4,5] print second [4,5,6,7,9] now can create 2 list containing 2 attributes objects this: first = [elem.id elem in objects_list] first.extend(elem.other_id elem in objects_list if elem.other_id not in first) print first [0,1,2,3,4,5,6,7,9] is there way in shorter way? use set : sorted(set().union(first, second)) #returns sorted list of unique items demo: >>> first = [0,1,2,3,4,5] >>> second = [4,5,6,7,9] >>> sorted(set(first + second)) [0, 1, 2, 3, 4, 5, 6, 7, 9] if original order matters: >>> first = [0,1,2,3,4,5] >>> seen = set(first) >>> first += [x x in second if x not in seen , not seen.add(x)] >>> first [0, 1, 2, 3, 4, 5, 6, 7, 9] for l

css - background-size doesn't work in IE -

this question has answer here: how make background-size work in ie? 8 answers i'm using class , id (for instance) add picture on 1 div : .icones { background: transparent url('../contents/homepage/60/icones.png') no-repeat; display: inline-block; width: 50px; height: 48px; background-size: 60px; } #contact { background-position: 0px -60px; } with chrome , ok, looks great , properties shown in element inspector , in ie , there problem. on inspecting page developper tool on ie , saw " background-size " doesn't appear. i know it's problem gives me trouble because when hide on chrome have same page in ie . so question is: how can force ie apply background-size ? thanks! edit : so filter, doesn't seems work: .icones { background: transparent url('../contents/homepage/60/icon

javascript - .join() function cant load and be defined in jQuery -

here url: http://itsun.ir/test/ first excuse bad english, want add drag , drop layout wordpress theme, seems good, when li element move other columns, javascript should make cookie , save new positions load in other time, doesn't work correctly, when open resources tab in inspect element in chrome browser , move , li sortable item column , in resources panel occurs error said : [uncaught typeerror : object # has no method 'join' ] , have updated jquery doesn't make correct, can me out writting in correct way ??? <script type="text/javascript"> $(document).ready(function(){ // items function getitems(id) { return $('#' + id + '-list').sortable('toarray').join(','); uncaught typeerror: object # has no method 'join' } // load items cookie function loaditemsfromcookie(name) { if ( $.cookie(name) != null ) { renderitems($.cookie(name),"wrapp"); } else {

android - Align div to page center with dynamic size -

i saw many example of how centerize div middle of page, in examples size of divs fixed. how put div in center of page unknown size of div height? (the gray div in middle) my code : <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <style> html,body{ margin: 0; padding: 0; border: 0; } body{ background-color: transparent; overflow: hidden; font-family: "helvetica" ; color: #359115; font-weight:bold; } #wrapper { position: absolute; width: 100%;

html - Menu falls apart in Wordpress template as soon as I link up the list elements -

i built little visual overview of lessons want integrate wordpress template. started out building thing first , got result looking , looks this: menu example now wanted integrate in wordpress template add link around list elements falls apart: overview fallen apart in theme if remove link tags stays in shape: --> click on "scrum lernen" on page above see example stays in shape without links. can post 2 links @ moment due lack of reputation. i have played around hours today in css , tried sorts of things trying rid of formatting may dictated template on links. however, couldn't working @ all. so, in original first link above core: html: <div class="lernlesson"> <ul> <a href=""><li>geschichte von scrum <img src="checkmark.png"/></li></a> <a href=""><li>das scrum-ger&#252st <span>open</span></li></a> <a

Heroku running rake error: /usr/bin/env: ruby.exe: No such file or directory -

i'm running windows , i'm trying run ' heroku run rake db:migrate ' newly created app on heroku. i following error: /usr/bin/env: ruby.exe: no such file or directory i've been searching online on hour, haven't been able find fix. suggestions highly appreciated!

c# - What is the best optimization technique for a wildcard search through 100,000 records in sql table -

i working on asp.net mvc application. application used 200 users. these users (every 5 mins) search item list of 100,000 items (this list going increase every month 1-2 %). list of 100,000 items stored in sql server table. the search wildcard search eg: select itemcode, itemname, itemdesc tblitems itemname '%searchword%' the searching needs fast since main business relies on searching , selecting item. i know how best performance. search results have come instantaneously. what have tried - i tried pre-loading entire 100,000 records memcache , reading memcache. trying avoid calls sql server every search. this takes lot of time. every time user searches item, retrieving 100,000 records memcache , doing search. taking 2-3 times more time direct sql searches. i tried doing direct search on sql server table limiting results 50 records @ time (using top 50) this seems ok still no-where near performance seeking i hear possible solutions , links articles

ios - Is there any limitations for number of NKAssetDownload -

i investigating newsstand kit. , wonder how many assets can add nkissue? there limitation or that? nkassetdownload *assetdownload = [nkissue addassetwithrequest:req]; currently there no limit mentioned in reference documents. so can add number of nkissue want.

wordpress - How to find out what level of hierarchy the current page is? -

on wordpress site, want display list of pages in current site section. needs different levels of pages depending on level in hierarchy current page resides. for instance: top level page: list shouldn't display @ all. second level page: list should display child pages of current page. third level page: list should display sibling pages , child pages. what simplist way find out level of heirarchy current page on? the simplest way i've found is: $level = count(get_post_ancestors( $post->id )) + 1; this gives number indicating depth of current page. 1 top level, 2 second level, etc. can switch code based on number such: switch($level) { case 1: // top level page code; break; case 2: // second level page code; break; case 3: // third level page code; break; // etc. }

sql server - How to remove the first character if it is a specific character in SQL -

i have table telephone has entries following: 9073456789101 +773456789101 0773456789101 what want remove 9 start of entries have 9 there leave others are. any appreciated. while other answer working, i'd suggest try , use stuff function replace part of string. update telephone set number = stuff(number,1,1,'') number '9%' sqlfiddle demo

asp classic - Passing a variable in ASP using reponse redirect -

i'm trying pass variable using response.redirect have page i'm processing info on contains: divrec = request.querystring("div") divstring = "divisions.asp?"&divrec response.redirect divstring but when try retrieve information in page using <% divrec = request.querystring("div") %> <% =divrec %> the variable/string not display i think missed querystring parameter in divstring variable. try this: divstring = "divisions.asp?div="&divrec you should able access parameter in receiving page now.

scala - akka cluster seed nodes give error: dropping message for non-local recipient -

i'm trying create basic akka cluster on win 7 machine documentation: http://doc.akka.io/docs/akka/snapshot/scala/cluster-usage.html and i'm getting error when run seed nodes (more on them below) adriansclustersystem-akka.actor.default-dispa tcher-16] [akka://adriansclustersystem/system/endpointmanager/reliableendpointwr iter-akka.tcp%3a%2f%2fadriansclustersystem%40127.0.0.1%3a2552-3/endpointwriter] dropping message [class akka.actor.selectchildname] non-local recipient [act or[akka.tcp://clustersystem@127.0.0.1:2552/]] arriving @ [akka.tcp://clustersys tem@127.0.0.1:2552] inbound addresses [akka.tcp://adriansclustersystem@127.0 .0.1:2552] question: why getting error? did miss akka documentation? my .conf file: added line *to file listed @ url above * enabled-transports = ["akka.remote.netty.tcp"] akka { actor { provider = "akka.cluster.clusteractorrefprovider" } remote { enabled-transports = ["akka.remote

devise - devise_for :users error in Rails 4 -

i have problem recent migration rails 3 app 4. have not seeing error on other applications upgraded. when starting server error. realised error appears while devise_for :users route present on routes.rb . any idea causing error , how fix it? /users/user/.rvm/gems/ruby-2.0.0-p247@mysite/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': rails::application::routesreloader#execute_if_updated delegated updater.execute_if_updated, updater nil: #<rails::application::routesreloader:0x007fc453039b10 @paths=["/users/user/sites/mysite/config/routes.rb"], @route_sets=[#<actiondispatch::routing::routeset:0x007fc4531562a0>]> (runtimeerror) /users/user/.rvm/gems/ruby-2.0.0-p247@mysite/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:6:in `execute_if_updated' /users/user/.rvm/gems/ruby-2.0.0-p247@mysite/gems/railties-4.0.0/lib/rails/application/finisher.rb:69:in `block in <module:finisher&g

excel - How to select range cell with VBA and align to top instead to the middle of the window? -

i created hiperlink, not working correctly. when vba executed, selected cell in middle of window, want align selected cell top left in window resolution. navigation on document. excel 2010. add following line of code after make cell hyperlink: application.goto cells(1,1),true replace cells(1,1) appropriate cell.

assembly - Format Raw Hdd in int 13 -

i want change file system of hard disk drive using assembly have found fixed disk format track in http://www.ctyme.com/intr/int-13.htm not understood. ;not succesful mov ax,0 mov es,ax mov ah,05h mov al,08h mov ch,01h mov dh,00h mov dl,80h mov bx,type int 13h cmp ah,00 jne error suc: ret error: hlt type: dw 00,00,08,03 i have tried example in os.it going halt when func. called. ?plase help..thanks.

mysql - Dropping database table -

while importing production data development database, went off , have 2 database tables similar, differing 1 contains db name table prefix. in case, have database rmstg , , 2 tables main_stratkeys rmstg.main_stratkeys how can drop latter table? drop table rmstg.main_stratkeys drops first table, not latter. drop table rmstg.rmstg.main_stratkeys returns sql syntax error inner .rmstg. declaration. try using backquotes: drop table `rmstg.main_stratkeys`; or drop table rmstg.`rmstg.main_stratkeys`;

Achieving a specific design goal with HTML and CSS -

Image
i have problem regards achieving specific design goal, , hope can me out here. i made picture in ps hope explains want: every part of picture should in individual tag (for example div), , placed this. logo should placed on top of big picture, little bit of space between edges. name placed on level bottom of picture or in middle (whatever looks best). the headline (new 911) placed along top of big picture, description in middle (always middle, length of text vary) , footer (info info) aligned bottom of picture. is me with? i have code, doesn't work planned. here's html: <div class="content"> <div class="left"> <div class="poster"> <div class="poster_img"> <img src="https://lh6.googleusercontent.com/-cc6wk7fox_g/aaaaaaaaaai/aaaaaaaaaaa/qq41pwu9uuq/s100-c-k/photo.jpg" height="50" /> </div> <div class="poster_name">pors

sharepoint - cannot display a button control in infopath form -

my problem that: when in create form infopath 2010 , add button control, button not appear when open in display mode. decide add button in ribbon sharepoint designer 2010 button appear in default display form. please need me solve problem. i'm new in sharepoint thank you are using stock button control built infopath? if not, button images need uploaded , checked in within sharepoint site. infopath forms should display stock buttons out of box no trouble.

jsp - Form Post Action Error in Eclipse -

i have 2 jsps .. first 1 register jsp i.e(register.jsp) resides in (main folder of webcontent) , other jsp i.e(register_worker.jsp in worker folder of webcontent) supposed act servlet or worker jsp. when click submit button shows error http status 404 - /learn-ui/jsp/main/register_worker.jsp type:status report message:/learn-ui/jsp/main/register_worker.jsp description:the requested resource not available. the form action posted below. <form id="form_register" name="form_register" method="post" action="register_worker.jsp"> the path of register.jsp isn't same register_worker.jsp . you'll need change path. work fine: <form id="form_register" name="form_register" method="post" action="../worker/register_worker.jsp">

javascript - Choose file window in extension firefox -

Image
iam building extension , want take path of file window popup windows . use in extension in firefox? you should check out this page on mdn creating file picker to begin, need create file picker component , initialize it. var nsifilepicker = components.interfaces.nsifilepicker; var fp = components.classes["@mozilla.org/filepicker;1"].createinstance(nsifilepicker); fp.init(window, "select file", nsifilepicker.modeopen); first, new file picker object created , stored in variable 'fp'. 'init' function used initialize file picker. function takes 3 arguments, window opening dialog, title of dialog , mode. mode here modeopen used open dialog. can use modegetfolder , modesave other 2 modes. these modes constants of nsifilepicker interface. getting selected file finally, can show dialog calling show() function. takes no arguments returns status code indicates user selected. note function not return until user

c# - Keypress event not working for a UserControl derived from textbox -

i have textbox placed on form. form shows in tabcontrol. tab control nested within panel. panel nested within tabcontrol. tabcontrol placed on form mdi child of main form. when tried type in textbox, no text appeared in textbox. debugged code. put break point on keypress event of textbox. realize program control not yet come. when tried use control directly on main form. worked. if understand problem. please give me valuable feed back.

Owncloud + Swift + Keystone -

i need information fast, please me. wanna know if can access openstack swift on owncloud applicaton using keystone method of authentication ? see if owncloud doc helps. http://doc.owncloud.org/server/5.0/admin_manual/configuration/custom_mount_config.html i advice @ owncloud discussion forum more help. good luck!!

c# - How to determine multiple checkboxes states -

ucmultiple uc = new ucmultiple(); //here ucmultiple user control contains checkbox string strtext; if (uc.checkbox1.checked == true) { strtext = checkbox1. text; } how know whether multiple check boxes checked if check boxes in user controls? to find out how many checkboxes checked can use uc.controls.oftype<checkbox>().where(x => x.checked).count(); if count greater 1 multiple checked.. if checking couple of checkboxes is better check them if(firstcheckbox.checked && secondcheckbox.checked)

java - Android Development : File is probably compressed -

this'll first post on so please gentle. i'm developing android app , attempting read .txt file in. after many seperate hurdles overcome (this first attempt @ reading in text file) i've come across rather nasty problem of throwing error message this file cannot opened file descriptor; compressed. assetmgr = thiscontext.getassets(); try { descriptor = assetmgr.openfd("level1.txt"); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } the above piece of code attempting read in text file. however, returning null descriptor causing errors further down line. inputstream = new filereader(descriptor.getfiledescriptor()); this line initialising inputstream parsing text file in loop i've created out of scope. so problem how fix txt file not opening correctly , apprarently being compressed. if have made errors in posting please let me know can correct them best possible advice! cheers! so problem

string - PYTHON several times print from a reference file -

i have question python programming. if have reference file (ref.txt) like 3 5 6 i want make output file if want 5 times these strings 3 5 6 3 5 6 3 5 6 3 5 6 3 5 6 total 15 rows. i have thought code like with open('ref.txt') f1, open('out.txt', 'w') f2: in range(1, 6): line in f1: value=line.split() line=' '.join(value) + '\n' f2.write(line) this code print original value. how print multiple repeat lines of reference value. thanks. repeat = "" open('ref.txt') f1: line in f1: repeat = "".join([repeat, line]) open('out.txt', 'w') f2: f2.write(repeat*5)

c# - Multiple ListViews sharing a ContextMenu, how can I reference the right object? -

i have many listviews, each bound own listcollectionview, each identical contextmenu needs. don't want repeat same contextmenu n times, define in resources , refer via staticresource. when item x in listview right clicked, , menuitem clicked, how can access object x in codebehind? <window.resources> <contextmenu x:key="commoncontextmenu"> <menuitem header="do stuff" click="dostuff_click" /> </contextmenu> </window.resources> <listview itemssource="{binding path=listcollectionview1}" contextmenu="{staticresource commoncontextmenu}"> ... </listview> <listview itemssource="{binding path=listcollectionview2}" contextmenu="{staticresource commoncontextmenu}"> ... </listview> private void dostuff_click(object sender, routedeventargs e) { // how selected item of right listview? } update thanks michael gunter's answer, u

javascript - How does jquery proxy work -

i more curious else. how pass context function. wrap function in object? sure there simple straightforward code doing in js without jquery proxy function abc(){ console.log(this.name); } var obj={name:"something"}; $.proxy(abc,obj); how can without jquery proxy? without jquery may use bind : var newfunction = abc.bind(obj); and if want compatible ie8, may do var newfunction = function(){ abc.call(obj) }; here's how jquery : // bind function context, optionally partially applying // arguments. proxy: function( fn, context ) { var args, proxy, tmp; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // quick check determine if target callable, in spec // throws typeerror, return undefined. if ( !jquery.isfunction( fn ) ) { return undefined; } // simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { r

python - Pandas: Looking up the list of sheets in an excel file -

the new version of pandas uses the following interface load excel files: read_excel('path_to_file.xls', 'sheet1', index_col=none, na_values=['na']) but if don't know sheets available? for example, working excel files following sheets data 1, data 2 ..., data n, foo, bar but don't know n priori. is there way list of sheets excel document in pandas? you can still use excelfile class (and sheet_names attribute): xl = pd.excelfile('foo.xls') xl.sheet_names # see sheet names xl.parse(sheet_name) # read specific sheet dataframe see docs parse more options...

oracle - SQL get group value only if parameters exist in entire group values -

i have problem solve in oracle sql. given table below, query pass list names , if represent single animal group, return animal string. +------+------+ |animal|name | +------+------+ |dog |lacy | |dog |champ | |dog |buddy | |cat |muffin| |cat |champ | |fish |wanda | +------+------+ for example when pass it: name in ('champ', 'muffin') returns: +------+ |animal| +------+ |cat | +------+ but if pass it: name in ('champ', 'wanda') returns: +------+ |animal| +------+ |fish | +------+ because parameters did not contain of cat names, did within contain of fish names. last example: name in ('champ', 'wanda', 'lacy', 'muffin') returns +------+ |animal| +------+ |cat | |fish | +------+ i think want: select animal t name in ('champ', 'wanda', 'lacy', 'muffin') group animal having count(*) = (select count(*) t t2 t2.animal = t.an

html - PHP - Redirecting to previous page after logging in AND INCLUDING GET DATA -

okay first off, sorry if duplicate. i've searched around 20 minutes on stack overflow , internet, , can't seem find solution problem. what i'm trying do: i have login form on every page, hidden input containing current page user on - when login, redirects page on. e.g. user on news.php , not logged in. login, takes them login.php verify data, redirects news.php this works great! the problem: if there data or anchor tags @ end of url, can't seem redirect that. e.g. user on news.php?id=4#comments , not logged in. login, etc etc, redirects news.php , ignores trailing data. anyone have here? my code: <input type="hidden" value="<?php echo $_server['http_referer']; ?>" name="location" /> $previouspage = $_post['location']; header("refresh: 1; url=".$previouspage); obviously think issue $_server['http_referer'] part, i'm not sure replace make include trailing data. all

algorithm - Rails 3 multiple keywords filtering query -

i writing filtering algorithm takes user input array of keywords, @keywords = ['news', 'tv show', 'games', 'it'] and query table, example, videos table in database. there's string field in table includes couple of tags delimited comma. video instance, if tags field includes one(or more) of keywords, should returned. started @videos = [] @keywords.each |word| @videos.push(video.where('tags ?', '%#{word}%')) end @videos = @videos.flatten then found, first, it'll include duplicated videos, , second, queries database many times length of keywords not efficient @ all. any suggestions improve this? this if need like clause: @videos = video.where( (@keywords.map { |kw| "tags \'%#{kw}%\'" }).join(" or ") ) probably not ruby-esque, straight forward.

javascript - How to return the height of a div in pixels? -

this question has answer here: how height of <div> in px dimension 3 answers is there function return pixel height of div? want add images side of said div based on size of div (which dependent on user's content, , change size of div) thanks! document.getelementbyid('divid').offsetheight should give height.

how to get the path of the image(.png) file that is stored in assets folder in android -

i have few images in assets folder want retrieve path of each image file , copy them array , set image view condition. have used below code.but did not workout me. may know going wrong. final uri assets_uri = uri.parse("file:///android_asset"); final string[] image_ids =new string[] {assets_uri+"/"+"one.png",assets_uri+"/"+"two.png",assets_uri+"/"+"three.png"}; iv=(imageview)findviewbyid(r.id.iv); if(i>=0 & i< image_ids.length-1) i=i+1; else if(i==image_ids.length-1) i=0; iv.setimageuri(uri.parse(image_ids[i])); try change : final uri assets_uri = uri.parse("file:///android_asset"); to this: final string assets_uri = "file:///android_asset"; i think problem concatenating , uri string. if declare assets_uri string string , later parsed uri.

objective c - Add multiple objects to NSMutableArray from file list -

i having picker view selecting states(or prefectures europe).the current method using populate picker view following: in viewdidload _arrayno = [[nsmutablearray alloc] init]; [_arrayno addobject:@" al "]; [_arrayno addobject:@" ak "]; [_arrayno addobject:@" az "]; [_arrayno addobject:@" other "]; and usual pickerview delegate , datasource. above code don't have issues. apparantly if want add many states/town(let't on 100) array method become hard maintain. my question can load states array list in file resides inside supporting files folder? example file containing: al ak az ar ca ... wi wv wi other thanks in advance. you can have .plist file list , load plist file root dictionary keys/values array.

javascript - using $.post() within a loop -

i may doing silly here. user can have multiple "sites" , each site have run calculations come total. have php page these calculations can call calculate.php . returns string ex: 50 parse float in js. here's i'm trying do: total of of numbers outputted calculate.php. my idea loop through sites, $.post() calculate.php within every iteration (other things being done in loop, less important) , add variable in callback function. believe problem $.post() async... here sample code: function systems(sitelist){ var runningtotal = 0; (var ii=0,i<sitelist.length,i++){ $.post("calculate.php",{foo:sitelist[ii]},function(data){ // important part runningtotal = runningtotal + data }) } //outside loop alert(runningtotal) } this function may imperfect, real question how can achieve result i'm looking here? know, runningtotal alerts 0 above code. thanks edit: help. can see, not wise of me using

jquery - Custom Google place search returns error with $.ajax() -

i working on google places https://developers.google.com/places/documentation/search after adding api key url https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key= gives me pretty fine json response in browser.but whenever want parse these response jquery.ajax() gives me error. i cant find reason behind error.how can solve these problem?thanks. js: <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=true&libraries=places"></script> <script type="text/javascript"> $(document).ready(function() { $("#submit").click(function(event){ var url="https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&r

c++ - How to approach implenting a class's methods when these methods depend on another class? -

i'm not sure have terminology straight able describe question, here's how i'll describe i'm wondering: suppose have class a, , second class b uses data in methods class { data1 data2 etc... } class b { some_data method1 { // stuff some_data , a.data1, a.data2 } method2 { // other stuff some_data , a.data1, a.data2 } } what i'm curious is, whether generality, considered better like: 1. class b { b(a *a) { this->a_ptr = a; } *a_ptr some_data method1() { // stuff a_ptr->data1, a_ptr->data2 } method2() { // other stuff a_ptr->data1, a_ptr->data2 } } versus 2. class b { some_data method1(a *a) { // stuff a->data1, a->data2 } method2(

.htaccess - Symfony 2 404 Custom page for missing resource -

so, have been trying add 404 controller in case image missing , need go , it. initially, tried notfoundhttpexception/resourcenotfoundexception listener loaded class deal it. worked great, if symfony2 routing issue. problem is, isn't. /web/bundles/mysite/images/missingimage.jpg 404, handled apache seems. so .htaccess tried: <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri}::$1 ^(/.+)/(.*)::\2$ rewriterule ^(.*) - [e=base:%1] rewritecond %{env:redirect_status} ^$ rewriterule ^app\.php(/(.*)|$) %{env:base}/$2 [r=301,l] rewritecond %{request_filename} -f rewriterule .? - [l] rewriterule .? %{env:base}/app.php [l] errordocument 404 /web/404.txt </ifmodule> just see if work, feeling wouldn't , didn't. so how can setup forward symfony2 page when encounters 404 within /web folder. i guessing should .htaccess, not having look. in end, want go to: /web/app.php/fourzerofourhandler/web/bundles

java - How to perform action on OK of JOptionPane.showMessageDialog -

i working on first desktop based java project. have 2 questions actually 1) how perform action on ok button of joptionpane.showmessagedialog.i want navigate new jframe x.java on clicking ok. 2) have table named user. table has 8 columns userid (primary key), name, password,emailid, dob, mobileno ,city, date. 4 column entries has fetched jframe x , remaining 4 other jframe y. i wrote following code for frame x preparedstatement stm = con.preparestatement("insert user (userrid,name,password,emailid))values (?,?,?,?) "); stm.setstring(1,id); // id public variable stm.setstring(2,name); stm.setstring(3,ps); stm.setstring(4,email); stm.executeupdate(); and frame y. (userid primary key) public class y extends javax.swing.jframe { x o = new x(); // access id variable frame x } preparedstatement stm = con.preparestatement(" update user set dob ='? ', mobileno ='?' ,city='?', date='?'

php - twitter api 1.1 - returning NULL -

i trying use twitters api in order retrieve list of hashtagged results - used quite easy because no need authentication become tricky me... i have followed post https://stackoverflow.com/questions/12916539/simplest-php-example-for-retrieving-user-timeline-with-twitter-api-version-1-1/15314662# = but when load page displays null - sure have done every thing correct notice - php file below in same directory file twitterapiexchange help appreciated thanx <?php ini_set('display_errors', 1); require_once('twitterapiexchange.php'); /** set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "xxxxx", 'oauth_access_token_secret' => "xxxxx", 'consumer_key' => "xxxxx", 'consumer_secret' => "xxxxx" ); $url = 'https://api.twitter.com/1.1/statuses/user_timeline.json'; $getfield = '?screen_name=j7mbo'