Posts

Showing posts from August, 2011

jquery - Reduce pixels and size maintaining full image -

jquery - Reduce pixels and size maintaining full image - i had made profile page , working perfectly. problem when setting profile image big size( eg: 2950px x 2904px ) jquery becomes slow(that animation) , css hover motion of mouse pointer normal. can suggest solution create jquery speed normal. is there anyway maintain same pixels , load jquery same speed? i tried image less size( eg: 130kb ) same pixels no luck! thanks in advance. you should have server-side image processing scheme generates profile image size, regardless of dimensions of image user uploads. serve-up resized image, not 1 uploaded user. jquery performance

Python wont define function -

Python wont define function - i getting python , i'm having basic issue.... my source has following... def calrounds(rounds): print rounds when run through shell , seek phone call calrounds(3) get.. traceback (most recent phone call last): file "<pyshell#1>", line 1, in <module> calrounds(3) nameerror: name 'calrounds' not defined its been awhile since i've used python, humour me. did import source first? python

what does % do in javascript -

what does % do in javascript - this question has reply here: what % in javascript? 6 answers i'm trying convert javascript code java not know % character between 2 numeric variables does: testvalue= somevalue%anothervalue; what mean or same statement in java? i have in javascript if(somevalue%2==1){ } what %2 mean here? it's modulus operator. returns "the first operand modulo sec operand", remainder when substract (or add) much of sec operand off/to of first, close possible 0. for example: 5 % 2 == 1 ( 5 = 2*2 +1) 6 % 2 == 0 ( 6 = 2*3 +0) 1 % 5 == 2 ( 12 = 5*2 +2) -5 % 2 == -1 (-5 = 2*-2 -1) -6 % 2 == 0 (-6 = 2*-3 -0) -12 % 5 == -2 (-12 = 5*-2 -2) // ^ that's result of modulo. javascript

javascript - How to find all the items that are not numbers in MongoDB collection? -

javascript - How to find all the items that are not numbers in MongoDB collection? - i have field in mongodb database contains numbers, nulls, strings, etc well. how can find() these records? i'm not sure understand question fully. want numbers or non-numbers? anyway, here how can either: the numbers: db.stuff.find({my_field: { $type: 1 }}) the others db.stuff.find({my_field: { $not: {$type: 1 }}}) javascript mongodb mongodb-query

c# - Threadsafe class to send messages through socket -

c# - Threadsafe class to send messages through socket - i'm trying implement module sends messages server via socket. used in multi threaded environment, "client" object shared among threads. question should utilize lock block int send method create class threadsafe? (probably yes, saw lot of sample codes, there isn't locking.) here simplified version of messengerclient class. public class messengerclient { private socket socket; public messengerclient() { socket = new socket(sockettype.stream, protocoltype.ipv4); } public void connect(string host, int port) { socket.connect(host, port); } public void sendmessage(imessage message) { var buffer = objectconverter.converttobytearray(message); var args = new socketasynceventargs(); args.completed += args_completed; args.setbuffer(buffer, 0, buffer.length); //lock (socket) //{ socket.sendasync(ar...

python - Matplotlib legend error under Ubuntu (but not on windows vista) -

python - Matplotlib legend error under Ubuntu (but not on windows vista) - i have python programme using matplotlib runs nicely under windows vista under ubuntu next error: traceback (most recent phone call last): file "main.py", line 175, in my_measure self.widget.canvas.ax.legend(loc = 'center left', bbox_to_anchor = (2.2, 0.5), ncol = 1, fontsize = 10) # defining legend properties, such positioning , labels fontsize file "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 4519, in legend self.legend_ = mlegend.legend(self, handles, labels, **kwargs) typeerror: __init__() got unexpected keyword argument 'fontsize' i don't understand why 'fontsize' became unexpected keyword argument. can help? thanks python python-2.7 matplotlib ubuntu-12.04

C# declare variable into if statement -

C# declare variable into if statement - i want using c# : if (i == 0) { button = new button(); } else { textblock = new textblock(); } mainpage.children.add(a); but error error 1 name 'a' not exist in current context any ideas ? thank in advance ! you need mutual base of operations class both button , textblock derive from, , needs declared outside of if statement if it's accessed after if complete. control maybe? control a; if (i == 0) { = new button(); } else { = new textblock(); } mainpage.children.add(a); not knowing specific command toolkit you're using (wpf maybe?) can't advise further. i'd @ signature add clue - what's parameter declared as? c# variables if-statement

Drupal 7: filtering menu links -

Drupal 7: filtering menu links - i've created site have run problem navigation bar. problem want able filter out displaying links. this because part of site makes utilize of books. part of site allows user selection of 4 links link 4 different books , can progress through books expect. currently, link each page shown @ bottom of page. filter these links shows rel event links user, e.g. if on book1 shouldn't show links book 2 , 3 , children pages does. any ideas? i think have used menu module create links. if utilize book module ( in core need enable it). help create hierarchical menu in requirement. menu created book module looks 1 on this page ( the relevant navigation menu ). update: book navigation creates own menu on relevant book pages. , context sensitive. can see above example, depending on page viewing, displays sibling menu ( i.e. pages on same level current 1 ). , next , previous buttons along go 1 level links. i suggest in main menu create...

php - WHERE doesn't recognize and INSERT throws unique exception -

php - WHERE doesn't recognize and INSERT throws unique exception - i read of answers here , "mind-locked". new , don't work @ this, taught myself on lastly 43 years. converted piece of code nail counter wrote other day, , counts number of times ip runs denied access page. code checks see if ip in database table (unique). if is, increments , updates. if isn't there, inserts value of 1. all well, noticed no increment when testing. isolated , found won't recognize table column value update it, , throws exception when tries insert new value because unique. i have looked , looked , cannot seem understand why works fine in hitcounter, fails miserably here?!? $ip = $_server['remote_addr']; $ip = preg_replace('#[^0-9\.]#','',$ip); $db_table = 'deniedcounter'; echo 'enter denied_record.php<br />'; //$ip = str_replace('.','x',$ip); function setdeniedcounter($ip, $db_handle, $db_table){ ...

html - Center logo with main menu appearing on each side -

html - Center logo with main menu appearing on each side - i center logo , have main menu appear on each side of logo, have no clue on how that, have create 2 separate menus accomplish layout? any advice much appreciated. thank you! <header class="remove-padding"> <div class="container"> <div id="header" class="row"> <div class="four columns"> <div id="logo"> <img src=img/inf-logo1.png" alt="test site" /> </a> <p class="slogan">ink addiction</p> </div> </div> <div class="eight columns"> <div id="headerwidgets"> </div> <nav id="nav-main...

Trouble with while loop in python function -

Trouble with while loop in python function - i have little app asks movie. when rating on 50, homecoming watch it. if doesn't, take movie. though when status in moviedec, won't go top of function calculate score of movie. can't figure 1 out. def getscore(): take = raw_input("pick film ") rt = rt() info = rt.search(choose) rating1 = info[0].get('ratings').get('critics_score') rating2 = info[0].get('ratings').get('audience_score') stars = (rating1 + rating2) / 2 homecoming rating1, rating2, stars def moviedec(): critic, aud, stars = getscore() print 'critics gave %s' %critic print 'audiences gave %s' %aud print 'the average rating %s' %stars while stars < 50: print "that's no good, pick again" getscore() print 'good choice.' you not updating stars variable in loop. try: while stars < 50: print ...

node.js, need help to fix this bug "TypeError: object is not a function" -

node.js, need help to fix this bug "TypeError: object is not a function" - i learning node.js. trying demos on cloud9. demo simple, 2 js files. checked line line, seems fine. please help me debug it. resource.js file. var util = require('util'); var eventemitter = require('events').eventemitter; function resource(m){ var maxevents = m; var self = this; process.nexttick(function(){ var count = 0; self.emit('start'); var t = setinterval(function(){ self.emit('data', ++count); if(count === maxevents){ self.emit('end', count); clearinterval(t); } }, 10); }); }; util.inherits(resource, eventemitter); 7-extemitter.js var resource = require('./resource...

Rails gem ckeditor loading custom config.js before it's own config -

Rails gem ckeditor loading custom config.js before it's own config - i've installed ckeditor gem , working except custom toolbar definition. i'm working in development environment. checking inspector in chrome see custom.js file beingness requested before ckeditor gem's config , result beingness overwritten. think found crappy solution here, wondering if else has found improve solution. here sample of current application.js config: //= require jquery //= require jquery_ujs //= require jquery-ui //= require ckeditor/init //= require_tree ./ckeditor //= require_directory . i have config.js file nested in assets-javascripts-ckeditor. using parameter :ckeditor => {:uicolor => "#d6a11a", :toolbar => "admin"} in cktext_area form method. know beingness read because uicolor changes accordingly. i never figured 1 out. upgrading latest version of ckeditor-rails gem , next of installation instructions letter has fixed issue. a...

postgresql - How Do I Use Joins for Three Tables in Ruby on Rails? -

postgresql - How Do I Use Joins for Three Tables in Ruby on Rails? - i working on ruby on rails application has logic text searching using pg_search , 2 other fields on model. logic creates 'array' of rows search result. not remember actual name of since technically not array. instance variable of selected rows. want add together search criteria 2 additional models. database postgresql. here subset of 3 model definitions: medialibrary: name, media_creator_id, media_type_id (fields beingness used in current search; has many media_topics , has many media_targets) mediatopic: media_library_id, topic_id (want search topic_id; belongs media_library; topic_id beingness searched coming topic model (id, name)) mediatarget: media_library_id, target_id (want search target_id; belongs media_library; target_id beingness searched coming target model (id, name)) i'm thinking should able if both topic , target beingness searched along other 3 search criteria. nee...

html - how to show data on textview in android with color? -

html - how to show <span color=#f00000;> data on textview in android with color? - actually problem have info comes webservice,i parse info , fill in sqlite databases rows.the info contain html tags android not back upwards > <span style="color:#ff0000;">the lord creator <span>; so "the lord creator" shown in reddish color.like have textviews in listview in android.the html.fromhtml not working. any help appriciated. html.fromhtml(); this function returns spanned object wich can set text textview. android html webview

c# - How to save value in session in .net -

c# - How to save value in session in .net - i trying save value in session in webservice gives me error: object reference not set instance of object . session["processstarttime"] = strdate; add (enablesession = true) webmethod [webmethod (enablesession = true)] or read nice article on how utilize session state in web service c# web-services

javascript - Set the background in canvas using layer (zIndex) -

javascript - Set the background in canvas using layer (zIndex) - i need background on canvas using layers. variable it's background. know should utilize css , set z-index, not know how in case. js: function dofirst(){ var x = document.getelementbyid('canvas'); canvas = x.getcontext('2d'); var item1 = new image(); item1.src = "images/sheep.png"; item1.addeventlistener("load", function() { canvas.drawimage(item1,20,300)}, false); var item2 = new image(); item2.src = "images/tshirt.png"; item2.addeventlistener("load", function() { canvas.drawimage(item2,300,300)}, false); var background = new image(); background.src = "images/background.png"; background.addeventlistener("load", function() { canvas.drawimage(background,0,0,1024,768)}, false); } html: <canvas id="canvas" width="1024" height="768"> the canvas element not designed address layer...

How to save a third value in each ListItem of an ASP.NET dropdownlist? -

How to save a third value in each ListItem of an ASP.NET dropdownlist? - each listitem in asp.net has value property , text property. need have 3rd value saved also. hack concatenate special separator , 3rd value value property. using findbyvalue method makes cumbersome. is there improve way save 3rd value or way utilize findbyvalue. (i can't utilize findbytext). wish there tag property. if using binded dropdownlist , defined datatextfield , datavaluefield properties, there's not way save 3rd value on dropdownlist itself. save separately tho. if you're defining dropdownlist through markup, seek defining custom attribute: <asp:dropdownlist id="ddldummy" runat="server"> <asp:listitem text="x" value="y" thirdvalue="z" /> </asp:dropdownlist> for retrieving it, utilize findbyvalue , thirdvalue attribute listitem: listitem item = ddldummy.items.findbyvalue("y")...

Deploying IOS App to customer using Enterprise Developers Account -

Deploying IOS App to customer using Enterprise Developers Account - i have issue regarding distributing ios app our client using enterprise developers account. client doesn't want share enterprise business relationship me have own enterprise developers account. can utilize own enterprise business relationship distribute apps customer? there alternative solutions? thanks , regards, r e x if possible , client willing, sit down downwards them or via skype screen sharing , show them how create necessary certificates , distribution profiles in provisioning portal. if have technical expertise can themselves. can build app using enterprise account. your client may skeptical handing business relationship details you. ios enterprise account

sql - Select one distinct row based on a case statement applied to a column -

sql - Select one distinct row based on a case statement applied to a column - i'm unable figure out sql query (using ms sql server). i'm trying retrieve single row dataset in item 1 id can have more 1 row. part throwing me off right row should based on "hierarchy". have trying throw case statement @ problem. some sample data: id class date 100 reddish 2012-12-12 100 bluish 2012-12-31 200 reddish 2012-10-31 300 greenish 2012-04-04 300 bluish 2011-09-01 i want homecoming single row based on value of class. case when reddish date case when bluish date case when greenish date else '' my final dataset should this: id class date 100 reddish 2012-12-12 200 reddish 2012-10-31 300 bluish 2011-09-01 so, if 1 of duplicate rows has value of red, utilize ...

hadoop - How to count the number of unique users with PIG -

hadoop - How to count the number of unique users with PIG - the next piece of code doesn't homecoming trying compute; number of unique users. idea? data = load 'input_initial' (user_id,item_id,rating,timestamp); info = foreach info generate user_id,item_id; store info 'input_final'; data_users = foreach info generate user_id; group_users = grouping data_users user_id; count_users = foreach group_users generate count(data_users); store count_users 'count_users'; you need amend final grouping operation deed on 'all' rather individual field: group_users = grouping data_users user_id; grp_all = grouping group_users all; count_users = foreach grp_all generate count(group_users); hadoop apache-pig

sql - Getting Count and Rows in same query -

sql - Getting Count and Rows in same query - is possible total table count , rows in same query. this select count(1),* tbl grouping you can seek this: select count(*) on (), (list of other columns here) dbo.yourtablenamehere the over() clause give count of rows right in query. sql sql-server-2008

MVVM Light assembly conflict with Microsoft.Practices.ServiceLocation -

MVVM Light assembly conflict with Microsoft.Practices.ServiceLocation - i've got issue wpf application cannot published clickonce. the application uses nuget packages mvvm lite 4.1.26.1, unity 2.1.505.2, commonservicelocator 1.0. the problem when publish, build fine, error when seek , install clickonce package: unable install or run application. application requires assembly microsoft.practices.servicelocation version 1.0.0.0 installed global assembly cache (gac) first. i did digging , saw there 2 references assembly in manifest, , 1 of them marked prerequisite can't rid of: <dependency> <dependentassembly dependencytype="prerequisite" allowdelayedbinding="true"> <assemblyidentity name="microsoft.practices.servicelocation" version="1.0.0.0" publickeytoken="59d6d24383174ac4" language="neutral" processorarchitecture="msil" /> </dependentassembly> </de...

php - If row empty, echo default text, else echo display data -

php - If row empty, echo default text, else echo display data - i display "not provided" if addition_1 empty in database , if not empty in database display data? i've tried several combination , can't see figure out missing. <?php if (empty($row[addition_1])) { echo "not provided"; } else { echo $row[addition_1]; } ?> try adding quotes array key, change: $row[addition_1] to $row['addition_1'] php mysql

oracle - Create temporary TABLE inside a FUNCTION -

oracle - Create temporary TABLE inside a FUNCTION - this question has reply here: how create , utilize temporary table in oracle stored procedure? 4 answers how can create temporary table can homecoming when function called? see one: create or replace procedure maketemptab sqlstmt varchar2(500); begin sqlstmt := 'create global temporary table(col1 varchar2(10))'; execute immediate sqlstmt; end; oracle function plsql temp-tables

python - How can I select random characters in a pythonic way? -

python - How can I select random characters in a pythonic way? - this question has reply here: generate random letter in python 8 answers i want generate 10 alphanumeric character long string in python . here 1 part of selecting random index list of alphanumeric chars. my plan : set_list = ['a','b','c' ........] # way till finish [a-za-z0-9] index = random() # utilize python's random generator some_char = setlist[index] is there improve way of choosing character randomly ? the usual way random.choice() >>> import string >>> import random >>> random.choice(string.ascii_letters + string.digits) 'v' python random

iphone - Xcode Allocations Instrument - Listening to Memory Warnings -

iphone - Xcode Allocations Instrument - Listening to Memory Warnings - i using allocations instrument enhance performance of app. want pay attending memorywarnings create sure app doesn't utilize much memory or crash. i entire app hear memorywarings. know can utilize hear warnings, code below hear everything? also, need implement it? need set in each view controller or can set in app delegate? - (id)init { if ((self = [super init])) { _cache = [nsmutabledictionary new]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(memorywarning:) name:uiapplicationdidreceivememorywarningnotification object:nil]; } homecoming self; } i know need implement method listens memorywarnings. hear memorywarnings? also, need place in every viewcontroller? or can place somehow in appdelegate? - (void)memorywarning:(nsnotification*)note { [_cache removeallobjects]; } any guidance great! give thanks you! your view...

java - Jackson annotation or method to URL encode/decode during serialization? -

java - Jackson annotation or method to URL encode/decode during serialization? - i'm wondering if there's easy way url encode/decode when serializing , deserializing objects in jackson. reason ensure incoming fields going indexed in riak not contain illegal characters. for illustration have next class (in scala): case class client( @(jsonproperty@field)("guid") @(riakkey@field) val guid: string, @(jsonproperty@field)("name") @(riakindex@field)(name = "name") val name: string, @(jsonproperty@field)("address") val address: string, @(jsonproperty@field)("contact") val contact: string, @(jsonproperty@field)("phone") @(riakindex@field)(name = "phone") val phone: string, @(jsonproperty@field)("suspended") val suspended: boolean=false, @(jsonproperty@field)("created") val created: date=now, @(jsonproperty@field)("updated")...

c# - update status text without page reload -

c# - update status text without page reload - i have web app! set status text users shown below profile image of user. whenever user updates status text, page reloads on button click, , new status appears below picture. there way prevent page reloading , still create status text changed? on submit, new status text inserted/updated database table , on page load, fetched. you can utilize ajax, place update button , status textbox within ajaxupdatepanel if it's not possible add together both (update button , status textbox) single ajaxupdatepanel (as html design), add together 2 different ajax updatepanels (to update button , status textbox) , phone call yourstatusupdatepanelname.update(); update button click event c# asp.net visual-studio-2010 sql-server-2008

java - Hibernate Update Query issue -

java - Hibernate Update Query issue - for update query update testdb.dbo.myemp set empname=? empid=? i wrote in dao class myemployee myemployee = new myemployee(); myemployee myemployee =(myemployee )session.load(myemployee.class, new integer(1700)); myemployee.setname("updatedname"); session.update(myemployee ); its working fine, need know type of update query mentioned in below update testdb.dbo.myemp set empsalary=? empid=? && empname = ? (i.e., need update table using 2 conditions in clause , can done hql , want know how can implement using saveorupdate method..) how can update using update or saveorupdate method()? whether possible in hibernate ? you must fetch object first, in 2 ways: 1- hql query query = session.createquery("from myemployee e e.id = ? , e.name = ?"); query.setparameter(0, 1); query.setparameter(1, "myname"); myemployee e = (myemployee) query.uniqueresult(); e.setsalary(5000); session...

apache - .htaccess custom redirect -

apache - .htaccess custom redirect - i want able have links on site mail/asdassda2131dfdsfdsds actually show : /index.php?option=com_loans&view=mail&guid=asdassda2131dfdsfdsds using htaccess without seeing latter url (ie mail/asdassda2131dfdsfdsds remains in address bar) anyone ? tnx sc add below rewrite rule .htaccess rewriterule ^mail/ (.*)$ index.php?option=com_loans&view=mail&guid=$1 [r=301,l] apache .htaccess redirect

linux - Parsing XML - Subtracting values from tags -

linux - Parsing XML - Subtracting values from tags - i have next xml construction in big file: <sit>619709.6044;144998.7059;-090372.58119</sit> <vll>0;0;0</vll> <cor>255;0;255</cor> how subtract values in sit tag? tag comprised of 3 values separated ; each has subtracted specific number. any unix tool can used. (awk,sed,bc,etc) so if specific number 1000 first value, 100 sec value , 10 3rd value result be: <sit>618709;144898;-090362</sit> <vll>0;0;0</vll> <cor>255;0;255</cor> no need maintain fractions. here's 1 way using awk . run like: awk -v a=1000 -v b=100 -v c=10 -f "[<;>]" -v ofs=";" -f ./script.awk file contents of script.awk : /^<sit>/ && /<\/sit>$/ { $0 = "<sit>" format($3, a) ofs format($4, b) ofs format($5, c) "</sit>" }1 function format(field, var) { f = sub(/^-/, "...

mysql - sql - select amount from each type -

mysql - sql - select amount from each type - i want select 10 names table "games" each game type. for example: 10 rpg games, 10 action games, 10 mmo games... the problem query take lot of resources, wondering if has thought write query in improve way: select name games thisgame (select count(1) games games.game_id = thisgame.game_id , games.type > thisgame.type) <= 9 one way fast variable trick. relies on mysql specific syntax imitate window function. example, retrieve 2 games per type: select s.name , s.type ( select * , (@rn := if(@cur=type, @rn+1, 1)) rn , @cur := type games bring together (select @cur := '') order type ) s rn <= 2 live illustration @ sql fiddle. mysql sql resources

php - Missing digits in magento Price on frontend -

php - Missing digits in magento Price on frontend - im using next code include cost products on custom page: <?php echo mage::helper('tax')->getprice($_product, $_product->getfinalprice(), null);?> the cost shows on frontend should apart under 1 instance. beingness if product cost ends in 0 (or 2) within decimal places illustration cost of £3.00 displayed £3, £3.50 displayed £3.5 & £3.99 display is. is there improve way me pull product price? the cost should called float, perhaps it's info conversion issue db? can forcefulness column float field db stores 2 decimal places well? maybe create float(7,2)? php magento

android - Can I notify when any bluetooth of paired device is enabled? -

android - Can I notify when any bluetooth of paired device is enabled? - hi working embedded bluetooth device connection android application. my application installed in android phone , phone has paired bluetooth devices, want if paired bluetooth device enabled(starts/turns on) application should receive notification. of-course bluetooth enabled in phone , bluetooth devices within range. please allow me know how possible ? thanks! there nil automatic can observe this, have create both app , paired device work observe this. tyhere 2 options : your app periodic device discovery (low frequency - else kill battery) search paired devices in vicinity. paired devices on getting enabled / starting on should set discoverable. a improve way apired device autimaically initiate connection 1 time comes on device paired with, , typically on phones default if bluetooth turned on scanning incoming connection , app can ready take incoming connections. android blu...

Why django is stuck with jQuery 1.4? -

Why django is stuck with jQuery 1.4? - i have next problem. quite django admin plugins include own version of jquery , not possible utilize them together. example: django-markitup , django-sortable. there way around issue? need rewrite plugin(s) utilize noconflict? i understand why developers plug in latest jquery version, why django stuck jquery 1.4? this isn't big of problem django's bundled jquery namespaced: to avoid conflicts user-supplied scripts or libraries, django’s jquery (version 1.4.2) namespaced django.jquery. if want utilize jquery in own admin javascript without including sec copy, can utilize django.jquery object on changelist , add/edit views. the above taken admin documentation. jquery django django-admin

android - Want to copy SQL Database info and paste into new Activity -

android - Want to copy SQL Database info and paste into new Activity - i have 2 activities. 1 shows user database info particular entry, , there can take edit entry. i want add together feature of copying existing info , starting new entry old info wont have input same info again. i have tried using sharedprefs got nowhere. here can shed lite on proper coding etiquette. i'll best detailed in description this code start whole new entry..... public boolean onoptionsitemselected(menuitem item) { intent addcontact = new intent(crlist.this, craetune.class); startactivity(addcontact); homecoming super.onoptionsitemselected(item); } then class edit new entry , code i'm using save it... private void savecontact() { crdbcon dbconnector = new crdbcon(this); if (getintent().getextras() == null) { dbconnector.insertcontact( caret.gettext().tostring(),//1 ...

python - ipdb requires Ctrl+D for processing command -

python - ipdb requires Ctrl+D for processing command - i debugging python scripts ipdb. somehow have problem, after entering command, instance n, s, c, b etc. have press ctrl+d 2 times in order ipdb process command , proceed. any thought causes , how can turn off? this effect not isolated ipdb: technically ctrl-d terminates transmission, , raises eof if results in empty input buffer. happens when press ctrl-d before inputting characters. do experiment: 1. @ linux terminal type cat 2. press come in once. 3. come in letters: foo 4. press <ctrl-d> once, don't terminal. 5. press <ctrl-d> again, brought terminal. so looks this: user@defiant ~ $ cat foofoouser@defiant ~ $ foo printed twice because first time pressed flushed input. sec time it's interpreted end program. how stop behavior: don't connected tty when pressing ctrl-d. means don't utilize normal linux terminal. not sure if possible. how process command ...

android - How to get latitude and longitude of a location which user clicked on it -

android - How to get latitude and longitude of a location which user clicked on it - i'm going latitude , longitude of location on map user has clicked on , calculation on them. btw shall i'm working emulator , don't have access mobile phone , have run in emulator. please help me do! please elaborate need questions quite confusing. can show lat , long values on google map guess getting web service or current location. using google map on emulator need google map key. allow me know type of help want exactly. http://blogspot.fluidnewmedia.com/2009/04/displaying-google-maps-in-the-android-emulator/ above link ids start with. android

javascript - Navigate to specific anochor tag via up and down arrow press -

javascript - Navigate to specific anochor tag via up and down arrow press - i using anchor tags , have implemented smooth scrolling on 5 links. works perfectly. however, add together ability utilize arrow keys navigate through these same anchor tags. i can fumble through javascript , jquery, i'm pretty confused when comes stuff. <ul> <li class="scrolldot"><span><a href="#one">1</a></span></li> <li class="scrolldot"><span><a href="#two">2</a></span></li> <li class="scrolldot"><span><a href="#three">3</a></span></li> <li class="scrolldot"><span><a href="#four">4</a></span></li> <li class="scrolldot"><span><a href="#five">5</a></span></li> <li class="scrolldot...

Getting column count of the MySQL output with Java -

Getting column count of the MySQL output with Java - i want know how column count of resulting output in mysql. i searched site same question i'm little different. i want column count of resulting output not of table. i want know how many columns there in resulting output when query passed. thanxx in advance! resultsetmetadata metadata = resultset.getmetadata(); int columncount = metadata.getcolumncount(); java mysql jdbc connectivity

localization - Android application with ActionBar NullPointerException with non default locale -

localization - Android application with ActionBar NullPointerException with non default locale - i created pretty basic android application actionbar , 2 tabs. worked ok. added locale resource directory res/values-de , within strings.xml strings translated in high german language. changed language on nexus7 high german , application unable start after deployment. got same problem on emulator. please can help me create application running non default locale on mobile device? in case german... following error reported. 02-07 15:32:41.314: w/dalvikvm(16682): threadid=1: thread exiting uncaught exception (group=0x40d82930) 02-07 15:32:41.324: e/androidruntime(16682): fatal exception: main 02-07 15:32:41.324: e/androidruntime(16682): java.lang.runtimeexception: unable start activity componentinfo{com.example.tabactionbar/com.example.tabactionbar.mainactivity}: java.lang.nullpointerexception 02-07 15:32:41.324: e/androidruntime(16682): @ android.app.activitythread.perfor...

java split sentences into words -

java split sentences into words - this question has reply here: split file sentences words 4 answers how split array of sentences array of array of words? if can split sentence using split() ..but it's used single array. need multiple array.. eg: sentences[0]="one sentence" sentences[1]=" 1 sen...." i need split this... word[0][0]="one word" //first row first word word[0][1]="second word" word[0][2]="third word" word[1][0]="..."//second row first word** any 1 can help me. try this.. for(i=0;i<somelength;i++){ word[i] = sentence[i].split("yourdelimiter"); } java

How to perform expansions in a string in the context of a calling function in tcl -

How to perform expansions in a string in the context of a calling function in tcl - how can implement expand in script below (expanding commands , variables normal in tcl), want print out: ' hello { $b } {tcl world} ' this how imagine script look: proc clever_func {script} { set script [uplevel 1 expand [list $script]] puts "'$script'" } proc isolated_client_function {} { set hello set b hard set c tcl set d world clever_func { $a { $b } [list $c $d] } } isolated_client_function an illustration isn't sufficient replacement specification, seems there no built-in tcl facility doing want. possible perform substitution on single command tail (by prepending list command , eval ling @ level want), not pseudo-script 2 "commands". (it's possible string interpolation does, using subst , know why it's not want: expand $b ). i see 2...

validation - Ruby On Rails: How to validate a form having file upload field with other fields -

validation - Ruby On Rails: How to validate a form having file upload field with other fields - i new ruby on rails(rails 3). having form 3 fields , among these 3 field, 1 field upload files(rar/tar/zip). know way validate (server side) such form allow user:- 1. fill in 3 fields. 2. uploaded file should either rar/tar/zip. 3. uploaded file should not exceed 2mb in size. u can utilize paperclip gem uploading file. class user < activerecord::base attr_accessible :avatar has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" } end there validations like validates_attachment :avatar, :presence => true, :content_type => { :content_type => "image/jpg" }, :size => { :in => 0..10.kilobytes} see https://github.com/thoughtbot/paperclip more info. ruby-on-rails validation file-upload

php - Launch a new tab and reload original page -

php - Launch a new tab and reload original page - in lamp stack application create invoices in pdf format. first screen allows selections of purchase items included in invoice. pdf opens in new tab using $_posted form info works fine, simultaneously reload first page update status of purchases selected pdf invoice , want selection screen reflect this. ideas anyone? nb native javascript or php solutions please. perhaps this: <a onclick="open_in_new_tab_and_reload('./path_to_pdf.pdf')" href="#">pdf</a> <script> function open_in_new_tab_and_reload(url) { //open in new tab window.open(url, '_blank'); //focus thet window window.focus(); //reload current page location.reload(); } </script> php javascript html

android - Adding application to complete action using list in Motorola Xoom -

android - Adding application to complete action using list in Motorola Xoom - i seek add together application "complete action using" phone call contact action. added next intent filter manifest described in docs , other answers <intent-filter android:icon="@drawable/ic_launcher"> <action android:name="android.intent.action.call" /> <category android:name="android.intent.category.default" /> <action android:name="android.intent.action.call_privileged" /> <data android:scheme="tel" /> </intent-filter> and works ok samsung s2 , s3 not work in motorola xoom device. application not appear on list. can give me hint how prepare or work around? there no prepare or workaround, xoom not phone , hence has no ability place phone calls, there no list appear on. android

Highlight part of a text in an extjs textarea -

Highlight part of a text in an extjs textarea - i need highlight part of text in textarea. have seen done jquery can't utilize jquery because app i'm working on uses extjs(the textarea little part of app). link jquery sample: http://www.strangeplanet.fr/work/jquery-highlighttextarea/ i'm using extjs 2.3.0 message extjs textarea, i'm trying highlight text in. var message = new ext.form.textarea({ hidelabel: true, id: 'smshl', name : 'smshl', emptytext: 'enter message here', anchor: '90%', allowblank: false, style:'overflow:hidden;style:margin:15px;', height: 90, minlength: 1, minlengthtext: 'you cannot send blank text', maxlength: userobj.smslength, maxlengthtext: 'sorry, maximum length of message exceeded', preventscrollbars: true, enablekeyevents: true, listeners:{ k...

extjs - Issue with Nested List when data does not contain 'text' node -

extjs - Issue with Nested List when data does not contain 'text' node - i want render nested list such when drill downwards button shows name of parent node. tried looks if json getting doesn't have node name text , won't work. here fiddle local info (in app using store fetch service don't have command on name of nodes) please note button title not populated when go downwards tree. there displayfield config of nestedlist can specify field used set title , item text . default set text can specify 1 of model field. here's working fiddle based on example. alter in config of nestedlist @ bottom. but, if overriding getitemtexttpl or gettitletexttpl , config ignored. extjs sencha-touch sencha-touch-2 sencha-touch-2.1

javascript - Twitter search api always return 15 tweets -

javascript - Twitter search api always return 15 tweets - when phone call twitter search api, search on tweets hashtag, returns 15 tweets, though set count five. $.ajax({ url:'http://search.twitter.com/search.json', type: 'get', datatype: 'jsonp', data: { q: %23twitter, count: 5 }, success: function(data, textstatus, xhr) { //some code } does knows problem? edit: other parameters include_entities not working either. try data: { q: %23twitter, page : 1, rpp : 4 }, if want x number of tweets, set rpp x-1 javascript ajax twitter

Extracting data from a website using iMacros -

Extracting data from a website using iMacros - i new imacros seem have basic understanding of how works. however, have 2 problems can't seem resolve. imacros loads , executable service ran whenever needed information. 1 time info extracted service takes , writes file on servers c drive. has been working fine till month ago. amazon changed website , can't script cooperate. help resolving appreciated. the script not extract text, and a new imacros browser opens after each run-through of script. i have researched internet, manipulated script many different ways, , have used record option, wizard create script extract data. i'm not sure missing. script below. version build=7401598 tab t=1 url goto=https://sellercentral.amazon.com/gp/fba/revenue-calculator/index.html/ref=au_xx_cont_xx?ie=utf8&lang=en_us wait seconds=10 tag pos=1 type=input:text form=name:search-form attr=id:search-string content={{asin}} wait seconds=10 tag pos=1 type=button attr=id:sea...

android - Listview with multiple child list -

android - Listview with multiple child list - i want develop listview multiple kid below image, google not got similar solution.   job 1 floor 1       floor 2        floor 3                                room 1                 room 2                 room 3 job 2     floor 2                 room 2 job 3 job 4 can suggest me? how accomplish like, hint or link? have seen , tried 1 : http://code.google.com/p/tree-view-list-android/ android listview expandablelistview

ruby - How to remove elements from an array and keep them in a variable in order? -

ruby - How to remove elements from an array and keep them in a variable in order? - i have array : input2 = ["other", "y", "x", "z", "description"] i want take off "y", "x", "z", "description" , store them in variable maintain them in order.example : input2 = ["z", "x", "y", "other", "description"] should have : input3 = ["other"] some_variable = ["z", "x", "y", "description"] thanks help. def take_it_off(arr, values) without = [] ordered_values = [] arr.each |val| if values.include? val ordered_values << val else without << val end end homecoming without, ordered_values end so can do irb> values = "y", "x", "z", "description" => ["y", "x", "z", ...

google apps script - TypeError: Cannot find function getCell in object Sheet -

google apps script - TypeError: Cannot find function getCell in object Sheet - i new coding related google apps script , javascript in general. i've adapted script needs, getting next error when run it: typeerror: cannot find function getcell in object sheet essentially, trying value in cell d4 (4,4) , pass value variable emailto . i'm not doing correctly. rest of script should work fine. guidance appreciated. // sends pdf receipt // based on script ixhd @ https://gist.github.com/ixhd/3660885 // load menu item called "receipt" submenu item called "e-mail receipt" // running this, sends open sheet, pdf attachment function onopen() { var submenu = [{name:"e-mail receipt", functionname:"exportsomesheets"}]; spreadsheetapp.getactivespreadsheet().addmenu('receipt', submenu); } function exportsomesheets() { // set active spreadsheet don't forget var originalspreadsheet = spreadsheetapp.getactive(); ...

javascript - website Frontpage is loading extremely slow on IE8 joomla 2.5 -

javascript - website Frontpage is loading extremely slow on IE8 joomla 2.5 - good day there. website frontpage loading extremely slow when view on ie8 , loads faster on other browsers chrome , firefox. don't know causes website load slow. i've tried alternatives , followed instructions create load faster. 1**i did check yes gzip compression. **2 tried disable mootools-more.js file. 3 hosting server fast. 4 did create cache settings on. 5 have no big images, have thumbnail images on blog. 6 i've removed un-used plugins, components , modules. by way i'm using kunena blog component. website https://www.mhuncut.co.za/ hope help kind regards beseti these js files: <script src="/media/system/js/mootools-core.js" type="text/javascript"></script> <script src="/media/system/js/core.js" type="text/javascript"></script> <script src="/media/system/js/mootools-more.js" type=...

php - yii bootstrap (v2.0.3) extension invalid path alias -

php - yii bootstrap (v2.0.3) extension invalid path alias - i followed yii-bootstrap installation instructions on http://www.cniska.net/yii-bootstrap/setup.html path alias set in config/main.php doesn't work me: <?php // path alias bootstrap yii::setpathofalias('bootstrap',yii::getpathofalias(dirname(__file__).'/../extensions/bootstrap')); // main web application configuration. writable // cwebapplication properties can configured here. homecoming array( ... protected/extensions/bootstrap/... bootstrap directory. if want utilize in layouts/main.php yii::app()->bootstrap->register(); it says "alias "bootstrap.components.bootstrap" invalid. create sure points existing directory or file. " i tried lots of stuff can't work. ideas? have tried load bootstrap automatically on config file? add together 'bootstrap' preload array. here mine: 'preload'=>array('log', 'bootstrap...

node.js - Automating coffeescript compilation with Jenkins -

node.js - Automating coffeescript compilation with Jenkins - i've set jenkins ci server on windows box 1 of projects. there portion of written in coffeescript. part wasn't looped build process. needs be. i haven't seen coffeescript plugins jenkins, or much google on topic of building coffeescript in jenkins. i looking simplest way set jenkins build include coffee compilation step. preferably through plugins on jenkins rather manually installing programs on box. currently coffeescript compiled via commands coffee --lint --watch --output "c:\repositories\martha\trunk\bb\app\bin\js/" --compile "c:/repositories/martha/trunk/bb/app/src/" in node.js command prompt on developing boxes i've noticed jenkins has node.js plugin capable of running scripts in build step. don't believe can utilize commands npm install -g coffee-script or coffee --compile through node.js scripts rather command line. though hope wrong. currently best alt...

java - Android, How do I pass a variable as a pointer to a function? -

java - Android, How do I pass a variable as a pointer to a function? - how pass variable pointer function? have next code wish refactor public static httpresponse getjsonentityfromurl(context context, string url) throws clientprotocolexception, ioexception { httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget(url); httpget.addheader("accept", "application/json"); httpget.addheader("content-type", "application/json; charset=utf-8"); httpresponse response; response = httpclient.execute(httpget); homecoming response; } to this public static httpresponse getjsonentityfromurl(context context, string url) throws clientprotocolexception, ioexception { httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget(url); setheaders(httpget); httpresponse response; response = httpclient...

html - Transparent png button hover without background -

html - Transparent png button hover without background - i have 40*40px png transparent background 30*30px circle in middle. i utilize png button simple hover effect, want hover effect take place when cursor on circle, not on transparent background. is there plain html+css solution this? tried check here , on other forums, didn't find anything. check out script if need activate hover/click when mouse within circle (and not in square bounding box) http://tympanus.net/codrops/2011/11/22/hover-and-click-trigger-circular-elements/ it’s not possible in css only, elements treated rectangles, if rendered rounded corners. html css png

c# - I got this error "Number of query values and destination fields are not the same." -

c# - I got this error "Number of query values and destination fields are not the same." - this question exact duplicate of: “number of query values , destination fields not same.” i got error : syntax error insert statement syntax error insert statement syntax error insert statement syntax error insert statement syntax error insert statement plss help me. this right other 1 sql sorry //server connection private void serverconnect() { string connstring; connstring = "provider=microsoft.ace.oledb.12.0;data source=plan.accdb"; tconn = new oledbconnection(connstring); tconn.open(); messagebox.show("you connected."); tconn.close(); } //add memos private void getmemolist() { string query; dataset ds = new dataset(); query = "select memo_id,date,time,memos tblmemo order date asc...

vb.net - Is there a generic way to reference the current project? -

vb.net - Is there a generic way to reference the current project? - i need pass form sub. if project called project1 , contains form called form1, follows: public sub processform(byref myform project1.form1) etc etc is there generic way refer current project - project1 - re-create code other projects, without having alter reference project? i thinking of my.project , refer my.project.form1 , cannot see how this. am using vs 2010. you can namespace.class ie, if project namespace myprojectname , class form1. need myprojectname.form1 vb.net

sql - How to properly join these selects? -

sql - How to properly join these selects? - [1] select x.id somwhere x.location = _stringreturnedfromc#_ // need id table, know strin: location (from c#) [2] select y.nameid _relationbetweenxandy_ xy xy.id = [1] // utilize id found in [1] [3] select z.name z z.nameid = [2] // utilize id found in [2] now how can tell select [2] looking xy.id = result select [1] and select [3] i'm looking name of guy id z.nameid i asked question here far i'm concerned question beyond saving. z table: z.name, z.nameid y table: y.place, y.placeid // fixed, used placeid, inface string: place x table: x.name, x.placeid if have same name, foreign keys (nameid, placeid) this how actual code looks like: select * angajati bring together distribuire d on d.locatie = 'oradea' // need d.distribuireid while know d.locatie (d.location). how ? bring together angajari on d.distribuireid = an.distribuireid thus se...

What is different between scope variable and public variable of a variable in C#? -

What is different between scope variable and public variable of a variable in C#? - this question has reply here: variable scope confusion in c# 4 answers what different between scope variable , public variable of variable in c# can declare variables @ 4 different locations in programs meant "scope" of variable? think of scope of variable "the scope of particular variable range within program's source code in variable recognized compiler". if reading of question correct, looking contrast scope (local, instance, static, etc.) visibility (public, private, protected, internal). these 2 concepts independent (i said "nearly", because variables of local scope not have visibility). allow command both lifetime , accessibility of variables. the scope controls lifetime of variable, letting determine when comes existence , when become...

java - JNI's "Invalid memory access of location.." -

java - JNI's "Invalid memory access of location.." - i have code written in c++, let's phone call a. contains nested functions, create binary out of a, needed utilize -fnested-functions flag. now need create .jnilib library out of a, can invoked java. however, go error: invalid memory access of location 0x105... rip=0x105.. i not figure out cause (i tried include -fnested-functions flag when linking create .jnilib library, g++ not allow it). has ran problem before, or kindly suggest how debug (core dump) problem? i'm running macos lion, built-in java. java c++ osx debugging jni

html5 - css div with rotate text - positioning issue -

html5 - css div with rotate text - positioning issue - i'm developing mobile app jquery , html5 want build slider div each of slides that: when utilize rotate such as: -transform: rotate(-90deg); (to platforms) the position of "previous" , "next" not good, tried absolute , relavtive , didn't work well. 1 more issue - work precentage("%") in css, improve cross platform app. can 1 help me , tell how build div correctly? thanks. html5 css3 rotatetransform

Condition in Mathematica to accept list of pairs with numeric input -

Condition in Mathematica to accept list of pairs with numeric input - i trying create function in mathematica takes in list of pairs numeric , outputs list of first element of pair raised inverse powerfulness of sec element e.g. {{1,3},{2,2}....} -> {1^(1/3),2^(1/2),...}. this have got far: pairstoroots3[list : {{_, _} ..}] := list /. {p_real, q_real} :> p^(1/q) it doesn't seem work p_real if set p_integer works fine. not sure why. ideally, status expressed like pairstoroots3[list : {{_real, _real} ..}] or somehting tried seemed not work. this works if numbers have head real : pairstoroots[list : {{_real, _real} ..}] := #^(1/#2) & @@@ list pairstoroots[{{1`, 3`}, {2`, 2`}}] {1., 1.41421} but these numbers not have head real : head /@ {1, 2, pi 7/8} {integer, integer, integer, symbol, rational} therefore want numericq george used: pairstoroots[list : {{_?numericq, _?numericq} ..}] := #^(1/#2) & @@@ li...

javascript - breaking main loop - jstree -

javascript - breaking main loop - jstree - i using jstree library display tree. in code below, looping through selected nodes in tree , based on conditions, assigning variable 'allow_edit' boolean value. i break main loop if 'allow_edit = false'. i tried using label , breaking loop not seem work. getting undefined label. loop1: $j.each($j("#demo2").jstree("get_selected"), function(index, element) { var selected_node_depth = parseint($j(element).attr('node_depth')); var allow_edit = false; var array_first_filter = $j.grep(array_first, function(v) { homecoming v[1] != "not detected";}) var array_second_filter = $j.grep(array_first_filter, function(v) { homecoming v[3] > selected_node_depth;}) if (array_second_filter.length === 0 || array_second_filter.length == null) { allow_edit = true; } else{ alert("confliction exists in selected terms."); allow_edit = false; //brea...

python - How can I call an instance function? -

python - How can I call an instance function? - i have class instance , phone call 1 of instance functions udp_action = udpactions( application = self.application ) func = getattr( udp_action, 'udp_' + opts['cmd'] + '_fired' ) but i'm getting next error values instance has no attribute '__getitem__' where create mistake? you're using opts if dictionary (or dictionary-like object), isn't. it doesn't back upwards ['cmd'] notation, resulting in exception you're seeing. in [1]: class values(object): pass in [2]: opts = values() in [3]: opts['cmd'] typeerror: 'values' object has no attribute '__getitem__' python

qt - QListView and delegate display unintended item -

qt - QListView and delegate display unintended item - i've problem qlistview, paint unintended item on top left of qlistview : http://s4.postimage.org/64orbk5kd/screen_shot_2013_02_14_at_20_23_14.png i utilize qstyleditemdelegate in qlistview : m_stringlist.push_back("first"); m_stringlist.push_back("second"); m_stringlist.push_back("third"); m_model.setstringlist(m_stringlist); ui->processeslistview->setflow(qlistview::lefttoright); ui->processeslistview->setmodel(&m_model); ui->processeslistview->setitemdelegate(new processitemdelegate(this, ui->processeslistview)); the delegate (processitemdelegate) paint method utilize custom qwidget display info : void processitemdelegate::paint ( qpainter * painter, const qstyleoptionviewitem & option, const qmodelindex &inindex ) const { _listitem->setcontent(_listview->model()->data(inindex).tostring()); painter->save(); painter->transl...

sql - Permissions for Linked Server Remote Login -

sql - Permissions for Linked Server Remote Login - i trying connect 2 databases (not on same server or domain) using linked servers. below query running connect 2. my problem if specify @rmtuser = 'sa', able connect fine. however, if switch @rmtuser 'remoteintegrationuser', error saying unable connect. (error 18456) i have verified can connect straight "remote" server via ssms using 'remoteintegrationuser' business relationship , connects fine. is there special permission 'remoteintegrationuser' must have on "remote" server in order able handle these incoming connections? exec sp_dropserver 'remotedb', 'droplogins' go exec master.dbo.sp_addlinkedserver @server = n'remotedb' ,@srvproduct = 'ole db provider sql' ,@provider = n'sqlncli' ,@datasrc = '111.2222.33.44' ,@catalog = 'myremotedb' exec master.dbo.sp_addlinkedsrvlogin @rmtsrvname = n're...

javascript - Dynamically update pointStart and pointInterval -

javascript - Dynamically update pointStart and pointInterval - i using highcharts display daily stats, want users able select date range. function requestdata(chart, from, to, group) { $.ajax({ url: '/stats/chart?from='+from+'&to='+to+'&group='+group, success: function(data) { chart.series[0].setdata(data.data); chart.series[0].pointstart = data.start; chart.series[0].pointinterval = data.interval; }, cache: false }); } the js function ajax phone call , homecoming like:- { "start":1358467200000, "interval":86400000, "data":[24,9,46,66,19,93,11,10,66,75,70,52,35,91,69,0,50,24,5,14,83,9,26,5,53,32,27,30,34,25,57,100] } how update charts pointstart , pointinterval value? since highcharts 3, can utilize series.update() : chart.series[0].update({ pointstart: data.start pointinterval: data.interval, data: data.data...