Posts

Showing posts from August, 2013

sql - Multiple textbox search on a datagrid -

okay struggling head around follow example. ( http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.filterexpression.aspx ) aim: have 2 dropdowns/textboxes used edit datagrid filtering. i have tried adding ,firstname='{1}'" ,firstname='{0}'" after =title not seeming work. added control parameter of course firstname. the below code first version , original. my code <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>asp.net example</title> </head> <body> <form id="form1" runat="server"> <p>show employees following title: <asp:dropdownlist

android - solo.clickInlist(int) not working for custom listview in Robotium -

i'm new robotium, have 2 questions. 1) i'm trying make click on custom listview item not working. tried clickinlist(int) , clickinlist(int, int). 2) handling random alertdialog: how handle display alert dialog dynamically in robotium? example i'm using alert dialog when message during call webservice, connection failure, no internet, server error, timeout, etc.., thanks in advance. there 2 important things note clickinlist(int) method aren't readily apparent: first, list items 1-indexed, click first item of list, use clickinlist(1) not clickinlist(0) . second, clicking relative visible items on screen, clickinlist(1) click first visible item on list, not first item overall. as dynamic handling of dialog, arbitrary pop-ups aren't robotium meant handle. it's supposed test user interaction app under known, controlled, repeatable conditions. if unexpected happens in middle of test, such losing connection, should considered failure; th

ios - Get MusicSequence callback from MIDI Playback -

i have musicplayer contains musicsequence set of musictracks hold midi information. want know when midi note starts reproducing , when ends, listener of playback of midi. i looking , think of maybe using musicsequencesetusercallback don't know how work. has idea on how accomplish this? there's tutorial on how capture midi events musicsequence here (such note on/off): http://www.deluge.co/?q=midi-driven-animation-core-audio-objective-c in brief, method call mididestinationcreate create own midi endpoint handle midi messages, , point musicsequence @ musicsequencesetmidiendpoint .

c# - Controller action never calls -

after redirect facebook getting code token , when facebook redirect me, app stop responding, action, should called never fires up. problem? my routes routes.maproute( "enter facebook return", "enter/facebook/return", new { controller = "users", action = "facebookreturn" } //callback action, not called -> problem ); routes.maproute( "enter facebook", "enter/facebook", new { controller = "users", action = "facebook" } ); and controller public actionresult facebook() { oauth2 facebook = new oauth2( configurationmanager.appsettings["oauth_facebook_id"].tostring(), configurationmanager.appsettings["oauth_facebook_secret"].tostring(), configurationmanager.appsettings["oauth_facebook_authorize"].tostring(), configurationmanager.appsettings["oauth_facebook_access"].tostrin

Add legend inside each panel with Lattice in R -

i wanna make scatter plot connecting lines different groups , different individuals. make panels conditioned group variable , groups conditioned individual variables. now, add legend inside each panels(see code below). in plots, have legends of individuals grp==1 in first panel, grp==2 in second panel, on forth. legends located in upper left corner of panel belong to. how shall code? library(lattice) mydata <- data.frame(id = rep(1: 20, each = 10), grp = rep(1: 4, each = 50), x = rep(0: 9, 20)) mydata$y <- 1.2 * mydata$grp * mydata$x + rnorm(nrow(mydata), sd = mydata$grp) xyplot(y~ x | factor(grp), data = mydata, groups = id, type = "b", as.table = t, layout = c(2, 2), panel = panel.superpose, panel.groups = function (x, y, ...) { panel.xyplot(x, y, ...) } ) try this. note subset command comes in data statement in xyplot. on purpose. if call subset

linux - Problems with vim, i removed it -

i'm new user in linux. problem when tried run vi (or vim) text editor, realised worked different remembered used to. example, when try put in mode of "insert", in downside doesn't appear "insert", or when try delete backspace key, doesn't delete... moves cursor back, , nothing. so thought removing , re-installing again work, , removed by: apt-get --purge remove vim-common but when try: apt-cache search vim it throws nothing, , don't know how install again. help? people check out this post. there lot of people complain that, , gives command line workaround may help.

scala play 2.1.1 json functional syntax mapping data to a different format -

i'm trying write custom json serializer using functional syntax , can't seem find right way solve particular problem. have couple of joda datetime objects want write in specific format ui consuming it. can show me i've gone wrong? here case class dealing @ moment, nothing special going on. case class banner( id: int = 0, ownerid: int = 0, licenseeid: option[int] = none, statuscolor: option[string] = none, content: option[string] = none, displaystart: datetime = new datetime(), displayend: datetime = new datetime(), created: datetime = new datetime(), updated: datetime = new datetime() ) these imports serializer object. import play.api.libs.json._ import play.api.libs.functional.syntax._ import org.joda.time.datetime import org.joda.time.format.datetimeformat first off, joda datetime converts long fine implicitly macro expander works great if that's wanted. object myserializers { implicit val writesbanner = json.writes[banner] } what

parsing - Fast(est) way to get X-Forwarded-for in header with G-Wan? -

since non-rfc header field isn't in http_env nor http_t struct, wrote snippet : //get reply buffer xbuf_t *reply = get_reply(argv); // init & create json buffer xbuf_t json_buf; xbuf_init(&json_buf); jsn_t *params = jsn_add_node(0, "params"); [...] http_t *http = (http_t*)get_env(argv, http_headers); xbuf_t *read_buf = (xbuf_t*)get_env(argv, read_xbuf); [...] // add remote ip (from x-forwarded-for or remote_addr) char *xforward = xbuf_findstr(read_buf, "x-forwarded-for:"); if(xforward) { jsn_add_string(params, "ip", xforward); } else { jsn_add_string(params, "ip", get_env(argv, remote_addr)); } the json part is, of course, part of application , irrelevant question. think it's right way or xbuf_findstr() inefficient , there faster solution (without using asm or cryptic code) ? thank :) edit : wow, forgot strok() part rid of first field, want ip adress of course. edit2 : pa

c - Microduino ENC28J60 Ethernet Module (Arduino compatible) UDP Send not working -

i using new microduino enc28j60 ethernet module (arduino compatible). i using udplistener sketch , want echo message sender when udp packet arrives. i receiving messages ok, udpsend in callback method not work. this works fine on arduino uno ethernet shield can help. thanks in advance here code: // demonstrates usage of new udpserver feature. //you can register same function multiple ports, , multiple functions same port. // // 2013-4-7 brian lee cybexsoft@hotmail.com #include #include #define static 1 // set 1 disable dhcp (adjust myip/gwip values below) #if static // ethernet interface ip address static byte myip[] = { 192,168,0,201 }; // gateway ip address static byte gwip[] = { 192,168,0,1 }; static byte ipdestination[] = {192, 168, 0, 9}; unsigned int portmy = 8888; unsigned int portdestination = 9000; #endif // ethernet mac address - must unique on network static byte mymac[] = { 0x70,0x69,0x69,0x2d,0x30,0x31 }; byte ethernet::buffer[500]; // tcp/ip s

jquery - JSON.parse: unexpected character when receiving assoc array from PHP json_encode -

update so jquery.post() function receives valid json. know attribute "json" in function call should enough original array , .parsejson() not necessary. guess that's why syntax error when using function. but somehow i still can't access array without .parsejson() . in fact, when use typeof(data) it's still string. can write console , it's still valid json. how use array (originally associated php array encoded once via json_encode()) normal associated array in javascript? original post i've been getting syntax error days , it's driving me crazy. read lot of posts , know must super simple thing i'm missing. please help. in advance. var institute = $.post("../libraries/load_content.php", { funct: "getinstituteaddress", ins_name: "institut für informatik", ins_city: "kiel" }, "json"); institute.done(function(data) { alert(data); var i

c# - Function is not working -

i trying display recent "oders" order table. if have orders in table, message "no orders get". wrong code? public static list<orderinfo> getordersbyrecent (int count) { dbcommand comm = genericdataaccess.createcommand (); comm.commandtext = "ordersgetbyrecent"; dbparameter param = comm.createparameter (); param.parametername = "@count"; param.value = count; param.dbtype = dbtype.int32; comm.parameters.add (param); return convertdatatabletoorders (genericdataaccess.executeselectcommand (comm)); } protected void byrecentgo_click(object sender, eventargs e) { try { int recordcount = int32.parse(recentcounttextbox.text); list<orderinfo> orders = commercelibaccess.getordersbyrecent(recordcount); grid.datasource = orders; if (orders.count == 0) { errorlabel.text = "<br />no orders get."; } } catch {

jax rs - REST API getById using Integer or String? -

i'm designing rest jax-rs api jersey. i want know best practice object id. need map id on integer or string solution 1: /books/{id} getbyid(@pathparam("id") long id) solution 2: /books/{id} getbyid(@pathparam("id") string id) my intention used long because directly mapped on database model using long ... if need long , make parameter long . if jax-rs can't map path parameter requested client long , return 404 not found http status code thing. if allow string , code have check. let jax-rs checking. @get @path("/books/{id}") public response getbook(@pathparam("id") long id) { return response.ok("book " + id).build(); } a request /books/123 return book 123 . request /books/foo fail 404 not found .

windows phone 7 - It is possible to delete cookies in wp7 webbrowser control? -

i'm developing application windows phone 7. use webbrowser control , want delete cookies collected during user navigation. tried code below doesn't work(currenttab.browser of type webbrowser). foreach (cookie c in currenttab.browser.getcookies()) { c.discard = true; c.expired = true; c.expires = datetime.now.adddays(-1d); } any suggestion? as far windows phone 8 concerned can use clearcookiesasync(); method clear cookies.

html - CSS scaling background bug -

i want cloud background scale within box. possible? currently looks this: http://freecns.yanlu.de/cumulus1/ somehow background scales on limited box. have tried several ways figure out not find bug. not sure if possible this. i used following html : <div class="backgroundbox"> <div class="box_animation"></div> <ul class="nostyle inline center"> <li class="bboxcontent left">freecns cumulus includes on 100 weather specific icons shipped png, pdf, eps , svg. <br /></li> <li class="bboxvideo"></li> </ul> </div> and css : .backgroundbox { position: relative; z-index: 0; height: 295px; width: 816px; border-radius: 16px; margin-top: 48px; margin-left: auto; margin-right: auto; background: url('http://www.yanlu.de/files/images/cloudbg.png') no-repeat center; padding-top: 81px; } .bboxcontent { width: 295px;

Custom order list python -

this question has answer here: custom sort order of list 3 answers expanding on first question here: custom sort order of list mylist1 = ['moi.alpha', 'moi.red'] mylist2 = ['test.green', 'test.alpha','test.red'] and want sort order: ['red','green','blue','alpha'] so that: mylist1 = ['moi.red','moi.alpha'] mylist2 = ['test.red','test.green','test.alpha'] note "moi" , "test" dynamic depending on value assigned higher in code... this same exact code last question, simple split function when looking index in sort_order: mylist1 = ['test.alpha', 'test.green'] mylist2 = ['asdf.blue', 'asdf.alpha', 'asdf.red'] sort_order = ['red', 'blue', 'green', 'alpha

Reverse strings in SQL Server -

i have table product values below: apple iphone iphone apple samsung phone phone samsung i want delete products table exact reverse(as consider them duplicates), such instead of 4 records, table have 2 records apple iphone samsung phone i understand there reverse function in sql server, reverse whole string, , not i'm looking for. i'd appreciate suggestions/ideas. assuming dictionary not include xml entities (e.g. > or < ), , not practical manually create bunch of update statements every combination of words in table (if practical, simplify life, stop reading answer, , use justin's answer ), can create function this: create function dbo.splitsafestrings ( @list nvarchar(max), @delimiter nvarchar(255) ) returns table schemabinding return ( select item = ltrim(rtrim(y.i.value('(./text())[1]', 'nvarchar(4000)'))) ( select x = convert(xml, '<i>' + replace(@list, @delimiter

c++ - How to chain/queue up functors? -

i not using c++11 (otherwise use lambdas) i have iterators input data structure , output data structure. want operations on input data , store result in output. note start , end types may different (int -> float example). i tried model function after standard algorithms , gave following prototype template<class input_itr, output_itr> void f(input_itr in_it, input_itr in_it_end, output_itr out_it, contextstuff) the function many different things depending on context. function needs use 1 functor, line of code looks this transform(in_it, in_it_end, out_it, functor1()); but function wants use series of functors on each data element. there way can create chain of functors single functor use in transform? functors chain known @ compile type. for example transform(in_it, in_it_end, out_it, chain(functor1(), functor2())); performs functor1 on *in, functor2 on result, stores in *out. i can inherit functors unary_function solution. try this: template&

mysql - Rails 4 .joins() issue -- not working -

model plugin: class plugin < activerecord::base has_many :vulns end model vuln: class vuln < activerecord::base belongs_to :plugin end table plugin: create_table "plugins", force: true |t| t.string "name" end table vuln: create_table "vulns", force: true |t| t.string "title" t.integer "plugin_id" t.string "vulnerability_type" t.string "fixed_in" end when use rails console using rails c , enter plugin.select("*").joins(:vulns) grabs data plugin table #<activerecord::relation [#<plugin id: 1, name: "xxx">, #<plugin id: 2, name: "xxx"> this query: select * `plugins` inner join `vulns` on `vulns`.`plugin_id` = `plugins`.`id` however, when execute query in mysql, shows content vulns , plugins supposed to. every plugin there atleast 1 or more vuln in database. so here's question: how fetch content both tab

python - How to send a pygame image over websockets? -

i'm trying code let websites view webcam. i'm following tutorial linked on this website , except using python , pygame instead of processing. at moment, code grabbing pygame image (which simplecv image), attempting convert jpg format, , send on websockets client display inside img tag. however, can't seem figure out how convert pygame image jpg , display on web browser. this code server, uses flask , gevent: #!/usr/bin/env python import base64 import cstringio import time geventwebsocket.handler import websockethandler gevent.pywsgi import wsgiserver flask import flask, request, render_template import pygame pygame.init() import simplecv scv app = flask(__name__) cam = scv.camera(0) @app.route('/') def index(): return render_template('index.html') @app.route('/camera') def camera(): if request.environ.get('wsgi.websocket'): ws = request.environ['wsgi.websocket'] while true:

ios - Nested NSArray filtering -

i have need obtain maximum value of property of collection of custom objects of same class. objects stored in nsarray, , property happens nsarray of numbers. let me explain in detail: nsarray *samples; // of cmdata, 4000 elements cmdata class models sample, specific moment in time, of set of different channels can have different values. @interface cmdata : nsobject @property (nonatomic) nsuinteger timestamp; @property (nonatomic, strong) nsarray *analogchanneldata; // of nsnumber, 128 elements @end (i have stripped other properties of class not relevant question) so example, sample[1970] be: sample.timestamp = 970800 sample.analogchanneldata = <nsarray> [ [0] = @(153.27) [1] = @(345.35) [2] = @(701.02) ... [127] = @(-234.45) ] where each element [i] in analogchanneldata represents value of specific channel timestamp 970800 now want obtain maximum value 4000 samples channel 31. use following code: nsuinteger channelindex = 31; ns

mediaelement.js - How does Mediaelement handle missing files? -

we looking way capture when mediaelement not load file either because not exist (404 error) or request never processed (timeout situation). not appear error event called in these situations, true? any thoughts on how handle type of recovery can made? this doesn't answer whole question, following simple trick use test if file exists or not: <?php $mp3_url = "http://mywebsite.com/wp-content/uploads/2013/08/mp3.mp3" /* convert lecture uri absolute path file_exists() */ $mp3_abs_url = preg_replace( "#" . wp_content_url . "#", wp_content_dir, $mp3_url ); if ( file_exists($mp3_abs_url) ) { echo do_shortcode("[audio mp3=$mp3_url][/audio]"); } else { ?> <div> <?php echo "no mp3 available."; ?> </div> <?php } ?> otherwise mediaelements displays player 0:00 duration.

Use php to hide anchor text on Wordpress custom field -

i noob @ php & trying create wordpress template using advanced custom fields plugin. template want need hide anchor text (the text says bio) not show on page unless there information entered coach_bio_1 field. field data wrapped in div shows fancybox when link clicked. here code, realize simple fix, help <div class="coach_info"> <div class="coach_pic"><img src="<?php the_field('coach_pic_1'); ?>" /></div> <div class="coach_content"> <p class="coach_title"><?php the_field('coach_name_1'); ?></p><br /> <p><?php the_field('coach_title_1'); ?></p><br /> <p><?php the_field('coach_email_1'); ?></p> <a href="#bio_1" class="fancybox">bio</a> <div style="dis

operating system - Python Running OS command with quotes inside -

#!/usr/bin/python import os readline = open('desktops.txt','r') line in readline: machinename = line query = os.system('wmic -u corp.fakedomain.com/domainusername%password //192.168.1.100 "select * win32_useraccount localaccount = true"|grep "500|"|cut -d "\\" -f 2|cut -d "|" -f1') i receiving following error... myhostname:~# ./getlocaladminnames.py sh: syntax error: unterminated quoted string sh: syntax error: unterminated quoted string sh: syntax error: unterminated quoted string sh: syntax error: unterminated quoted string sh: syntax error: unterminated quoted string then after resolve error substitute ip machinename variable. any appreciated. you should escape backslashes. replace \\ \\\\ : os.system('wmic -u corp.fakedomain.com/domainusername%password //192.168.1.100 "select * win32_useraccount localaccount = true"|grep "500|"|cut -d "\\\\" -f

markdown - vimscript templating with global-counter -

i trying create generic markdown template, using vimscript. each time template called, increment counter. function 1 #cntr= read/parsed markdown file, incremented function! getcntr() let yogaf = readfile("yoga.js") i read last-line - 1 . last (the line number) prints. however, item (the value @ list index) not: let last=len(yogaf)-1 let item= yogaf[last] echo item let indx = 0 i'm little confused vimscript pattern looping through list. tried several things, including #cntr=* ... no luck finding match! in yogaf if =~ "#cntr=\&" let indx = break else let indx = len(yogaf)-1 endif endfor when function called, don't see indx , cnt , or cntr printed. echo indx let cnt = yogaf[indx] echo string(cnt) let [g:cntr] = cnt[6:] echo g:cntr return g:cntr endfunction function2 calls function1 , gets g:cntr , writes te

svn - Starting a new Codelite project from subversion -

Image
i cannot life of me figure out how import new project in codelite svn repo. documentation on codelite website lacking on this. how 1 it? importing project svn no different importing project local file system. first, checkout th sources svn ( can either favorite svn client or use codelite's svn plugin) - note codelite's svn plugin requires install svn command line tool once have checked out sources have 2 options here: 1) if have .workspace file , load codelite ( workspace -> open workspace ) 2) if don't have workspace, create new project (yes, project) workspace -> new project select type of project want give name , click ok. right click on project , select import files directory, select directory checked out sources , codelite rest edit: see screenshot of svn plugin, maybe help: eran

javascript - Clientside Heart Vote -

is there way implement simple heart vote(just +1 vote counter without ability vote more once) using javascript / jquery , html5 data attributes, other html5 apis, without serverside stuff? you can use localstorage record client has voted. this: localstorage.setitem('voted', true); to check if client voted before: var voted = localstorage.get item('voted'); update: as need counter, may try 1 of baas (backend-as-a-service) services, such parse.com or kinvey.com

acl - Symfony - Efficient access control for (dynamic) hierarchical roles -

i need advice on how handle access control following scenario: corporation has 1 or many companies has 1 or many role_corp_admin company has 1 or many regions. has 1 or many role_company_admin. region: has 0 or many stores. has 1 or many role_region_admin. store: has 0 or many assets. has 1 or many role_store_admin. has 0 or many role_store_employee. has 0 or many role_store_customer (many better). the application should support many corporations. my instinct create either many-to-many relationship per entity admins (eg region_id , user_id ). depending on performance, go more denormalized table user_id , corporation_id , company_id , region_id , , store_id . i'd create voter class (unanimous strategy): public function vote(tokeninterface $token, $object, array $attributes) { // if super_admin, return access_granted // if user in $object->getadmins(), return access_granted // else, return access_denied } since permissions hierarchical,

Chrome extension: How to manipulate inner Gmail DOM with jQuery? -

Image
whilst no problem manipulate inner gmail content css content script, fail jquery , custom js content script. i want use jquery manipulate inner gmail dom. manifest.json "content_scripts": [ { "matches": ["*://*.mail.google.com/*"], "js": ["jquery.js", "default.js"] } ], default.js $(document).ready(function() { $("div.gk").css("color", "red"); }); however, respective div.gk element not reflect css changes: any ideas why not work? the domready event fires long before target element created. when go mail.google.com you'll notice loading bar - before appears event fired. i'm not sure if gmail has custom events more reliable, otherwise i'd suggest using jquery(window).load(function(){ jquery("div.gk").css("color", "red"); }); if feel dissecting events in more detail suggest reading on

Install4j installer fails with internal error for Mac OS -

i have built installer using latest install4j. on mac os, fails install following message: "an internal error has occuerred (error code: launch path not accessible)". the same installer other platforms (windows 32/64, , linux) work fine. has else seen , know how fix it? it turns out, error caused openjdk jre version using. works fine installed version of jre on mac.

python - Is there a configuration file for Numpy? -

i use numpy command line , have remember apply recurrent settings, example setting output formatting: np.set_printoptions(threshold=np.nan, precision=3, suppress=true, linewidth=180) is there global numpy config file automatically executed new python shell or during import can execute this? if not, there elegant way achieve effect? i not aware of such configuration file numpy (for matplotlib example have the matplotlibrc file ). but, workaround, can set environment variable pythonstartup pointing python script whatever want everytime python section starts. in case use import numpy np , import matplotlib.pyplot plt on... saving small amount of "overhead" everytime want try on python. example on windows: set pythonstartup=c:\users\yourlogin\somewhere\startup.py example on linux: export pythonstartup=/usr/local/bin/startup.py you should set once using "control panel\system", example, on windows.

java - Removing even elements from a list -

this question has answer here: remove numbers arraylist 7 answers how can remove elements list of integers? list dropeven(list l, int n) { list to_return = nil(); while(true) { if(l.isempty()) return to_return; if(n==0) l.remove(n); integer = (integer)(hd(l)); to_return=append1(to_return,hd(l)); n= n-1; l=tl(l); } } user iterator , remove values iterator = l.iterator; int counter = 0; while(i.hasnext()){ i.next(); if (counter%2 == 0) i.remove(); counter++; }

android - TextureView autorotate video stream on Nexus4 (but not on Galaxy S4) -

when playback video stream on textureview, saw different behaviors in galaxy s4 , nexus4. the video source recorded android in portrait mode, video 90 degrees rotated. (android camera's default orientation landscape capture video in portrait, need rotate video 90 degrees clockwise) when playback first check orientation of video (by measuring width , height) , if width longer height, rotate textureview 90 degrees below code. mediametadataretriever mediametadataretriever = new mediametadataretriever(); mediametadataretriever.setdatasource(url, new hashmap<string, string>()); string heightstring = mediametadataretriever.extractmetadata(mediametadataretriever.metadata_key_video_height); string widthstring = mediametadataretriever.extractmetadata(mediametadataretriever.metadata_key_video_width); int videoheight = integer.parseint(heightstring); int videowidth = integer.parseint(widthstring); framelayout.layoutparams l; displaymetrics metrics = new displaymetrics(); getwi

php: getting database name from own mysli class -

i made wrapper class mysqli following syntax: class mydb extends mysqli { .... } i'm creating instances following: $conn = new mydb($host $username , $pass, $dbname); i'm wondering - how can access $dbname inside class? i'm looking mysqli equivalent mysql_db_name() function. you make own class has field variable reference mysqli object , database name. class mydatabase { public $dbi; public $dbname; function __construct($host, $user, $pass, $db) { $this->dbi = new mysqli($host, $user, $pass, $db); $this->dbname = $db; } } $mydb = new mydatabase($host, $user, $pass, $db); //access db name stored during connection echo $mydb->dbname;

html - Responsive bootstrap form not becoming responsive -

i trying build form using bootstrap , need responsive too. needs go 4 colmn layout 3 1 colmn layout deepending on width. my code located @ http://jsfiddle.net/azmz2/1/ updated fluid still not working you notice have 4 columns. however, when resize, doesn't become 3 column. need become 3 column , widths decreases 2 , 1 column (aka responsiveness). columns need align vertically , horizontally. not happening. doing wrong? can not seem figure out. in advance. <form class="form-horizontal" name="submitdetails" acttion="#"> <fieldset> <div class="control-group oneline"> <label class="control-label" for="custom1">1. did telephone us?</label> <div class="controls"> <label class="radio span2" for=""> <input name="custom1" id="custom1" value="yes" checked="checked" type=&

facebook - Why FB.login doesn't ask me for permissions -

when try publish following code: fb.login(function(response) { if (response.authresponse) { fb.api('/me/feed','post',{ name: "nombre", link: "http://radio/player/bbc_world_service", description: "this test", message : "xxxxxxxx" },function(response) { // }); } else { // } },{scope: 'publish_actions','user_likes'}); it doesn't ask me permissions, publishes in timelime directly. far know theoretically must ask me permissions. try same thing through facebook explorer, ask for. it doesn't ask me permissions, publishes in timelime directly. this means you've authorized app once. once authorized, doesn't ask permissions again unless new permissions added. delete app facebook profile , try again. ask permissions then.

python - django: TypeError: 'tuple' object is not callable -

getting type error, 'tuple' object not callable. idea be? (dont worry indentation. copies in weird.) i'm trying create choices based on packsize of storeliquor. views.py: def storeliquor(request, store_id, liquor_id): = storeliquor.objects.get(storeliquorid=liquor_id) s = store.objects.get(storeid=store_id) x = order.objects.get(storeid=s, active=true) y = a.offpremiseprice c = a.bottlesize g = request.post.get('orderamount', '') b = a.packsize h = b*2 d = b*3 e = b*4 r = b*5 if c == "1750 ml": pack_size = ( ('1', '1') ('3', '3') (b, b) (h, h) (d, d) (e, e) (r, r) ) elif c == "1000 ml": pack_size = ( ('1', '1') ('3', '3') ('6', '6') (b, b) (h, h) (d, d) (e, e) (r, r) ) elif c == "750 ml": pack_si

android - Confirm APK identity with keystore -

i building android application communicates online webservice. plan on releasing application's source code on github. production version, utilize personal webservice want allow digitally signed apk connect. is possible request apk's keystore , confirm username/password keystore? if not possible how else can produce functionality? edit: i have read class certificate looks might able user public/private keys confirm identity. still unsure of implementation i use -- static public string getpackagefingerprint( context ctx ) { packagemanager pm = ctx.getpackagemanager(); string packagename = ctx.getpackagename(); int flags = packagemanager.get_signatures; packageinfo packageinfo = null; try { packageinfo = pm.getpackageinfo(packagename, flags); } catch (namenotfoundexception e) { return ""; } signature[] signatures = packageinfo.signatures;

multithreading - Exception in thread "http-8080-10" java.lang.OutOfMemoryError: Java -

i have web application running on 64-bit windows server 2003, oracle 11g database , apache tomcat 6.0 web server. application on live environment , around 3000 of user using application have encountered java heap out of memory error. after increasing heap space it's resolved. now again facing same issue, below error stack trace: exeption in thread "http-8080-10" java.lang.outofmemoryerror: java heap space aug 23, 2013 8:48:00 pm com.sessionclunter getactivesessions exeption in thread "http-8080-11" java.lang.outofmemoryerror: java heap space exeption in thread "http-8080-4" exeption in thread "http-8080-7" java.lang.outofmemoryerror: java heap space your problem caused few things (at conceptual level): you have many simultaneous users or user sessions. you attempting process many user requests simultaneously. you attempting process requests large (in sense). you have memory leak ... related of above issu

database - checking different data value in a same column mysql query? -

id_detail_item id_item id_detail_item_name 1 1 abc 2 1 abcd 3 1 cde 4 3 zki 5 3 zkr how check if there 2 different data in "id_detail_item_name" in same "id_item"? i've tried following, got error: select id_item table_detail_item id_detail_item_name='abc' , id_detail_item_name='abcd'; this should list entries @ least 2 different id_detail_item_name id_item select id_item, min(id_detail_item_name) nam1,max(id_detail_item_name) nam2 table_detail_item group id_item having min(id_detail_item_name) nam1<max(id_detail_item_name)

parent class constructor is called automatically when child class is instantiated in java -

this question has answer here: why constructor of super class invoked when declare object of sub class? (java) 18 answers abstract class { abstract void method(); } class b extends { b() { } void method() { } } class c extends b { c() { } } when instantiate class c in main, automatically calls constructor b (parent class). normal or doing wrong? there nothing wrong, there implicit call super constructor. you haven't written constructor class c default constructor provided compiler be. c(){ super(); } if default constructor provided, there call super() . in case, c extends b constructor of b gets called. if not class other class, default extends object class. object class constructor called.

ruby - yahoo music gem not working -

i want use yahoo music gem, getting error because of activesupport gem. my code require 'yahoo-music' edit 1: eroor loaderror: cannot load such file -- activesupport /users/ashok/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require' /users/ashok/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require' /users/ashok/.rvm/gems/ruby-2.0.0-p247/gems/yahoo-music-0.1.0/lib/yahoo-music.rb:1:in `block in <top (required)>' /users/ashok/.rvm/gems/ruby-2.0.0-p247/gems/yahoo-music-0.1.0/lib/yahoo-music.rb:1:in `each' /users/ashok/.rvm/gems/ruby-2.0.0-p247/gems/yahoo-music-0.1.0/lib/yahoo-music.rb:1:in `<top (required)>' /users/ashok/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:116:in `require' /users/ashok/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ex

javascript - Using getElementByClassName to build an object array -

i using getelementsbyclassname collection of tr . i want iterate through collection , value of textbox in tr . i cannot use jquery or other framework. how can done? var dom = document.getelementsbyclassname('row'); var arr = []; var len = dom.length; (var = 0; < len; i++) { // foo = value of text box in row // bar = value of text box in row var obj = { quantity: foo, price: bar }; arr.push(obj); } firstly, it's getelementsbyclassname , 's' -- can more 1 element, name plural. secondly, getelementsbyclassname not function on it's own, it's method on dom object. if want elements in document match given class name, have call document.getelementsbyclassname() , not getelementsbyclassname() on own. so need this: var dom = document.getelementsbyclassname('row'); the elements within dom object has same methods available root document object, can can call dom[i].getelementsbyclassname() , etc. for

How to make URL case insensitive with Nginx -

i using nginx simple demo website, , configure nginx this: server { listen 80; server_name www.abc.com; location / { index index.html; root /home/www.abc.com/; } } in www.abc.com folder, have sub-folder named sub , , inside has index.html file. when try visit www.abc.com/sub/index.html , works fine. if visit www.abc.com/sub/index.html , returns 404 . how configure nginx case-insensitive in url? server { # default, don't need this! #listen 80; server_name www.abc.com; # index , root global configurations whole server. index index.html; root /home/www.abc.com/; location / { location ~* ^/sub/ { # tilde , asterisks ensure location # matched case insensitive. nginx not support # setting absolutely case insensitive. # reason easy, it's costly in terms of performance. }

c# - Emulating an XBox 360 controller from (not for, from) a laptop -

i want create c# program can control xbox 360 controller, except program on* laptop. however, every time try find pertaining on google, endless flood of questions asking how connect 360 controller laptop, more or less exact opposite of want. does know way want or going have bang head against insurmountable wall 2 days before giving up? if have access development console , sdk out, task impossible retail console , laptop or xbox require hardware modifications work properly, unless want connect via usb. might more plausible then. regardless, if have access proper software might able lend hand.

jquery - Change Div Content with JavaScript, onmouseover and onmouseout? -

i have following code: window.onload = function createdivs() { for(var = 1;i<29;i++) { var div = document.createelement("div"); var body = document.getelementsbytagname("body")[0]; var n1 = document.createtextnode("cell " + i); var n2 = document.createtextnode(i + " cell"); div.style.width = "100px"; div.style.height = "100px"; div.style.border = "1px solid red"; div.style.cssfloat = "left"; div.style.margin = "1px" div.classname = i; body.appendchild(div); } div.onmouseover = function() { this.appendchild(n1); }, div.onmouseout = function() { this.appendchild(n2); } } what want acheive on mouseover of each div, div should have text of cell 1, cell 2, ..... upto cel 28. getting cell 28 on hover each cell. 2. want achieve onmouseout, cell should have

c++ - Initialization List Vs Static Const Initializing -

what faster when creating 100+ newobjs: //initialization list struct struct_obj { ...tonsofvars struct_obj() : tonsofvars(init) {} } or: //static const constructed, call copy constructor(?) static const struct_obj defaultstruct_obj = { tonsofvars(init) }; struct_obj newobj = defaultstruct_obj tonsofvars imply multiple different variables (from pod structs/classes) i assume static const, since calling copy constructor (meaning 1 op?) vs calling each initializer in initalization list? although common response "profile it", doing not give me explanation why faster. it depends on types in tonsofvars . i assume static const, since calling copy constructor (meaning 1 op?) vs calling each initializer in initalization list? it calling 1 copy constructor struct_obj , still needs call copy constructor each field. if pod data, there no difference @ all. however, in types default constructors may faster (or slower) copy constructors, make

jQuery to dynamically add table rows -

i want dynamically add table rows on change of select wrote script this, system not dynamic yet. <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#noofsegments").change(function(){ var counter=${#noofsegments}.val(); for(i=0; i<counter; i++){ var row = $("<tr><td>"i"</td><td>"i"</td><td>"i"</td><td>"i"</td><td>"i"</td></tr>"); $("#segmenttable").append(row); } }); }); </script> <select id="noofsegments"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> and #segmenttable table id above