Posts

Featured post

php - render data via PDO::FETCH_FUNC vs loop -

i've been using 2 methods render data. the first one: function name($id,$name){ return '<div id="'.$id.'">'.$name.'</div>'; } echo implode($pdo->query("select id,name user")->fetchall(pdo::fetch_func,'name')); the second one: $users = $pdo->query("select id,name user")->fetchall(pdo::fetch_obj); foreach($users $user){ echo name($user->id,$user->name); } i don't understand how pdo::fetch_func works. tried figure out. however, not well-documented. could please explain fetch mode? , also, 1 performs better? thank you. both methods wrong , have learn how use templates , how separate business logic presentation logic. $users = $pdo->query("select id,name user")->fetchall(pdo::fetch_obj); tpl::assign('users', $users); is code business logic part. then in template <?php foreach $users $row): ?> <div id="<?=$...

android - Launch Google Drive App from another app at certain path -

can tell me if possible open google drive app @ path? know google drive api allow list files every folder, prefer use google drive app if possible. thank you. try excelent answer with this, can open google drive native app app.

c# - How to check if file contains strings, which will double repeat sign? -

i check if file containing strings, separated # contains double repeat sign. example: have file this: 1234#224859#123567 i reading file , putting strings separated # array. find strings have digit repeated next each other (in case 224859 ) , return position of first digit repeats in string? this have far: arraylist list = new arraylist(); openfiledialog openfile1 = new openfiledialog(); int size = -1; dialogresult dr = openfile1.showdialog(); string file = openfile1.filename; try { string text = file.readalltext(file); size = text.length; string temp = ""; (int = 0; < text.length; i++) { if (text[i] != '#') { temp += text[i].tostring(); } else { list.add(temp); temp = ""; } ...

Rendering Static and Dynamic Graphics OpenGL -

i working on ios game using opengl pipeline. have been able render graphics want screen, however, calling gldrawelements many times , have concerns running performance issues eventually. have several static elements in game not need render on every render cycle. there way can render static elements 1 frame buffer , dynamic elements another? here's code have tried: static bool renderthisframebuffer = yes; if (renderthisframebuffer) { glbindframebuffer(gl_framebuffer, interframebuffer); glclearcolor(0.0f, 0.0f, 0.0f, 0.0f); glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glblendfunc(gl_src_alpha, gl_one_minus_src_alpha); glenable(gl_blend); glenable(gl_depth_test); // set projection matrix cc3glmatrix *projection = [cc3glmatrix matrix]; float h = 4.0f * openglview.frame.size.height / openglview.frame.size.width; [projection populatefromfrustumleft:-2 andright:2 andbottom:-h/2 andtop:h...

capistrano3 - capistrano - git ls-remote -h doesn't have the git url -

i'm new using capistrano. set correctly, when run cap staging deploy - debug [b678d5eb] command: ( git_askpass=/bin/echo git_ssh=/tmp/myproj/git-ssh.sh /usr/bin/env git ls-remote -h ) debug [b678d5eb] usage: git ls-remote [--heads] [--tags] [-u <exec> | --upload-pack <exec>] <repository> <refs>... debug [b678d5eb] finished in 0.325 seconds exit status 129 (failed). i think git clone url should follow after -h, i'm not sure. i'm using capistrano 3.2.1. here's deploy.rb - lock '3.2.1' set :application, 'myproj' set :repository, 'https://vrao@git.test.com/scm/~vrao/myproj.git' set :scm_passphrase, 'blah' any great. never mind, following documentation capistrano 2x, while have 3.2.1 installed. for might face same issue, in capistrano 2x specify git repo setting repository variable, while in 3x it's been changed repo_url. changed , works fine. here's documentation recommend follow...

Limit bandwidth per-IP by value from HTTP Header -

i have file download site. limiting bandwidth per ip (!). limit should set dynamically http header backend. my current implementation uses x-accel-limit-rate (i can change header, it's not hard-coded anywhere) , limit current connection/request. is idea doable in g-wan? yes, can done. write g-wan handler extract x-accel-limit-rate http header. enforce policy using throttle_reply() g-wan api call documented here . an example available called throttle.c might further. the throttle_reply() g-wan function lets apply throttling on global basis or per connection , apply relevant throttling values either ip addresses or authenticated users , depending on needs. throttle_reply() can change download speed dynamically during lifespan of each connection can slow-down old connections , create new ones adaptive download rate. of course, can enforced on per client ip address (or cookie, or isp/datacenter record) deal huge workloads.

io - Do CPU usage numbers/percentages (e.g. Task Manager) include memory I/O times? -

this i've wondered never looked up. when os reports 100% cpu usage, mean bottleneck calculations performed cpu, or include stall times, loading data l1, l2, l3 , ram? if include stall times, there tool allows break figure down components? the cpu usage reported os includes time stalled waiting memory accesses (as stalls data dependencies on high latency computational operations division). i suspect 1 use performance counters better handle on taking time, not familiar details of using performance monitoring counters.