Posts

Showing posts from April, 2015

asp.net mvc - MVC - display a user profile setting in dropdown list on several pages -

i display value of specific user profile setting in header of every page (_layout.cshtml). see how default mvc web application displays user's name in "welcome user!", name obtained calling user.identity.getusername() . setting want display custom setting. it seem need pass custom setting controller, i'm not sure how controller within _layout.cshtml. i've tried @html.renderpartial, doesn't trigger controller action/method, or can it? i've tried @html.renderaction gets me controller, requires entire view rendered, or there way around this? could tell me razor syntax use view trigger controller action render input control? don't need controller/action logic other return statement. edit @rowan freeman seems pointing me in direction tried. in fairness didn't know need perform post user setting. here code i've tried: viewmodel public class languagelistpartialviewmodel { public string selectedlanguage { get; set; } public ie

byte - Confused about assembly instructions -

i reading tutorial on assembly: http://orangejuiceliberationfront.com/intel-assembler-on-mac-os-x/ , came across basic assembly code: .text .globl _main _main: pushl %ebp movl %esp, %ebp subl $8, %esp movl $0, %eax leave ret and kinda understand of this, don't know why subl $8, %esp called. understand subtracts 8 bytes esp, have no idea why necessary or why done. tutorial said balances stack onto 16-byte boundary, don't know "balancing" stack means or why using number 8 makes 16 byte boundary. later in tutorial show how define function, , call this: .text .globl _dosomething _dosomething: pushl %ebp movl %esp, %ebp subl $8, %esp nop leave ret .globl _main _main: pushl %ebp movl %esp, %ebp subl $24, %esp movl $3, (%esp) call _dosomething movl $0, %eax leave ret and tutorial there "8 align, 16 our 4-byte parameter , padding" on line: subl $

php - Getting app user data in graph api v2, using global IDs -

so version 2 of facebook's graph api introduces app-specific ids, protect user privacy spam or that. said users have added app in v1 using global id continue send global id in v2, keep app backward compatible. this fine, v2 of api forbids getting user data global ids. call graph global ids inside canvas app gives exception saying use app-specific id instead. i'm kind of @ loss here. i'm trying basic information of random subset of app's users, display current user, isn't friend. of users have global ids stored in database because joined long time ago. seems if app new, of ids stored in database app-specific, , able info. indicates me it's not facebook's intent forbid me getting data want. it's impossible me because of unfortunate situation of having old app. is there way me data? know can revert v1 of graph go away on april 30, 2015. want basic info, , i'm displaying names. i using version 4 of php sdk. request looks this: (new facebook

ruby on rails 4 - Unknown format error when trying to respond_to format.xml -

i'm trying parse simple xml post request , send 200 status in response i'm receiving unknown format error, not understand why. action says processing / not xml. great! actioncontroller::unknownformat (actioncontroller::unknownformat): app/controllers/locations_controller.rb:171:in `vz_api' started post "/vz_api" 127.0.0.1 @ 2014-06-25 19:52:27 -0400 processing locationscontroller#vz_api */* def vz_api require 'nokogiri' xml_doc = nokogiri::xml(request.body.read) vin = xml_doc.xpath("//vin").inner_text @truck = truck.find_by(vin: vin) @location = @truck.location lat = xml_doc.xpath("//latitude").inner_text lng = xml_doc.xpath("//longitude").inner_text heading = xml_doc.xpath("//heading").inner_text speed = xml_doc.xpath("//speed")[0].inner_text @location.update_attributes(longitude: lng, latitude: lat, speed: speed, direction: heading) respond_to |for

android - AppCompat ActionBar menu background not working -

i've styled action bar change background: <style name="coloredactionbar" parent="@style/widget.appcompat.light.actionbar.solid.inverse"> <item name="android:background">@color/main_background_color</item> <item name="background">@color/main_background_color</item> </style> <style name="appbasetheme" parent="@style/theme.appcompat.light"> <item name="actionbarstyle">@style/coloredactionbar</item> </style> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> </style> (i placed different styles on values, values-v11 , values-v14). i'm trying change menu background when state pressed. i'm doing this: <item name="actionbuttonstyle">@drawable/actionbar_item</item> and <selector xmlns:android="http://schemas.android.com/apk/res/android&

Google Drive Android API tutorial issue -

Image
following this tutorial , pasted code main activity: @override public void onconnectionfailed(connectionresult connectionresult) { if (connectionresult.hasresolution()) { try { connectionresult.startresolutionforresult(this, resolve_connection_request_code); } catch (intentsender.sendintentexception e) { // unable resolve, message user appropriately } } else { googleplayservicesutil.geterrordialog(connectionresult.geterrorcode(), this, 0).show(); } } i end having import buncha libraries, still can't fix error: resolve_connection_request_code cannot resolved variable any ideas??? can't figure out library contains constant... turns out when tutorial specifies start android project, mean google drive android project, has different imports , class definitions, aren't made clear tutorial. give starter code google drive android project, mislabeled "android quickstart" assumed no dif

javascript - Angular data issue- not sure how to troubleshoot -

i have controller (code below) links d3-cloud directive , works perfectly. data added in controller , passed directive. myapp.controller('downloadscloudctrl', ['$scope', '$rootscope', 'requestservice', '$cookiestore', function($scope, $rootscope, requestservice, $cookiestore){ $scope.d3data = [ { 'kword': 'a', 'count': 141658, },{ 'kword': 'b', 'count': 105465, } ]; }]); now i'm trying pull data json request service switching controller following code. when console.log in controller underneath $scope.d3data = data line, appears working (the proper data returned). however, breaks when trying link controller directive, reason the directive getting undefined/null data set. i'm wondering if issue in the ord

ruby on rails - Filtering by value calculated in instance method -

i have house model has price attribute calculated using instance method. let's price changing due market rates, inflation, etc. need price_today method current price. how can create named scope (or something) filter houses using maximum price , minimum price? i tried doing this, feel it's little hacky... def index @houses = # houses db if not params[:max_price].nil? @houses.keep_if { |h| h.price_today <= params[:max_price].to_f } end if not params[:min_price].nil? @houses.keep_if { |h| h.price_today >= params[:min_price].to_f } end end a named scope (or where clause) faster querying , filtering instantiated objects. however, i'm afraid if price_today not exist in db won't able use them. you can improve code, though. conditions can made simpler, , can use single call keep_if . max = params[:max_price].presence min = params[:min_price].presence if max || min @houses.keep_if |house| = max ?

matplotlib - Python "Invalid rgb arg "None"" -

i have code creates , saves plot, using matplotlib , python. code runs flawlessly @ laptop of supervisor, has matplotlib 1.1.1. however, despite fact have newer version of matplotlib(1.3.1) following error when executing command: plt.savefig("outputs/" + run_uuid +".pdf", facecolor='white', bbox_inches='tight', pad_inches=0.0) i following traceback on command: traceback (most recent call last): file "vis.py", line 1116, in <module> plt.savefig("outputs/" + run_uuid +".pdf", facecolor='white', bbox_inches='tight', pad_inches=0.0) file "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 561, in savefig return fig.savefig(*args, **kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1421, in savefig self.canvas.print_figure(*args, **kwargs) file "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 2167, in p

java - BlueCove on Windows 8 -

has tried run bluecove on windows 8? have win8 laptop. tried downgrading win7, don't support win7 drivers. does newest snapshot allow bluecove run on win 8? you can use newest version(2.1.2) of bluecove. not officially announced official bluecove team has native osx 64 bit support , solution win 8. found version @ bluecove issue page . please under comment #21. if want can download here .

html - Problems with multiple hover states - not sure if adjacent or sibling selectors? -

Image
it's little thing me unstuck. i'm trying make hover on navigation element effect 3 elements. background colour, text colour, , small arrow below text. the background colour easy enough, text colour changes when hover on actual text - not whole block element (framed background colour). also, wanted image swap little arrow beneath text well. example: here site: maci test website i've read on adjacent , sibling selectors - can't quite want. it's obvious, can't see @ moment! appreciated :) put coloring on link instead of li, , make link block element fill li area: ul.menu { display:block; background-color:#ffffff; } ul.menu a:hover { background-color:#ae242a; color:#ffffff; } also, put arrow image non-repeating background image link, , set different 1 regular link , hover link. another thought, have tried: ul.menu li.nav-links:hover a.nav { color:#ffffff; }

php - For each / query doesn't give the right value -

i have table in database. want ltotal value leave table, , count of ltotal . here query , code use: $annual_query = pg_query("select ltotal leave lapplicant='adam' , ltype=2"); $annual_result = pg_fetch_array($annual_query); if (pg_num_rows($annual_query) > 0) { foreach ($annual_result $data) { $total_annual = $total_annual + $data; } print($total_annual); } there 3 records in table leave lapplicant='adam' , ltype=2 . each ltotal 1. when tried run print($total_annual) result 2 (it must 3). then tried print_r($annual_result['ltotal'] ), results 1 (it must 1,1,1). can me? thank you. pg_fetch_array() returns 1 row numeric , associative keys (same value twice when traversed). should use pg_fetch_all() , traverse or use while loop on consecutive rows. $total_annual = 0; $annual_query = pg_query("select ltota

perl - Change output filename from WGET when using input file option -

i have perl script wrote gets image urls, puts urls input file, , proceeds run wget --input-file option. works perfectly... or @ least did long image filenames unique. i have new company sending me data , use troublesome naming scheme. files have same name, 0.jpg , in different folders. for example: cdn.blah.com/folder/folder/202793000/202793123/0.jpg cdn.blah.com/folder/folder/198478000/198478725/0.jpg cdn.blah.com/folder/folder/198594000/198594080/0.jpg when run script this, wget works fine , downloads images, titled 0.jpg.1 , 0.jpg.2 , 0.jpg.3 , etc. can't count them , rename them because files can broken, not available, whatever. i tried running wget once each file -o , it's embarrassingly slow: starting program, connecting site, downloading, , ending program. thousands of times. it's hour vs minutes. so, i'm trying find method change output filenames wget without taking long. original approach works don't want change unless necessary, open sugg

cocos2d x - [Cocos2dx - TiledMap]Get black vertical lines when move map -

i make game cocos2d-x , tilemap follow tutorial cocos2d-x tile map tutorial it working fine when move map, black vertical lines on screen. http://i689.photobucket.com/albums/vv255/thansaulove/error2.png anyone have solution fix it? many in advance. there way fix this. worked me. find cccongig.h file , change value of cc_fix_artifacts_by_streching_texel 1

android - In a TextView, what's the height of blank between the content text and the border of the TextView? -

there blank between content text , border of textview , if padding 0. , if height of textview , content text set same value, text not displayed. so, what's height of blank between content text , border of textview? the spacing built font. it's there accomodate special characters tall. similar question: how remove top , bottom space on textview of android adding android:includefontpadding="false" may little, i've found doesn't much.

PHP check array contain multiple sub arrays with data array OR just one data array -

i got array call api , need parse it. return single data array this array{ [name] => aaa [address] => bbb [country] => ccc } or return multiple data arrays this array{ [0]=>array{ [name] => aaa [address] => bbb [country] => ccc } [1]=>array{ [name] => qqq [address] => www [country] => eee } [2]=>array{ [name] => ttt [address] => yyy [country] => uuu } } what best way determine return array contain multiple arrays? or if statement it? know how write function , return or not. foreach check is_array return there express way or php function can it? you can use isset know wether or not first index number (multi-dimensional) or not (uni-dimensional): if (isset($array[0]) { // since index 0 not key 'name' // array multi-dimensional } else { // since first index not 0, array // uni-dimensional }

postgresql - Cakephp Migrations.migration run all get Error: Database connection "Postgres" is missing, or could not be created -

someone please me, i'm new in postgresgl. im developing application cakephp 2.5.1 migrations plugin run sql query under ubuntu console. if try create simple script testing purpose, this: http://pastebin.com/dyv48vqc it's work! but don't know happend when try run migrations.migration run under ubuntu console, error this: http://pastebin.com/tbtr8fgp and here config/database.php file content, used same user, pass, host, port , db name: http://pastebin.com/3bzuqxmr i have check ubuntu console, , pdo pgsql has been enabled http://pastebin.com/9acl5ys8 please me, thank much. this issue resolved. make fresh installation of ubuntu , service. such apache, php, mysql, postgres. works! thanks.

r - How to filter a set of value from matrix with citeria in a vector without a loop? -

i have matrix source (a), first column key, , second value each key. __0_1 22034 __1000000000000_1 34310 __1000000000000_2 38608 __1000000000_1 18829 __1000_1 38674 __11_november_1 21566 __11_plus_1 35908 __12_1 25784 __14_july_1 28671 __15_may_organization_1 36358 and vector b subset of key need assign value base on matrix a. b: __14_july_1 __1000000000_1 _15_may_organization_1 here code find value b matrix a: for (i in 1:length(b)){ rlst<-a[a[,1]==b[i],2]; } it work & b small. real data big, , loop make me lost lot of time. tried command %in%,subset. not working problem. please me solve problem without for . i'm going assume expect 1 match each value of b. here sample data sets a<-data.frame( v1 = c("__0_1", "__1000000000000_1", "__1000000000000_2", "__1000000000_1", "__1000_1

javascript - jQuery selectors not working after ASP.NET postback (no UpdatePanels, not AJAX) -

i need make change old page possible, , effort ajax-ify in order obviate postbacks take long (making more correct version of have come later, new functionality needs in place asap). javscript changes required complicated attempt entirely in plain js page uses (it's enough of mess is), decided implement new functionality using jquery. everything works fine until there's postback, after document ready function still runs, selectors no longer find anything. i'm not using asp.net ajax, there's no updatepanels or partial postbacks. what's happening , how can fix in simplest, fastest possible way? while $(document).ready() ideal one-time initialization routines, leaves hanging if have code needs re-run after every partial postback. of course there ways around this. can try using .net franeworks pageload() , bind events there , see if selectors still work after postback. <script type="text/javascript"> function pageload() { $(&quo

Learn Python the hard way Exercise 13 error -

every time run program "valueerror: need more 1 variable." i'm doing zed says running ex13.py first 2nd 3rd . don't need type python in terminal before filename because computer recognizes python files. i'm on windows 7 , using python 2.7. appreciated. i've tried popular answer in thread: valueerror: need more 1 value unpack , i'm still getting same error. appreciated from sys import argv script, first, second, third = argv print "the script called:", script print "your first variable is:", first print "your second variable is:", second print "your third variable is:", third edit: here's error i'm getting: traceback (most recent call last): file "c:\users\ian\lpthw\ex13.py", line 3, in script, first, second, third = argv valueerror: need more 1 value unpack it's winston ewert said in comments. have tell system where's python , otherwise won't able run script

sql - Dynamic Query for record fetch -

i having scenario this databse 1 inserting table : id person 1 john before inserting record have make sure person exists handeled in other db database 2; person ou john 1 shyam 2 database 3: person ou ram 5 .... once record exists have insert same record in database. if nothing exists pop error person entered invalid. i have tried code select *, row_number() over(order name) 'r' #temp sys.databases database_id not in (1,2,3,4,db_id(db_name())) declare @int =1 declare @person varchar(100) = person inserting (nolock) declare @dbname varchar(max) declare @sql nvarchar(max) while (@i <= (select max(r) #temp)) begin set @dbname = (select name #temp r = @i) set @sql = 'if exists (select 1 '''+ @dbname+'''..person person = +'''@person'''+)' execute sp_executesql @sql set @i = (select max(r) #temp))+2 else set @i = @i+1 end if @i> (select ma

jquery - Stop JqueryUI Datepicker Months Navigation After A particular Year Ends -

i have used jqueryui datepicker, have add list of holidays particular year. is there way disable datepicker's month navigation after particuler year ends? eg. if adding holidays list year 2014, want disable datepicker's prev month navigation (prev button) when january 2014 month selected. , if december 2014 month selected, want disable next month navigation button(next button). further not want use changeyear/changemonth options on datepicker. my code is: $(document).ready(function () { $("#txtholidaydate").datepicker( { dateformat: 'dd/mm/yy' }); }); thanks, i have made jsfiddle restrict date range year entered user. check out ! html: <h3>currently dates restricted year 2014</h3> enter year restrict date range to: <input type="text" id="year" size="30" value="2014"/> <input type="button" id="change_year" value="c

Count from json data Rails -

i'm looking count json data it's outputting: [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0] view <%= @overall %> where 1's greater 40. instead of '2'. json data formatted url: {"status": "ok", "data": [{"2014-06-16": 32.1},{"2014-06-17": 30.2},{"2014-06-18": 42.9}]} etc controller @data = json.parse(open(@temperature.url).read) @overall = [] @data['data'].each |data| dates << data.keys temps << data.values @overall << data.values.count { |i| > 40 } end since json data: array assuming multiple dates represented multiple hashes (one each day). correct? {"status": "ok", "data": [{"2014-06-16": 42.1}, {"2014-06-17": 45.5}] if that's case, should work: @data = json.parse(open(@temperature.url).read) dates = @data['data'].map {|data| data.keys.first} temps

How to get Number from a text in Jquery -

i have got text quantity 2 in format . how extract number above variable . i tried way , displaing nan . var lasth6= 'quantity 2'; var number = parseint(lasth6, 10); alert(number); this jsfiddle http://jsfiddle.net/gstdu/10/ could please . how ?? you can remove non integer characters using: .replace( /[^\d.]/g, '' ) and using .parseint() : parseint(lasth6.replace( /[^\d.]/g, '' ), 10) working demo

autohotkey - Finding the scan code of FN Key -

i want use fn + s emulate ctrl + s , far code: #installkeybdhook #persistent sc126 & s:: send ^{s} return my problem don't know fn key's scan code. how can find it? the fn key not have scan code. the keyboard driver not expose fn key operating system, operating system (and therefore autohotkey) not know exists. when press fn key in combination supported key, keyboard driver reports single key press operating system different scan code. basically, tells operating system different key pressed.

Writing Json in for loop in Python -

i downloading json files api, use following code write json. each item loop gives me json file. need save , extract entities appended json file using loop. for item in style_ls: dat = get_json(api, item) specs_dict[item] = dat open("specs_append.txt", "a") myfile: json.dump(dat, myfile) myfile.close() print item open ("specs_data.txt", "w") file: json.dump(spec_dict, myfile) myfile.close() i know cannot valid json format specs_append.txt , can 1 specs_data.txt . doing first 1 because program needs atleast 3-4 days complete , there high chances system may shutdown. there anyway can efficiently ? if not there anyway can extract specs_append.txt <{json}{json}> format (which not valid json format)? if not should write specs_dict txt file every time in loop, if program gets terminated can start if point in loop , still valid json format? i suggest several possible solutions. one s

visual studio - VS2013 create new class from template -

hi possible create template visual studio, when create new class contains description in header ? on visual studio 2012 this: find files c:\\microsoft visual studio 11.0\common7\ide\itemtemplates\csharp\code\1033 the file want in appropriately named folder. if open class folder find following 2 files: class.cs class.vstemplate backup original files change class.cs template file save changes tell visual studio changes your new changes not loaded unless explicitly tell visual studio reload templates. close visual studio (or change swill not show until next time run it) open command prompt (you should run administrator if not admin of machine). change ide folder few levels above template folder (e.g. c:\\microsoft visual studio 10.0\common7\ide) run following command: devenv.exe /installvstemplates

multithreading - Proper way to start thread from python daemon -

i need write simple daemon web interface. the idea use python-daemon package , run wsgiref.simple_server inside 1 thread. daemon works fine following code : import daemon import logging import time import signal import threading logfilename = '/var/log/testdaemon.log' logger = logging.getlogger("daemonlog") logger.setlevel(logging.info) formatter = logging.formatter( '%(asctime)s:%(levelname)s:%(message)s', '%y-%m-%d %h:%m:%s') handler = logging.filehandler(logfilename) handler.setformatter(formatter) logger.addhandler(handler) def initial_program_setup(): logger.info('daemon started') def do_main_program(): while true: time.sleep(1) logger.info('another second passed') def program_cleanup(signum, frame): logger.info('daemon stops') context.terminate(signum, frame) def reload_program_config(signum, frame): logger.info('reloading config') context = daemon.daemo

Android App exits after choosing image from gallery -

here's code: package com.survey.sop; import android.net.uri; import android.os.bundle; import android.provider.mediastore; import android.app.activity; import android.content.contenturis; import android.content.intent; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.util.log; import android.view.view; import android.widget.button; import android.widget.imageview; import android.widget.textview; import android.widget.toast; import android.view.view.onclicklistener; public class signup extends activity { private static int result_load_image = 1; sqlitedatabase mydb = null; textview name ; textview address; textview birthdate; textview email; textview username; textview password; button signup; imageview imgavatar; int id_to_update = 0; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.signup);

How to import database to PostgreSQL as root? -

i want import database of mine database of server. so, copied database dump file server's root directory , logged in , did this: root@iwidgetserver1:~# sudo -u postgres psql -u iwidget -d iwidget -f iwidget_dump2.sql not change directory "/root" psql: fatal: peer authentication failed user "iwidget" however, iwidget role , has granted priviliges database: root@iwidgetserver1:~# sudo -u postgres psql -l not change directory "/root" list of databases name | owner | encoding | collate | ctype | access privileges ------------------+----------+----------+-------------+-------------+----------------------- iwidget | iwidget | utf8 | en_gb.utf-8 | en_gb.utf-8 | =tc/iwidget + | | | | | iwidget=ctc/iwidget postgres | postgres | utf8 | en_gb.utf-8 | en_gb.utf-8 | sample_db | post

java - Azure storage block blob upload from android example -

i using following code android application upload blob azure blob storage. note: sasurl parameter below signed url acquired web service : // upload file azure blob storage private static boolean upload(string sasurl, string filepath, string mimetype) { try { // file data file file = new file(filepath); if (!file.exists()) { return false; } string absolutefilepath = file.getabsolutepath(); fileinputstream fis = new fileinputstream(absolutefilepath); int bytesread = 0; bytearrayoutputstream bos = new bytearrayoutputstream(); byte[] b = new byte[1024]; while ((bytesread = fis.read(b)) != -1) { bos.write(b, 0, bytesread); } fis.close(); byte[] bytes = bos.tobytearray(); // post our image data (byte array) server url url = new url(sasurl.repla

php - Symfony 2 Unable to find the controller for path /login_check -

i'm deploying symfony2 based application in production server i'm unable login. error saying controller parameter route /login_check missing. should handled firewall configuration incluided in security.yml file , security.yml file included in app/config/config.yml file. application deploys fine in development machine , can login (with prod configuration) 500 error in server when try access /login_check route. hint useful , welcome. in advance. i following error in prod.log: [2014-06-26 00:52:56] security.debug: write securitycontext in session [] [] [2014-06-26 00:53:12] request.info: matched route "login_check" (parameters: "_route": "login_check") [] [] [2014-06-26 00:53:12] security.info: populated securitycontext anonymous token [] [] [2014-06-26 00:53:12] security.info: no expression found; abstaining voting. [] [] [2014-06-26 00:53:12] request.warning: unable controller "_controller" parameter missing [] [] [2014-06-26

android - view is not getting inflated after a fragment is added on the framelayout -

i have strange problem, placed layout files in layout-large-land(landscape mode) folder , and added fragment on button click... fragment correctly inflated , if try add more fragments fragment issue view not showing, tried toast message in oncreateview, strangely toast showing view not showing, strange part code portrait mode working fine, newbie android can help.. this fragment call chooseactivity.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // todo auto-generated method stub system.out.println("captain"); addfragment(new chooseactivityfragment(), true, fragmenttransaction.transit_none, "choose_activity"); } }); this added fragment @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { system.out.println("-----oncrea

ios - After dismissViewController my view remain in previous view controller's orientation in iOS7 -

as working ios application support portrait orientation . getting orientation related issue. my app support portrait orientation when parent p1.view push using navigation in portrait mode thats fine. p1.view subviewing child view c1.view now in childview c1.view , there using delegate calling -(void)imagepickercontroller:(uiimagepickercontroller *)picker [self.delegate opencamera] ;//called c1.view -(void)opencamera //declared in p1.view { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.delegate = self; picker.allowsediting = no; picker.sourcetype = uiimagepickercontrollersourcetypecamera;> [self presentmodalviewcontroller:picker animated:yes]; } now when capture photo in lanscape mode , dismiss presentmodalviewcontroller view appears in landscapmode instead of portrait mode. - (bool)shouldautorotate { return yes; } - (bool)shouldautorot

java - Display fullname of JCheckBox item -

Image
i had design jframe components. in jcheckbox component had given name full name not displayed when run application. want display given name. code public class finddemo extends jframe { label l1; jcheckbox matchcase,matchwholewords; textfield tf; jbutton find_next,cancel; public finddemo() { l1 = new label("find what: "); matchcase=new jcheckbox(); matchcase.settext("match case "); matchwholewords=new jcheckbox("match whole words "); tf = new textfield(30); find_next = new jbutton("find next"); cancel = new jbutton("cancel"); setlayout(null); int label_w = 80; int label_h = 20; int tf_w = 120; l1.setbounds(10,10, label_w, label_h); add(l1); tf.setbounds(10+label_w, 10, tf_w, 20); add(tf); matchcase.setbounds(10, 10+label_h+10, label_w, label_h); add(matchcase); matchwholewords.setbounds(10, 10+label_h+35, label_w, label_h); add(matchwhol

r - How to add whitespace to an RMarkdown document? -

is there way adding latex code in text or solution lie in (r)markdown? no sign of solution here: http://rmarkdown.rstudio.com/pdf_document_format.html at present i'm bodging solution adding monospace signature bottom of 1st page, force next section start on page 2: https://github.com/robinlovelace/creating-maps-in-r/blob/master/intro-spatial-rl.pdf you can use latex inside rmd file. have page break, add \newpage . example.rmd title ==================== test rmd document. \newpage second page ==================== text on second page you make pdf using render("example.rmd", output_format='pdf_document') hope helps, alex

c++ - Face recognition using neural networks -

i doing project on face recognition, have used different methods eigenface, fisherface, lbp histograms , surf. these methods not giving me accurate result. surf gives matches exact same images, need match 1 image it's own different poses(wearing glasses,side pose,if covering face) etc. lbp compares histogram of images, i.e., color informations. when there high variation on lighting condition not showing results. heard neural networks, don't know that. possible train system accurately using neural networks. if possible how can that? according this opencv page, there seem support machine learning. being said, support seem bit limited. what do, to: user opencv extract face of person. change image grey scale. try manipulate face same size. all above should doable opencv (could wrong, haven't messed opencv in while) should save time. next, take image, bitmap maybe, , feed bitmap vector neural network. alternatively, @matthiasb recommended, feed featur

javascript - How to target a div by class name inside another class -

i have divs this. <div class"parent"> <div class"child"> stuff here </div> </div> <div class"parent"> <div class"child"> other kinda stuff here </div> </div> i want click parent class , show child class inside parent without showing other children classes in other parent classes. $(document).on('click', '.parent', function(){ $(this).find($('.child').show(500)); }); pass selector string find() not object - passing jquery object. have invalid html because class"parent" should class="parent" . demo $(document).on('click', '.parent', function(){ $(this).find('.child').show(500); });

jQuery showing Unexpected token ; -

i given code below answer question asked giving me unexpected token ; . have feeling missing closing ) have added them in , still not resolved have missed. why getting unexpected token ; ? code: <script> jquery(window).on('click', '.add_to_cart.button', function() { call_ajax_add_to_quotelist(add_to_quotelist_ajax_url, $(this).data('id'); } </script> missing closing ) on function call , @ end of handler jquery(window).on('click', '.add_to_cart.button', function() { call_ajax_add_to_quotelist(add_to_quotelist_ajax_url, $(this).data('id')); //here }); //and here

html - Upgrading Dropdown Menus -

i teacher, , run blog via blogger.com class. link http://stmlatin2019.blogspot.com you'll notice have drop-down menus in left sidebar of blog. these work beautifully on laptop , on desktop. problem school switching ipads, , having trouble getting menus work on ipad browsers. open in chrome, security restrictions on campus distort of blog on chrome. my question this: while know not apple forum, show me how tweak code dropdown menus work in ipad browsers safari? currently, safari lets me pull down menu , make selection, nothing happens once make selection. i guess should know absolutely nothing coding. in fact, stumbled upon dropdown code on accident couple of years ago, and, miraculously, got work. i'm square one. here code 1 of menus can see i'm dealing with: <select style="background-color:#eee9dd" id="select1" onchange="window.open(this.options[this.selectedindex].value,'_blank');this.options [0].selected=true" class

php - Returning an array with PDO - using FetchAll doesn't work -

i use following code retrieve data database. problem displays first row. in particular case, means first picture shown on webpage want show of them. <?php $sql = "select `image-id`, `article-id`, `image-path`, `image-title` `table-images` `article-id` = :id"; $stmt = $pdo->prepare($sql); $stmt->bindparam(":id", $id); $stmt->execute(); if($result = $stmt->fetch(pdo::fetch_assoc)) { ?> <a class="swipebox" href="<?php echo $result['image-path'];?>" title="<?php echo $result['image-title'];?>"> <img alt="image" src="<?php echo $result['image-path'];?>"></a> <?php }// end if else { echo '0 results'; }// end else ?> i read this article tried use code: if($result = $stmt->fetchall(pdo::fetch_assoc));? ... doesn't work. doesn't echo first picture anymore. missing her

css - Tablesorter jQuery plugin width of column -

i use jquery plugin tablesorter. columns have same width. change width of first column via css, there no change. i tried add widthfixed: false : $("#activitiestable").tablesorter( { widthfixed: false } ); still there no change in column's width. how can change column's width in table, when using tablesorter? thanks

html - Javascript Specificity (Only Respond to Clicked Item) -

i'm new javascript , looking way have code respond clicked item in list. (full jsfiddle here: http://jsfiddle.net/5cjpf/ , although reason buttons aren't responsive...) for functions below, each applies clicked item, however, right first item each refers responding. friend of mine suggesting creating class each function, have no idea begin , appreciate push in right direction! <script type="text/javascript"> var submitcount = 0; function arrow() { if (submitcount == 0 || submitcount % 2 == 0) { var extension = document.getelementbyid('one'); extension.insertadjacenthtml('beforeend', '<div id="before-two"><div id="two"><div class="btn-group"><!----><button type="button" class="left" onclick="modify_qtytag(1)"></button><!----><button type="button" class="tag" id=tag>synon