Posts

Showing posts from August, 2015

sql - What is wrong with JPQL (count and select) -

below query rows parent table , count of each id child table. @query("select cnt idcount, person person person,(select count(child.id) cnt child child child.id :input_id) idcount person.id :input_id") list<person> searchpersonwithcount(@param("input_id") long input_id); i below error: caused by: org.hibernate.hql.internal.ast.querysyntaxexception: unexpected token: idcount near line 1, column 12 [select cnt idcount, person com.myc.cc.domain.person person,(select count(child.id) cnt com.myc.cc.domain.child child child.id :input_id) idcount person.id :input_id] @ org.hibernate.hql.internal.ast.querysyntaxexception.convert(querysyntaxexception.java:54) when execute in oracle sqldeveloper able results. native query executed in qracle sql developer: select cnt idcount, person.* person person,(select count(*) cnt child child id = '1235') idcount id = '1235' result: idcount id name 2 1235 p...

gradle - How to create sitemap.xml from docbook source -

i need generate sitemap.xml in standard google acceptable format docbook source. i'm using gradle power build process. is there existing tool out there generate sitemap.xml automatically part of build? by using ant gradle seams possible there apache ant task generating xml sitemap . read manual @ github , usage details. <target name="generate_sitemap" description="generates sitemap"> <taskdef classname="uk.co.arjones.ant.task.sitemap" name="sitemap"></taskdef> <sitemap url="http://organisation.org" gzip="yes" lastmod="now" destdir="${build_dir}"> <fileset dir="${build_dir}"> <include name="**.docbook"></include> <include name="**.dbx"></include> <exclude name="google*"></exclude> </fileset> </sitemap> ...

How do I start an SSH session locally using Python? -

what mean ask is, if on system "a" (linux) , want ssh system "b" (windows): on system "a", can ssh admin@xx.xx.xx.xx prompt me password , when gets authenticated, "$" of system "b" (on system "a"). how send username , password single line (since want use script) how achieve scenario have above. i paramiko, easier import paramiko # ssh print 'enter ssh' ssh = paramiko.sshclient() ssh.set_missing_host_key_policy(paramiko.autoaddpolicy()) # automatically add keys ssh.connect(machinehostname, username=user, password=password) # run commands # example 1 : ls command print 'do ls command' stdin, stdout, stderr = ssh.exec_command('ls') print stdout.readlines() time.sleep(2) # example 2 : change ip address print 'changing ip address' stdin, stdout, stderr = ssh.exec_command('sed -i -- s/'+oldip+'/'+newip+'/g /etc/sysconfig/network-scripts/ifcfg-eth0') print...

c# - PInvoke SLAPI Functions -

i'm trying use functions in slapi i'm new pinvoke , i'm struggling this. take slgetpkeyinformation example: hresult winapi slgetpkeyinformation( _in_ hslc hslc, _in_ const slid *ppkeyid, _in_ pcwstr pwszvaluename, _out_opt_ sldatatype *pedatatype, _out_ uint *pcbvalue, _out_ pbyte *ppbvalue ); https://msdn.microsoft.com/en-us/library/windows/desktop/hh971173(v=vs.85).aspx i don't understand hslc type is, able provide sample code using function in c#? hslc defined in slpublic.h as: typedef pvoid hslc; so can treated anonymous handle type in winapi , passed around c# code intptr.

c# - Extract the byte array of Zip files sent from C # in Objective-c side -

it passes c # byte array of zip files via plugin in objective-c, want thaw in objective-c side, suffering not go well. byte data has been converted nsdata type using zlib following url reference tried thaw but, inflate (& stream, z_no_flush); of after review of our return value, have been returned z_data_error data can not decompressed zlib determined have been input not know cause, please tell me if there people knowledge ■ url https://gist.github.com/hacha/9207616 http://www.zlib.net/zlib_how.html sourcecode(c#) using unityengine; using system.collections; using system.runtime.interopservices; public class callplugin : monobehaviour { [dllimport("__internal")] private static extern void uncompressbygzip(byte[] zipbytearray,int ziplen); public void callmain(byte[] unzipstream,int unziplength){ uncompressbygzip (unzipstream,unziplength); debug.log ("test csharp"); } } sourcecode(objective-c) #import <fo...

php - LDAP login page doesn't work -

i installed php on iis , tested script, there no response after either enter correct or incorrect login details. try telnet ldap server , connect properly. <?php $ldapserver = "ldap.server.com"; // ldap server $ldapsuffix = "o=companyname, o=companynet"; // ldap tree if (!empty($_post['login'])) { //print_r($_post); echo "<br><br>"; $userid = $_post['username']; // user key userid or email $userpassword = $_post['userpassword']; // user key password $ds=ldap_connect($ldapserver); ldap_set_option($ds, ldap_opt_protocol_version, 3); $bind=@ldap_search($ds, $ldapsuffix, "uid=".$userid); if ($bind) { echo "ldap bind success <br>"; $result = @ldap_get_entries($ds, $bind); if ($result[0]) { if (@ldap_bind( $ds, $result[0]['dn'], $userpassword)) { echo "user bind suc...

Tomcat8 Gzip Compression for CSS, JS -

i using tomcat8 , trying simulate gzip compression of css , js. have added entry in server.xml , follows <connector port="8088" protocol="http/1.1" connectiontimeout="20000" redirectport="8443" compression="on" compressionminsize="2048" nocompressionuseragents="gozilla, traviata" compressablemimetype="text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json" /> and in html page have included script follows <script type="text/javascript" src="extjs/ext-all-debug.js"></script> but while accessing page, compression not happening , resposne header received follows. remote address:[::1]:8088 request url:http://localhost:8088/test/extjs/ext-all-debug.js request method:get status code:200 ok response headers view source accept-ranges:bytes conte...

c# - ObjectContext instance has been disposed error -

i new ef , have following query: list<test.memberaccount> useraccounts = new list<test.memberaccount>(); using (var context = new coopentities1()) { var query = s in context.memberaccount join sa in context.accounttype on s.account_type_id equals sa.id s.member_guid == memberid select s; useraccounts = query.tolist(); } return useraccounts; problem when load page following error: "the objectcontext instance has been disposed , can no longer used operations require connection." any fantastic. error in detail: accounttype = '((new system.collections.generic.mscorlib_collectiondebugview<test.memberaccount> (useraccounts)).items[0]).accounttype' threw exception of type 'system.objectdisposedexception' accounttype not being eagerly loaded. since you're sticking query syntax, following: list<test.memberaccount> useraccounts = new list<test.memberacco...

php - Need help retrieving a uri segment in codeigniter -

i have url in codeigniter encrypted value. when try uri segment codeigniter not able find it. is there anyway can use prefix find it?? below url using localhost/sandbox/index.php/client/applicants/applicantslist/index?proj=ijo7w%2bricislaru8qcjznxc7s7c3mi%2bvyon49ufsf9u%3d/5 //set 11 testing purposes $config['total_rows'] = 11; $config['per_page'] = 5; $config['num_links'] = 4; $config["prefix"] = "page="; // showing nothing fb($this->uri->segment("5")); a segment part of url itself, i.e. index available or applicantslist available. anything after ? within scope of $_get variables or codeigniter $this->input->get() it looks should using $this->input->get('proj') in case

ios - Xcode Dismiss Keyboard Login Screen -

i'm working on application has functioning keyboard editing capabilities. in mainviewcontroller.m file, able hide keyboard following line of code: - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { [self.view endediting:yes]; [super touchesbegan:touches withevent:event]; } after completing main functionality of application, i've created simple login screen. however, same code above not working in loginscreen.m file. @implementation loginscreen -(void)viewdidload { [super viewdidload]; } - (void)touchesbegan:(nsset *)touches withevent:(uievent *)event { [self.view endediting:yes]; [super touchesbegan:touches withevent:event]; } #pragma mark - view lifecycle - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)interfaceorientation { // return yes supported orientations return (interfaceorientation == uiinterfaceorientationportrait); } -(ibaction)btnloginregistertapped:(uibutton*)sender { //form f...

php call include inside function for outside function use -

i want include file php inside of function, used outside of function. function add( $f ){ $i = 3; while( $i > 0 ){ $i--; try{ if( ( include $globals['_server']['document_root'] . $f ) == 2 ){ break; } else{ sleep( 1 ); } } catch( exception $e ){ } } die(); } this function automatically included auto_prepend_file . index.php add( '/cat.php' ); echo 'my' . $cat; /cat.php $cat = 'cat'; echo '...'; return 2; //rather not exist doesnt seem there's choice when index.php loaded: results in my... not my...cat . include returns 1 if file included or not. well, if notepad++ 50% finished uploading file @ same time include d, return 1 , seems includes empty file. why == 2 exists in add function. if want include something, don't want answer you got lucky or nope, better luck next t...

sql server - Query works in Sql but returns empty datatable -

edit i'm confused, changed if statement: if data.rows.count > 0 'do voucher things in here else txtvoucher.text = "sorry, invalid voucher" end if to display query voucher checking function outputting 1 of voucher's string properties, this: else txtvoucher.text = voucher.vouchername end if and works fine! if change error message... datatable returns no rows. haven't changed else code, goes textbox if row count 0. shouldn't row count same regardless of send textbox afterward? end edit i making basic online voucher function webpage , having issues voucher checking query. i have query, checks string entered textbox against sql table match. public shared function checkforvoucher(byval strvouchername string) datatable dim connect new sqlconnection dim data new datatable 'connection works, finds number of vouchers in db match either code or id. id used randomly generated vouchers. connect.connectionstring = "se...

rstudio - How to read every .csv file in R and export them into single large file -

hi have data in following format 101,20130826t155649 ------------------------------------------------------------------------ 3,1,round-0,10552,180,yellow 12002,1,round-1,19502,150,yellow 22452,1,round-2,28957,130,yellow,30457,160,brake,31457,170,red 38657,1,round-3,46662,160,yellow,47912,185,red and have been reading them , cleaning/formating them code b <- read.table("sid-101-20130826t155649.csv", sep = ',', fill=true, col.names=paste("v", 1:18,sep="") ) b$id<- b[1,1] b<-b[-1,] b<-b[-1,] b$yellow<-b$v6 and on there 300 files this, , ideally compiled without first 2 lines, since first line id , made separate column identity these data. know how read these table , clean , format way want compile them large file , export them? you can use lapply read files, clean , format them, , store resulting data frames in list. use do.call combine of data frames single large data frame. # vector of files names read files....

node.js - Why does nodejs have incremental memory usage? -

Image
i have gameserver.js file on 100kb's in size. , kept checking task manager after each refresh on browser , kept seeing node.exe memory usage keep rising every refresh. i'm using ws module here: https://github.com/websockets/ws , figured, know what, there memory leak in my code somewhere.... so double check , isolate issue created test.js file , put in default ws code block: var websocketserver = require('ws').server , wss = new websocketserver({ port: 9300 }); wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { console.log('received: %s', message); }); }); and started up: now, check node.exe 's memory usage: the incremental part makes me confused is: if refresh browser makes connection port 9300 websocket server , @ task manager.. shows: which at: 14,500 k . and keeps on rising upon each refresh, theoretically if keep refreshing go through roof. intended? ther...

pdf generation - Django error xhtml2pdf -

i trying generate pdf xhtml2pdf using helper called django-xhtml2pdf getting error library xhtml2pdf. can me? this error. thanks syntaxerror @ / invalid syntax (util.py, line 302) request method: request url: http://localhost:8000/ django version: 1.7.7 exception type: syntaxerror exception value: invalid syntax (util.py, line 302) exception location: /usr/lib/python3.4/site-packages/xhtml2pdf/__init__.py in <module>, line 41 python executable: /usr/bin/python python version: 3.4.3 python path: ['/home/ed/syscat', '/usr/lib/python34.zip', '/usr/lib/python3.4', '/usr/lib/python3.4/plat-linux', '/usr/lib/python3.4/lib-dynload', '/usr/lib/python3.4/site-packages']

java - OrderBy clause is breaking my OData Service implemented using Apache Olingo -

i have developed odata service using apache olingo.when query url containing 'orderby',it throwing error whereas query without orderby running fine. successful url- http://localhost:8081/peoplefinderservice/peoplefinderservice.svc/eqxintranetpeoplefinders ?$select=empid&$inlinecount=allpages&$top=26 failure url- http://localhost:8081/peoplefinderservice/peoplefinderservice.svc/eqxintranetpeoplefinders ?$orderby=empid&$select=empid&$inlinecount=allpages&$top=26 http status 500 - org.apache.cxf.interceptor.fault: org/apache/commons/codec/decoderexception type exception report message org.apache.cxf.interceptor.fault: org/apache/commons/codec/decoderexception description server encountered internal error prevented fulfilling request. exception java.lang.runtimeexception: org.apache.cxf.interceptor.fault: org/apache/commons/codec/decoderexception org.apache.cxf.interceptor.abstractfaultchaininitiatorobserver.onmessage(abstractfaultchaininitiat...

bash - How to awk through multiple files? -

i have hundreds of .dat file data in side , want awk them command awk 'nr % 513 == 99' data.0003.127.dat > data.0003.127.ma.dat i tried write script file like for in {1 ... 9}; i=i*3 datafile = sprintf("data.%04d.127.dat",i) outfile = sprintf("data.%04d.127.ma.dat",i) awk 'nr % 513 == 99' datafile > outfile done i need 0003 0006 0009 ... files, above script doesn't work fine. error says bash: ./ma_awk.sh: line 3: syntax error near unexpected token `(' bash: ./ma_awk.sh: line 3: `datafile = sprintf("data.%04d.127.dat",i)' what shall next? use ubuntu 14.04. in bash (since v4) can write sequence expression increment: $ echo {3..27..3} 3 6 9 12 15 18 21 24 27 you can include leading zeros, preserved: $ echo {0003..0027..3} 0003 0006 0009 0012 0015 0018 0021 0024 0027 so use following: for in {0003..0027..3}; awk 'nr % 513 == 99' "data.$i.127.dat" > "data.$i.12...

python - SQL server bulkinsert errors -

when run query bulkinsert file on shared drive sql server 2008 username , password (not windows authentication), these errors. dba, system admins , network guys denying these errors related teams , lost... can please me identify issue is? when run bulkinsert database username , password, authentication sql server use open file? run on ms management studio bulk insert databasename.dbo.tablename '\\shared_server\parent\child\file_name.txt' with(fire_triggers, datafiletype='char', fieldterminator='\t',rowterminator='\n', firstrow=2); and get cannot bulk load because file "\\shared_server\parent\child\file_name.txt" not opened. operating system error code 5(access denied.). run on python import pyodbc database = 'databasename' username = 'username' password = 'password' server = 'server_name' failover = 'failover_server_name' cnxn_string = 'driver={sql server native client 10.0};server=...

html - href attribute breaking an element -

here html <a class="button special" href="http://secure.hostgator.com/~affiliat/cgi-bin/affiliates/clickthru.cgi?id=vpspricing&page=http://www.hostgator.com/vps-hosting">select</a> some css--i don't think important including anyway. background-color: #449403; box-shadow: none !important; color: #fff !important; margin-left: 2px; i've pinned down being value in href since http://www.google.com work , various other urls. element shows in inspect element not show in gui , have no idea why. there character in there should escaping? embarrassing adblocker blocking link...

Get UNSAT Core using Z3 from .smt2 file -

i need unsat core z3. contents of .smt2 file are: (set-option :produce-unsat-cores true) (set-logic qf_aufbv ) (declare-fun () (array (_ bitvec 32) (_ bitvec 8) ) ) ; constraints (! (assert (bvslt (concat (select (_ bv3 32) ) (concat (select (_ bv2 32) ) (concat (select (_ bv1 32) ) (select (_ bv0 32) ) ) ) ) (_ bv10 32) ) ) :named ?u0) (! (assert (bvslt (_ bv10 32) (concat (select (_ bv3 32) ) (concat (select (_ bv2 32) ) (concat (select (_ bv1 32) ) (select (_ bv0 32) ) ) ) ) ) ) :named ?u1) (check-sat) (get-unsat-core) (exit) i getting following output when running z3: unsupported ; ! unsupported ; ! sat (error "line 11 column 15: unsat core not available") new z3, can't understand happening here (i sure expression unsat). thanks. you use ! incorrectly. exclamation point used naming formulae (not asserts). see section 3.9.8 tutorial . this should fix it: (assert (! (bvslt ...) :named ?u0)) .

multithreading - Python - Multithreaded Proxy Tester -

i'm building proxy checker using multithreads, specificly thread pool from: from multiprocessing.dummy import pool threadpool . the http request using urllib2. what want each proxy run 20 requests. if 1 threaded take time. thats multithreads power comes help. once set proxy want run 20 requests, , manage 2 things. 1 count exceptions , dump proxy if many occurs. 2nd save average response time , present later. i don't manage implement above. have implemented 1 thread: import socket import ssl import time import urllib import urllib2 import httplib proxylist = [] def loadproxysfromfile(filename): global proxylist open(filename) f: proxylist = [line.rstrip('\n') line in f] def seturllib2proxy(proxyaddress): proxy = urllib2.proxyhandler({ 'http': "http://" + proxyaddress, 'https': "https://" + proxyaddress }) opener = urllib2.build_opener(proxy) urllib2.install_opener(opener)...

javascript - Modal fade on page touch -

so i've created modal hides on exit using code: $('#emailtoggle').on('click', function() { $('body').toggleclass('dialogopen'); }); $(document).keyup(function(e) { if($('body').hasclass('dialogopen')) { if(e.keycode == 27) $('body').toggleclass('dialogopen'); } }); i trying make when user touches outside modal, modal fade this. i tried using: $(document).on('click', function(){}); but had no luck.. thanks minimal example: css: .overlay{ display: none; position: fixed; width: 100%; height: 100%; z-index: 3; } .modal{ z-index: 4; } .showoverlay{ display: block; } javascript: $('.overlay').on('click', function() { $('body').toggleclass('dialogopen'); $(this).toggleclass('showoverlay'); });

Google Maps API get photo_reference from nearbysearch JSON -

good morning, at moment trying build website shows 1 photo nearby search in google map api. in example trying have alert photo_reference need display photo later cannot figure out how photo_reference id. current not working code: var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=myapikey"; $.getjson(url, function (data) { var photo_reference = data.results[0].photos[0].photo_reference; alert(photo_reference); }); i hope out there can me one. here photo_reference trying get: { "html_attributions" : [], "results" : [ { "geometry" : { "location" : { "lat" : -33.86879, "lng" : 151.194217 } }, "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", "id" : "21a0b251c9b83...

php - Combine two different rules in HTACCESS -

i able create rule in htaccess file, hide sub-folder. rewriteengine on rewritecond %{the_request} ^[a-z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [nc] rewriterule ^ /%1/%3 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]+)/([^/]+)/?$ $1/project/$2.php [nc,l] the first rule removes file-extensions : php the second rule hide folder "project" url both these rules working perfectly. however, when tried add third rule, hide folder, failed. this second folder (rolan) in same location "project" folder, assumed should work copy-pasting second rule : rewriteengine on rewritecond %{the_request} ^[a-z]{3,}\s/?([^/]+)/([^/]+)/([^.]+)\.php [nc] rewriterule ^ /%1/%3 [r=301,l] rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]+)/([^/]+)/?$ $1/project/$2.php rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^([^/]+)/([^/]+)...

angularjs - Parsing JSON file with angular.js -

i want parse bitcoin price json file angular.js. the json source this blockchain api. the code use angular.js: <div ng-app="myapp" ng-controller="customersctrl"> <ul> <li ng-repeat="x in price"> {{ x.15m + ', ' + x.last }} </li> </ul> </div> <script> var app = angular.module('myapp', []); app.controller('customersctrl', function($scope, $http) { $http.get("https://blockchain.info/de/ticker") .success(function (response) {$scope.price = response.usd;}); }); </script> the result should 15m price , comma separated latest price. my guess messed near response.usd, after 1 hour, still didn't find how properly. please help! it appears getting error blockchain site. have single-origin policy set on server protects them click-jacking attacks. here error getting: xmlhttprequest cannot load https://blockchain.info/de/...

sql - How to create email alerts for extended events? -

i have created extended events in sql server 2012. working fine. looking if events occur (example :deadlock), should send mail given mail id. possible in extended events? there interesting article it, need to: enable service broker on database. create service broker queue receive event notification messages. create service broker service deliver event notification messages. create service broker route route event notification message service broker queue. create event notification on deadlock event create messages , send them service broker service through service broker, stored procedure can written responds deadlock events. event notifications allow deadlock graphs transformed, stored, , sent wherever need go. store deadlock graph in table. retrieve cached plans associated deadlock in table. email deadlock graph dba team. you can find article examples on link: http://sqlmag.com/site-files/sqlmag.com/files/archive/sqlmag.com/content/content/142603/wpd-sq...

why can't MATLAB import this python library? -

i'd use http://www.losonczylab.org/sima/1.2/ within matlab. i can run fine python. i can import example dependencies in matlab. $ /opt/local/bin/python python 2.7.9 (default, dec 13 2014, 15:13:49) [gcc 4.2.1 compatible apple llvm 6.0 (clang-600.0.56)] on darwin type "help", "copyright", "credits" or "license" more information. >>> sima import sequence >>> sequence <module 'sima.sequence' '/users/eflister/library/python/2.7/lib/python/site-packages/sima/sequence.pyc'> >>> sima import imagingdataset >>> imagingdataset <class 'sima.imaging.imagingdataset'> in matlab: >> pyversion /opt/local/bin/python >> pyversion version: '2.7' executable: '/opt/local/library/frameworks/python.framework/versions/2.7/resources/python.app/cont...' library: '/opt/local/library/frameworks/python.framework/versions/2.7/lib/libpython2...

asp.net mvc - TwiML App unexpected end of call: Cannot find the declaration of element 'response' -

Image
i created twiml application , set voice request url web deployed asp.net-mvc aplication action method: http://voiceapp-001-site1.myasp.net/voice this action method invoked when goes url posted above: public actionresult voice() { response.contenttype = "text/xml"; // put phone number you've verified twilio use caller id number string callerid = settings.twilionumber; // put default twilio client name here, when phone number isn't given string number = "jenny"; // phone number page request parameters, if given if (request["phonenumber"] != null) { number = request["phonenumber"]; } // wrap phone number or client name in appropriate twiml verb // checking if number given has digits , format symbols string numberorclient; var m = regex.match(number, @"^[\d\+\-\(\) ...

Go: Write carriage return with IO -

this question has answer here: windows notepad not supporting newline character '\n' 2 answers i'm trying write on file in go io.writestring, writing "\n" character not print carriage return. think maybe not carriage return need write, in windows, if open txt file wordpad, carriage return shown, not in notepad. any ideas behaviour?, here code: //write t := time.now().local() src, err := os.stat("/dir") if err != nil { log.println(err, log.llongfile) } if !src.isdir() { err = errors.new("folder not exists") log.println(err, log.llongfile) err = os.mkdirall("/dir", 665) log.println(err, log.llongfile) } f, err := os.create("/dir" + "/file_" + t.format("20060102") + ".txt") n, err := io.writestring(f, "hello world\n") n, err = io.writestring(f, ...

singleton - meaning and location of string inside Magento's Mage:getSingleton -

here string see lot of similar in magento: mage::getsingleton('checkout/type_onepage'); however, i'm trying find out class located, , meaning of string specifically. can explain me? 1/ model you have know mage::getsingleton() going send singleton (which common development design pattern). magento, models can instantiated singleton snippet app/mage.php can see magento using getmodel behind scene, , register have single instance of model if call twice via getsingleton (the purpose of singleton pattern itself, may know) public static function getsingleton($modelclass='', array $arguments=array()) { $registrykey = '_singleton/'.$modelclass; if (!self::registry($registrykey)) { self::register($registrykey, self::getmodel($modelclass, $arguments)); } return self::registry($registrykey); } 2/ handle magento going map components classes via call handles. defined in config.xml of modules. snippet app/code/core/m...

How to get subscriber count and videos count for a given YouTube channel? -

until i've been using url retrieve subscriber count channel: http://gdata.youtube.com/feeds/api/users/<channel_id>?v=2&alt=json and url channel videos count: https://gdata.youtube.com/feeds/api/users/<channel_id>/uploads?v=2&alt=jsonc&max-results=0 but day google discontinued using it's v2 api , can't find replacement options data. you're going want use channels/list endpoint pass in statistics part parameter. request: http get: https://www.googleapis.com/youtube/v3/channels?part=statistics&id={channel_id}&key={your_api_key} response (with id=uct7ivnjwjbsof8ipljhctgq ): { "kind": "youtube#channellistresponse", "etag": "\"dhbhldw5j8dk10gxev_ug6rsrem/wnxxcvyctyqtjtn9slj5tovjbry\"", "pageinfo": { "totalresults": 1, "resultsperpage": 1 }, "items": [ { "kind": "youtube#channel", "e...

c++ - WxWidgets - wxlistbox - store more then string -

can store more informations in wxlistbox string? i store there objects (from 1 class), possible? wxlistbox , many other controls, has concept of "client data" i.e. arbitrary pointer can associated each item. don't recommended use however, better maintain objects separately in std::vector<> , do, judging other questions. won't happen automatically however, need update both listbox , vector when insert/delete/update items.

ios - Get viewController reference to shared code behind file -

Image
i've started developing apps ios , have problem can't figure out atm. my app contain 2 viewcontrollers, both of them have 1 label each , want code behind (one single file) same calculation 2 different numbers depending on viewcontroller shown. for example: code behind should calculate 1 * x, x either 1 first view or 2 second view. (and print sum) so, there anyway can reference of view i'm (the user) at? or have create 2 files code behind same code, 1 number different? storyboard: what want achieve in pseudo: if viewcontroller == 1 label1.text = 1 else if viewcontroller == 2 label2.text = 2 thanks help imo best option have 1 view controller (in storyboard too) , 2 views outlets , swap them (hide/show). but can distinguish between views example tag property of uiview.

Breaking out of a for loop from a nested if statement in Django -

is there way break out of for loop inside if statement. our database incorrectly storing multiple primary phones , break out of loop after first primary phone found. thank in advance help. {% phone in user_phones %} {% if phone.primary %} <div>{% if phone.type %}{{ phone.type|title }}: {% endif %}<span itemprop="telephone">{{ phone.phone_format }}</span></div> {% endif %} {% endfor %} updated: or fail if condition creating variable within if true branch if have stay within template layer use regroup . {% regroup user_phones|dictsort:"primary" primary phones_list %} {% phone in phones_list %} {% if phone.grouper %} {{ phone.list.0.type }} {% endif %} {% endfor %} what does regroup dictsort filter (which works on querysets) groups instances in user_phones value of primary . regroup add attribute named grouper , when grouping bool (the value of primary ) either true or false ....

html - Show the orders values based on each PERSON from MySQL in PHP when the user logged in -

right have page, users can sign email adres , name , password, when registered .. see order form. if place order .. want show product ordered in users profile page. so right have 1 database , 1 table , 2 columns. database: admin_myweb table : admin_myweb column 1: customers column 2: orders in customers there are 4 rows: id, name, email, password in orders there 3 rows: id, cus_name, product_name now if register, details stored in customers . when place order.. example: fruit , press submit button details stored in orders . but want show ordered details on user profile page like: orders: fruit i want can show ordered product user on page. this: $ echo = product_name i using php session login, when user log in see page: <h1> <?php echo "hi ".$_session['user_name']; ?> <i class="fa fa-user"></i></h1> <h3><?php echo "".$_session['user_email']; ?></h3>...

javascript - ASP.Net OnClick Subs not operating how I want -

i using onclick handlers process button clicks query sql. problem is, these queries take 10 - 30 seconds before return. disabled buttons prevent click-stacking during time, have little loading gif appear while sub finishes doing thing. so go this: click -> button disabled -> loading gif appears -> onclick sub completes -> loading gif disappears -> more ajax happens on same page here button looks like <asp:button id="buttonone" runat="server" visible="false" text="next" onclientclick="this.disabled=true;" usesubmitbehavior="false" onclick="username_click"/> and page-behind sub username_click(byval sender object, byval e eventargs) showwidget(true) 'this part takes few seconds if usernameisvalid(textfield.text) buttontwo.visible = true, labeltwo.visible = true, buttonone.visible = false, labelone.visible = false end if showwidget(false) end sub th...

Convert JSON from Django to JavaScript Array and Loop to Populate 'users' Parameter in Mention.js -

i'm going wrong, need guidance. i'm using mention.js linking profiles in posts in application i'm building. getting working hard coded data trivial. set described in docs. well, app, each user logged in belongs organization, , organization comes django json. want populate mention.js dropdown choose these data when user types, organization list comes up. have json logged terminal console , browser console: [ { "fields": { "avatar": "images/avatars/bob.png", "name": "bob jones" }, "model": "accounts.profile", "pk": 5 }, { "fields": { "avatar": "images/avatars/sam.png", "name": "sam smith" }, "model": "accounts.profile", "pk": 7 } ] so i'm getting correct data django. can parse d...