Posts

Showing posts from September, 2015

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.

mysql - Need to SUM All Rows by a Non-Numeric Condition AND a GROUP BY -

i have table contains condition need test , total group total of number of groups equal value. example: group 1 total of conditions = 1 group 2 total of conditions = 14 group 3 total of conditions = 5 group 4 total of conditions = 1 etc. i need calculate total of each group total groups = 1 this base code have come basic group totals. (i'm using sum(if(condition = true,1,0)) in effort build query can used subquery): select sum(if(`condition` <> '' , `condition` not null,1,0)) totalerrors site_analytics group fourid; of course same as: select count(*) totalerrors site_analytics group fourid `condition` <> '' , `condition` not null; returns row each group group total. need group groups group total. either way need number of groups (fourid) = 1 (or 2,3,4 etc) the end result i'm looking generate report has number of groups = 1, 2,3,4,5,5+ i have tried using above queries sub-queries no success such as: select su...

Android KitKat Bluetooth ACL_CONNECTED and ACL_DISCONNECTED not working -

i have weird issue, broadcast receiver not receiving acl_connected , acl_disconnected on android 4.4.2. but have android phone 4.1.2 , works correctly. is known issue? here androidmanifest : <receiver android:name="com.example.myclass$bluetoothbroadcastreceiver" android:enabled="true" android:exported="false"> <intent-filter> <action android:name="android.bluetooth.device.action.acl_connected" /> <action android:name="android.bluetooth.device.action.acl_disconnected" /> <action android:name="android.bluetooth.adapter.action.state_changed"/> </intent-filter> </receiver> i have found issue. i removed android:enabled="true" , android:exported="false" , works on both 4.4.2 , 4.1.2

python - Django Registration with Custom User Model -

so using custom user model accounts.player , i'm using django-registration in project. with custom model encounters error. know write own registration code there way use custom model class django-registration. had on docs didn't find solution. i'm sure theres way using subclass i'm not sure how implement this. what files required , code need?? this did personal project of mine: class userprofile(models.model): user = models.onetoonefield(user, related_name = 'moreaboutuser', unique=true) age = .... gender = .... regarding error, don't know how since didn't provide traceback/code. can connect custom model user model onetoonefiel'

mysql - PHP Loop through an array second time (foreach) -

i have foreach loop through data provided pdo sql query: foreach ($team $row){ $count++; $teamnumber = 'team'.$count; if ($currentscores[0]['team'.$count] == ""){ $red = "red"; } echo "<strong><font color='".$red."'>".$row['name']."</font></strong>"; echo $currentscores[0]['team'.$count]; if ($count < 2) echo " vs "; } now, want loop again through $team array returns last value of array during second loop. i tried same thing: foreach ($team $row) { ..... ....... } how run again through array? simple enough, foreach loop on $row have previously. foreach($array $key => $val) { foreach($val $a => $b) { echo $b; } }

java - Enforce method overload -

looking @ great example polymorphism vs overriding vs overloading , consider scenario: abstract class human { public void gopee() { println("drop pants"); } } class male extends human { public void gopee() { super.gopee(); println("stand up"); } } class female extends human { public void gopee() { super.gopee(); println("sit down"); } } my questions: is possible, on concrete classes level, enforce using super.gopee() inside gopee() ? if - how ? is possible, on abstract class level, know concrete class had called super.gopee() ? rationale if need call method let's lifttoiletseat() somewhere on abstract class level. thank you. you can enforce not giving subclass choice, using simple template method pattern . in superclass wants enforce call super , don't give choice. make method final can't overridden, , call abstract protected method must overridden. superclass behavior enforce...

Append Xml Attributes in a SQL server Query -

i'm new in handling xml inside sql server , have question have not found example or answer, useful if guys me. i have various xml iside table "t1" under xml column type "xmlcol", xml structure: row 1 <icfd:ips totalir="0" totalit="7223.9"> <icfd:tras> <icfd:tra impt="aiv" ts="16" imp="517.1"/> <icfd:tra impt="sri" ts="8" imp="18.3"/> </icfd:tras> </icfd:ips> row 2 <icfd:ips totalir="10" totalit="123.9"> <icfd:tras> <icfd:tra impt="aiv" ts="34" imp="345.1"/> </icfd:tras> </icfd:ips> i'm trying obtain result this: tra totalir totalit ------------------------------------------- aiv(517.1),sri(18.3) 0 7223.9 aiv(345.1) 10 123.9 how correct way make query? i have i'm getting ...

batch file - .PIF With ? Allowed for a Variable Request -

up until have been using .pif shortcut "?" call variable used in batch file produce specific results. have on project 10,000 folders, , jobfind.pif tool satisfied quick search. moving or floating shortcut.lnk 1 folder in larger directory. program line call inside jobfind.pif s:\yourstruly\jobfind\jobfind.bat ? jobfind.bat contents %1 = ? explorer "p:\sdit_l~1\projects\000030%1" is there simple replacement olde fashion jobfind.pif tool? thank you, gpb you replace either command-line or gui vbscript. here's example: strjob = inputbox("enter job number:") createobject("wscript.shell") .run "explorer.exe p:\sdit_l~1\projects\000030" & strjob end

Apache redirect with a relative path -

i want clear doubt, it's possible in apache make "alias" (mask) port ?? let make use of example: in server have apache running in *:80 , application running *:8080, inside domain called www.example.com . so, i'm think if possible , how can make "alias" if use www.example.com\other redirect www.example.com:8080\gui . and possible mask name example.com\other ? as said, i've enabled mod_proxy use proxypass , proxypassreverse this first try proxypass proxypass /foo http://domain.com:5780 proxypassreverse /foo http://domain.com:5780 when tried access http://myown.com/foo redirected domain selected did not loaded images, did not saw before because images @ page bottom. i have read page mod_rewrite, mod_alias, redirect , mod_proxy, i've edited apache config , it's not working properly. the answer depends on application running on port 8080. if it's java application running under tomcat, consider mod_jk if it'...

Rails 4 file uploads -

i using file_field helper upload file. following file upload. works fine upload file, post-upload additional processing. that, need know source path, ie full local file path, can use upload additional files without use of form. ideas on how should go doing this?

osx - How do I change the starting screen size in Cocos2d-x 3.1 for Mac target? -

my app supposed run in portrait. ios specify in plist file. android it's in manifest. when try run mac app launches in landscape, though it's supposed in portrait. i've tried find mainmenu.xib file specified in mac plist via xcode search, in 3.1 project, there wasn't 1 able found. tried looking through mac specific files under platform->mac didn't see related screen sizes. edit update: in addition @gamedeveloper answer, made following changes: if( !glview) { #if (cc_target_platform == cc_platform_mac) glview = glview::createwithrect("myapp", rect(0,0, 640, 960)); #else glview = glview::create("myapp"); #endif } it should noted supplied rect ideally design size. there no xib or nib. in v 3.0 in main.cpp should have: int main(int argc, char *argv[]) { appdelegate app; eglview eglview; eglview.init("hello world",900,640); return application::getinstance()->run(); } change 9...

vba - Bizarre blue box of death - Visual Basic - Excel -

Image
please see picture below.essentially, without action on part, in vba project box in top left, see identical blue box spreadsheets, every tab in workbook. accompanied catastrophic failure error , can no longer run of procedures. has seen before? does know i'm unintentionally doing cause this?

javascript - Add new ID for every new loop -

i'm developing sort of loop using li tags. loop, i'm going use text gonna displayed through simple open , close javascript code i've made when clicking somewhere. guys know, kind of code manipulated through getelementbyid property. however, since i'm going loop these lists items, cannot repeat ids throughout them. so, how can loop these list items without repeating id? take html below: <section class="pro-further"> <span>consulte</span><br> <ul> <li><div onclick="furtherinfo('test');">info one</div> <div id="test">text first info</div> </li> <li><div>info two</div> <div>text second info</div> </li> <li><div>info three</div> <div>text third info</div> </li> <li><div>info four</div> <div>text fourth info</di...

ios - UIImagePickerController ImageIO_PNG takes massive memory -

although resize images once uiimagepickercontroller has finished taking photo, instruments profile says calls imageio_png taking massive amounts of memory (40 mb+) each time take photo. code: - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { @autoreleasepool { if (myimageview.image == nil) { myimageview.contentmode = uiviewcontentmodescaleaspectfill; uiimage *topimage = [info objectforkey:@"uiimagepickercontrolleroriginalimage"]; uiimage *image = [info objectforkey:uiimagepickercontrolleroriginalimage]; cgrect rect = cgrectmake(0,0,320,440); uigraphicsbeginimagecontext( rect.size ); // use local image variable draw in context [topimage drawinrect:rect]; uiimage *topresized = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); myimageview.image = t...

windows - IE Automation with Powershell -

i attempting automate login website on our intranet using powershell , ie. far, have following code works: $ie = new-object -com "internetexplorer.application" $ie.navigate("https://somepage/jsp/module/login.jsp/") while($ie.readystate -ne 4) {start-sleep 1} $ie.visible = $true $doc = $ie.document if ($doc.nameprop -eq "certificate error: navigation blocked") { $doc.getelementbyid("overridelink").click() } $loginid = $doc.getelementbyid("loginid") $loginid.value= "username" $password = $doc.getelementbyid("password") $password.value = 'somepass' $ie.navigate("javascript:dosubmit('login')",$null,$true) so, problem area have site closes original window used login , opens new ie window. how go submitting inputs new window? know can use tasklist.exe /v pid of new window... i'm not sure how go taking control of it. also, after viewing code, please know not intend use embed...

javascript - Changing upload placeholder after chose file -

i have code currently: html: <div class="row upload"> <form enctype="multipart/form-data" action="" method="post" class="col-md-12"> <label for="file" class="filebutton">no file has been selected</label> <input style="opacity:0" type="file" name="file" id="file" /> </form> </div><!--end of row upload--> css: label { background-color: #eeeeee; width: 500px; height:50px; font-weight: normal; color: #777777; padding:20px; margin-top: 10px; } as can see, when file chosen, placeholder still remains same. want placeholder file directory when file chosen. fiddle: http://jsfiddle.net/7rtj5/ test : html : <div class="row upload"> <form enctype="multipart/form-data" action="" method="post" class="col-md-12"> ...

Appending to file internal storage android -

if have existing file in internal storage in android app, how append string file? have tried using fileoutputstream.write() seems overwrite whole file , causes previous data lost. as suggested squonk, can manually create fileoutputstream in append mode with: fileoutputstream(file file, boolean append) fileoutputstream(string path, boolean append) or alternatively , arguably preferably, using native android method: openfileoutput(filename, context.mode_append); which opens file named 'filename' located in default storage location app. best let os decide store files. details on storage options here . describes how access each of standard storage locations , methods. 1 choose depends on trying store.

complexity theory - How to analyzing this algorithm with justification -

is following claim true? why? c(n) = log 2 (n n ) implies c(n) theta(log n) no, claim wrong. (assuming c(n)=c(n) , , that's typo). c(n) = log_2(n^n) = n*log_2(n) = nlog(n) since nlog(n) not in theta(logn) , claim false, , in fact c(n) in theta(nlogn) .

Pushing Messages From BlazeDs to Flex (Invoking within Java) -

i'm having trouble figuring out how send message via blazeds(on tomcat) flex client. have working send/receive message client, have situation need send message originating in java. thought easier. methods have tried: messageservice.pushmessagetoclients(msg); serviceadapter.invoke(msg); exception: flex.messaging.messageexception: java.lang.nullpointerexception : null messagebroker.routemessagetoservice(msg); [blazeds]14:03:35.898 exception when invoking service: (none) message: flex message (flex.messaging.messages.asyncmessage) services.xml: <channel-definition id="my-streaming-amf" class="mx.messaging.channels.streamingamfchannel"> <endpoint url="http://192.168.2.43:8400/testdrive/messagebroker/streamingamf" class="flex.messaging.endpoints.streamingamfendpoint"/> </channel-definition> message-config.xml: <?xml version="1.0" encoding="utf-8"?> ...

Why isn't my file being read in C#? -

i'm not sure why file isn't being read in c# program. when run it, gives 0 in textbox , doesn't list names. wonder if problem else , reading file correctly. in advance everyone! here customerda class calls file , i'm not sure if correct: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using system.io; namespace customerlist { public static class customerda { private const string dir = @"z:\desktop\windows 7 files\c#.net\customerlist\customerlist"; private const string path = dir + "customerdat.txt"; public static list<customer> getallcustomers() { if (!directory.exists(dir)) directory.createdirectory(dir); streamreader textin = new streamreader( new filestream(path, filemode.open, fileaccess.read)); list<customer> custlist = new list<customer>(); // create list add customers...

ruby - Automatic nested hash keys with ability to append value -

i have arbitrary list of file names i'd sort hash. i'd like this: ## example file name 'hello.world.random_hex" file_name_list.each |file| name_array = file.split('.') files[name_array[0].to_sym][name_array[1].to_sym] << file end those keys may not exist , i'd them automatically created default value of [] << works expected. final files hash like: { :hello => { :world => [ "hello.world.random_hex", "hello.world.other_random_hex" ] } } how can initialize files accomplish this? if there 2 levels of keys this, can using block form of hash.new: files = hash.new {|k,v| k[v] = hash.new {|k,v| k[v] = [] }} (on other hand, if keys can nested arbitrary depth, harder because hash can't know whether value nonexistent key should hash or array @ time accessed.)

java - GWT - Select all on text box after click -

in gwt project have element desc represented textarea . need select text when user clicks on it. jni function selectall() correctly executed when user clicks on element. however, not select text. please help! final element desc = storyview.getinstance().getdescription(); dom.sinkevents((com.google.gwt.user.client.element) desc, event.onclick); dom.seteventlistener((com.google.gwt.user.client.element) desc, new eventlistener(){ @override public void onbrowserevent(event e) { switch (dom.eventgettype(e)) { case event.onclick: selectall(); break; } } }); } private native void selectall() /*-{ var desc = @com.gw.myproj.client.story.storyview::desc; $wnd.$("." + desc).focus(); $wnd.$("." + desc).select(); }-*/; simply try javascript's setselectionrange method in jsni. private native void selectall(element ele...

Unity3d web player fails to load textures -

i'm having problem unity3d web player. have developed project , succesfully deployed in web app. works absolutely no problem on pc. this app installed on 2 identical machines. have installed them in both , works in one. issue have on computer fails load models , textures, game runs instead of models can see black rectangles on blue background. has same problem browsers , no errors either player or javascript. the difference between these computers 1 has problem running on windows 8.1 , other 1 on windows 8 only. cause of issue? it works fine on computer windows 8.1. both of other computers have specs lower mine. i have searched everywhere , seems has individual games, think may have computer because runs in other two. the specs on computes i'm installing app on follows: intel celeron 1.40 ghz, 2gb ram, intel hd graphics if point me in right direction grateful i forgot mention, i'm running unity web player 4.3.5 , version on other 2 computers 4.5.0

osx - Error when using lua filename.lua -

i'm new lua, , i've been trying create lua file using textwrangler, execute file in terminal (using mac). create following in textwrangler file: for i=1,10 print ("hello") end print ("that's all!") and save test.lua. move file lua directory, ~/lua-5.2.3 . start lua, , use following command: lua test.lua and following error: stdin: 1: syntax error near 'test' what doing wrong here? i've looked everywhere online solution to, assume, simple oversight on part, have found nothing. first thought was putting file in wrong place, have moved everywhere same result. you can execute script typing lua test.lua in terminal. if enter interpreter mode, can use dofile "test.lua" . there no lua command(function ) there, unless declare somewhere. there pil section stand-alone interpreter usage , more up-to date reference section .

Laravel Eloquent - $fillable is not working? -

i have set variable $fillable in model. wanted test update functionality, , error: sqlstate[42s22]: column not found: 1054 unknown column '_method' in 'field list' (sql: update positions set name = casual aquatic leader, _method = put, id = 2, description = here description, updated_at = 2014-05-29 17:05:11 positions . client_id = 1 , id = 2)" why yelling @ _method when fillable doesn't have parameter? update function is: client::find($client_id) ->positions() ->whereid($id) ->update(input::all()); change following: ->update(input::all()); to (exclude _method array) ->update(input::except('_method')); update: actually following update method being called illuminate\database\eloquent\builder class being triggered _call method of illuminate\database\eloquent\relations class (because calling update on relation) , hence $fillable check not getting performed , may use i...

c++ - cocos2d-x 3.1 serialize int to string map -

i store leader board data (name-score mapping) in std::multimap. need serialize in file , deserialize show player. how using cocos2d-x 3.1? there way or should use boost? there no default way serializing objects, instead can create dictionary , set keys converting them string , write plist file. can check fileutilstest more details of reading , writing game data.

javascript - How to get cytoscape.js to work -

i'm having problems getting simple cytoscape.js example work @ all. here code in pastebin link i'm new javascript in general, may basic mistake. console.log statements put through function calls indicate cy function getting called , executed, , browser console doesn't seem t throw errors, cannot graph show. there i'm missing in definition? i tried make minimalistic possible. code verbatim copied of cytoscape.js examples. cy.cytoscape relevant function. calling code @ bottom $('#cy').cytoscape({ ....... <body> <div id="cy"></div> </body> edit: jsfiddle link i have made changes in code.now working fine. please @ link below css body { font: 14px helvetica neue, helvetica, arial, sans-serif; } #cy { height: 100%; width: 100%; position: absolute; left: 0; top: 0; } javascript $(function() { // on dom ready $('#cy').cytoscape({ ...

ansible - How to prevent 'changed' flag when 'register'-ing a variable? -

i have register task test installation of package: tasks: - name: test nginx command: dpkg -s nginx-common register: nginx_installed every run gets reported "change": task: [test nginx] ******************************************************** changed: [vm1] i don't regard change... installed last run , still installed run. yeah, not biggy, 1 of untidy ocd type issues. so doing wrong? there way use register without being regarded change? the [verbose] output untidy, way i've found correct return code. task: [test nginx] ******************************************************** changed: [vm1] => {"changed": true, "cmd": ["dpkg", "-s", "nginx-common"], "delta": "0:00:00.010231", "end": "2014-05-30 12:16:40.604405", "rc": 0, "start": "2014-05-30 12:16:40.594174", "stderr": "", "stdout": ...

if statement - PHP - if == not working for 0 or "" -

this question has answer here: why php consider 0 equal string? 6 answers i checking validation of request if query, if ($request_userid == $userid) { ... } thats working expected. further testing has shown, if $request_userid or $userid 0 or "", condition true , script runs if query shouldn't. i solving with: if ($userid == "" ) { exit ("exit"); } but don't think right way? can explain why doesn’t work if query , correct way check it? here the php page on comparison operators . you're using loose comparison using double-equals sign. change triple equals sign , check both type , value. also see page on booleans & casting . the reason '' == 0 evaluates true, integer 0, when cast boolean, converts false. empty string ( '' ) converts false. therefore, comparison ends looking if (...

SQL Server matching all rows from Table1 with all rows from Table2 -

someone please me query, have 2 tables employee employeeid languageid 1 1 1 2 1 3 2 1 2 3 3 1 3 2 4 1 4 2 4 3 task taskid languageid langaugerequired 1 1 1 1 2 0 2 1 1 2 2 1 2 3 1 3 2 0 3 3 1 langaugeid connected table langauge (this table explaination only) langaugeid languagename 1 english 2 french 3 italian is there possilbe way make query gets employees can speak languages required each task? for example: task id 1 requires languageid = 1, result should employeeid 1,2,3,4 task id 2 requires 3 languages, result should employeeid 1,4 task id 3 requires languageid = 3, result should employeeid 1,2,4 here variant this: select t1.taskid, t2.employeeid ( select a....

How to use CloudFX to query Azure Table storage -

we have spent time researching through google understand how query our azure table (on storage emulator setting) using cloudfx library, there no example available shows how works. here simple function have written public t gettablerecord<t>(string tablename, string partitionkey, string rowkey) t : tableentity { using (var tablestorage = extensions.find<icloudstorageproviderextension>().defaulttablestorage) { var qry = tablestorage.get<t>(tablename, partitionkey, rowkey); var result = qry.???? } } no matter try qry.??? throws exception cannot cast iqueryable(t) can understand how can use method. edit1: to clarify error, this: var entity = tablestorage.get<myentity>("table", "partition").firstordefault(); throws following exception: expression of type 'system.linq.iorderedqueryable`1[microsoft.windowsazure.storage.table.dynamictableentity]' cannot used parameter of type 'system.linq.iqueryable...

android - Admob - The banner shows a black background and no ad -

i'm using ionic framework , , plugin: https://github.com/floatinghotpot/cordova-plugin-admob when deployed app android phone, see black rectangle, no ad. i don't know what's happening.. code: $ionicplatform.ready(function() { //admob var = window.plugins.admob; am.createbannerview( { 'publisherid': 'xxxxxxxxxx', 'adsize': am.ad_size.smart_banner, 'bannerattop': false }, function() { am.requestad( { 'istesting': true }, function() { am.showad(true); }, function() { /* handle error */ } ); }, function() { /* handle error */ } ); }); google play services plugin installed when installed previous admob plugin. if can me, appreciate it. in advance i noticed set istesting true. if using android simulator may...

Do I need one susy grid or more -

i have susy grid layout 1 on http://www.mattk.com to me looks 3 regions have max-width , 2 span whole screen. there way have container have max-width, couple regions go past that? the simplest solution use multiple containers. outside container can span full width, , inside can aligned grid. in case, navigation , branding in container, hero image not. main content is, footer not. etc.

javascript - jquery break loop onclick and continue -

i'm working on simple gallery , want loop array once each time click button , continue upon clicking again. my code looks this: $(document).ready(function(){ var pack_img = [ 'image1.jpg', 'image2.jpg', 'image3.jpg', 'image4.jpg', 'image5.jpg' ]; $("#btn").click(function(){ for(var i=0; i<pack_img.length; i++) { alert(pack_img[i]); return false; } }) }); i've search breaking , continue looping, seems complicated me any idea appreciated. :) try : var _index = -1; $("#btn").click(function(){ if(_index < pack_img.length){ _index ++; }else{ _index = 0; } alert(pack_img[_index ]); });

How to access describe and it messages in mocha? -

in mocha, describe('this message text', function(){ it('and message text', function(done){ console.log(this); // {} empty }); }); how access 'this message text' 'and message text' inside tests? i tried this object it's empty. this.test.parent.title; ctx suite has test object represents executing test has parent suite (describe) above it. you can access title of current test this.test.title etc. this method allows getting data (and other data) looking without having grab in before() etc functions.

how do I parse one node at a time from XML file through Java code? -

this xml file: <applications> <apps> <appname>myapp</appname> <server>qwe</server> <port>1234</port> <uname>system</uname> <passwd>security</passwd> </apps> <apps> <appname>tyas</appname> <server>qwewe</server> <port>1235</port> <uname>asd</uname> <passwd>wetry</passwd> </apps> </applications> this java code: package trial; import java.io.file; import javax.xml.parsers.documentbuilder; import javax.xml.parsers.documentbuilderfactory; import org.w3c.dom.document; import org.w3c.dom.element; import org.w3c.dom.node; import org.w3c.dom.nodelist; public class parsing { public static void main(string args[]) { try { file applications = new file("appdetails.xml"); documentbuilderfactory dbfactory = documentbuilderfactory.newinstance(); documentbuilder dbuilder = dbfactory.newdocumentbuilder(); document doc = ...

html scrapping using python topboxoffice list from imdb website -

url: http://www.imdb.com/chart/?ref_=nv_ch_cht_2 i want print top box office list above site (all movies' rank, title, weekend, gross , weeks movies in order) example output: rank:1 title: godzilla weekend:$93.2m gross:$93.2m weeks: 1 rank: 2 title: neighbours this simple way extract entities beautifulsoup from bs4 import beautifulsoup import urllib2 url = "http://www.imdb.com/chart/?ref_=nv_ch_cht_2" data = urllib2.urlopen(url).read() page = beautifulsoup(data, 'html.parser') rows = page.findall("tr", {'class': ['odd', 'even']}) tr in rows: data in tr.findall("td", {'class': ['titlecolumn', 'weekscolumn','ratingcolumn']}): print data.get_text() ...

sql server - SQL: How to find product codes -

we have database (mssql) contains products table, products put in way in product id first 4 letters customer specific code. example: 123070004400b 002070004400b 012316003030e etc. the first 4 letters customer code, while later part product code can overlap. same customer can order products same code, keep our stock separate this. in database @ least. is there way make query tell example product 07004400b exists in more 1 customers entry? use substring() extract produce code, , group-by having find hits: select substring(product_id, 5, len(product_id)) code products group substring(product_id, 5, len(product_id)) having count(*) > 1 if want specific one, add clause: select substring(product_id, 5, len(product_id)) code products substring(product_id, 5, len(product_id)) = '0700400b' group substring(product_id, 5, len(product_id)) having count(*) > 1

asp.net - WebForms Unobtrusive Validation Mode -

i encountered error using regular expression validator. 1) create asp.net empty application (as webapplication) 2) add web form in webapplication 3) add following line: inside <head></head> 4) create folder "script", still inside webapplication tree 5) add jquery-1.8.2.js file inside folder 6) inside div below form add 2 textbox: <asp:textbox id="a" name="a" type="text" size="50" maxlength="100" runat="server" /> <asp:textbox id="b" name="b" type="text" size="50" maxlength="100" runat="server" /> 7) each textbox add regularexpressionvalidator, code be: <asp:textbox id="a" name="a" type="text" size="50" maxlength="100" runat="server" /> <asp:regularexpressionvalidator validationgroup="alpha" id="controla" ...

php - How to get response code from google api oauth2 in controller -

i new codeigniter , php. redirect url given in google api console: redirect uris: http://localhost/testgmail/index.php/main/gmail_invite following code shows me request permission page. when click allow access takes me to http://localhost/testsaav/index.php/main/gmail_invite?code=4/cxd462cen-oebe1gahih90hjqb2x.qpvsg7mg4auxadn_6y0zqngacvlxeai and gives me error page not found. how should controller method function gmail_invites() { $data = $this->input->get('code'); }

how to get the days of 2,3,4 months in javascript -

i want days of more 1 month if pass 2 , 3 ,4 number of month function, want total number of days today function get_days_in_month(months){ days_in_month = new date(); var y = days_in_month.getfullyear(); var m = days_in_month.getmonth(); if(months==1){ return new date(y,m+1,0).getdate(); } if(months==2){ // need write code or other logic } } thanks in advance use for loop : var total = 0; (i = 1; <= months; i++) { total += new date(y, m + i, 0).getdate(); } return total; jsfiddle demo .

lotus notes - Lotusscript NotesDocument values -

i analyzing module in lotuscript fetching notesdocument . now consider example notesdocument encapsulates following data : docvalue:<html><head> head </head><body>body</body></html> now how following work? dim document notesdocument dim data variant ' assume code fetch notesdocument has been done. ' statement fetch html data. data=document.docvalue(0) i did not find lotus documentation can fetch value after ":" separator(in case docvalue: seen in data above). please let me know how works or link documentation. thanks in advance. use strright() . gives string right search string: data=strright(document.docvalue(0), ":")

nginx - Throughput result on JMeter increase suddenly when using 100 threads -

i tested local website using nginx php-fpm using apache jmeter. try simple concurrent load testing on it. here test plan configuration, 3 thread groups:- number of threads: 10, 50, 100 ramp-up period: 0 loop count: 1 in test plan itself, have 5 different pages represent 5 http requests. but when used 100 threads, throughput (request/sec) increased when using 50 threads. have run many times, result still same. what happening here? i'm still amateur jmeter. appreciated. possibility of increase in throughput on increasing load generally: increased error rate , more errors increase throughput. hope help.

PHP error unexpected '[' with php 5.3 -

this question has answer here: php unexpected '[' 1 answer i can not use newer php version 5.3 , error message: **parse error: syntax error, unexpected '[' in path/product.php on line 17** i founded on page php version problem, how can solve in php 5.3? the code on line exactly: $_productids = []; old version doesn't support syntax. update to: $_productids = array();

python - "ValueError: The truth value of an array with more than one element is ambiguous" -

i trying execute following code :( simple code kmeans algorithm has been written in python.the two-step procedure continues until assignments of clusters , centroids no longer change. convergence guaranteed solution might local minimum. in practice, algorithm run multiple times , averaged. import numpy np import random numpy import * points = [[1,1],[1.5,2],[3,4],[5,7],[3.5,5],[4.5,5], [3.5,4]] def cluster(points,center): clusters = {} x in points: z= min([(i[0], np.linalg.norm(x-center[i[0]])) in enumerate(center)], key=lambda t:t[1]) try: clusters[z].append(x) except keyerror: clusters[z]=[x] return clusters def update(oldcenter,clusters): d=[] r=[] newcenter=[] k in clusters: if k[0]==0: d.append(clusters[(k[0],k[1])]) else: r.append(clusters[(k[0],k[1])]) c=np.mean(d, axis=0) u=np.mean(r,axis=0) newcenter.append(c) newcenter.append(u) return newcenter def shouldstop(oldcenter,center, iterations): max_iterat...

ios - Generate simulator build -

i working on app needs data facebook app. facebook want release simulator build. have followed fb's instruction letter when try build simulator package xcodebuild -arch i386 -sdk iphonesimulator7.1 following error: ld: library not found -lpods clang: error: linker command failed exit code 1 (use -v see invocation) ** build failed ** following build commands failed: ld build/release-iphonesimulator/olabord.app/olabord normal i386 (1 failure) i suspect has cocoa pods don't know how deal it. desperately need guidance or workaround...! i had same problem. since you're working workspace file pods need run following in terminal: xcodebuild -workspace {project name}.xcworkspace -scheme {project name} -arch i386 -sdk iphonesimulator7.1 the fb instructions .app file should in: {base directory}/build/release-iphonesimulator/{projectname}.app in case ended in /developer/derived data/{project name}-{long string of random letters}/build/products/debug...

c++ - libusb_get_device_list seg fault -

i writing file explorer application in qt c++ , have libusb function (qlist usbdevice::getdevicelist()) gets attached usb devices, checks each 1 products vendor , product id's, claims them , returns them in array. works fine , device want, have added refresh button should update device list shown in drop-down list (it calls getdevicelist function again) seg faults when calling: int numdevices = libusb_get_device_list(null, &usbdevices); the second time around , can't life of me see why. if check on code below , see if have missed stupid helpful. qlist<usbdevice*> usbdevice::getdevicelist() { unsigned char manf[256] = {'\0'}; qlist<usbdevice*> usbdevicelist; libusb_device **usbdevices; struct libusb_device_descriptor desc; int numdevices = libusb_get_device_list(null, &usbdevices); if(numdevices < 0) { libusb_free_device_list(usbdevices, 1); return usbdevicelist; } qstring error; for(int i=0; i!=numdevices; ++i) { libusb...

ElasticSearch nested document search with AND operator -

here stated in nested documents, without using nested query not possible retrieve document satisfies multiple conditions @ same time through nested document's fields. here explanation example @ beginning. why not retrieve doc satisfies conditions? if need multiple conditions nested queries, why not use bool query or bool filtered query?

content management system - Free Asp.net CMS with basic module -

i looking asp.net cms (like wordpress) modules news , media, photo gallery, form. checked dotnetnuke site not able difference between community edition , professional edition. can suggest cms? thanks. refer link answers http://www.dotnetnukeprofessional.co.uk/products/version-comparison

javascript - In NodeJS, how to output results from mongodb with different field names? -

i'm using nodejs query mongodb , want output json customized field names. for example, original json mongodb maybe {id:1, text:"abc"} i'd output {objectid:1, displaytext:"abc"}; i understand mongodb has $project operator in aggregate framework not sure how use them in nodejs. the mongodb nodejs packages i'm using var mongo = require('mongodb'); var monk = require('monk'); var db = monk('server:port/mydb'); appreciate advice on this. if using monk appear can access underlying node native driver collection type via .col accessor on selected collection object: var db = require('monk')('localhost/test') , collection = db.get('example'); collection.col.aggregate( [ { "$project": { "_id": 0, "objectid": "$_id", "displaytext": "$text" }} ], functio...

node.js - jsdom: Run a page's javascript functions -

this question has answer here: how call javascript function defined in script tag? 4 answers i've been messing around jsdom , can't figure out how run functions html page. example, i've got simple page this: <html> <body> hello </body> <script> function test() { document.write("bye bye") } </script> </html> and i'd execute test function jsdom. how go doing this? i've tried calling function, node complains doesn't exist. jsdom.env({ url : "http://localhost:8000/test.html", features : { fetchexternalresources : ['script'], processexternalresources : ['script'] }, done : function (error, window) { test(); // i'd this. console.log(window.document.innerhtml); } }); well apparently ...

java - How can I filter my result set by a field on the Many side of a @OneToMany relation on Ebean? -

i have models setup following: @entity public class extends model { @id @column(name = "id") private long id; @onetomany list<b> bees; } @entity public class b extends model { @column{name = "sting"} private string sting; @manytoone @column{name = "a_id"} aces; } how can have b reference sting = 'ready'? in sql select a.* a, b a.id = b.a_id , b.sting = 'ready'. i'm using ebean within play framework. just use .eq("bees.sting", "ready") , appropriate join automatically added you. so: list<a> list = a.find.where().eq("bees.sting", "ready").findlist();

c++ - MFC - UpdateData(False) + Thread + Debug assertion failed -

im using visual studio 2010, work mfc 2008/2010. have problem thread , updatedata(false) init function bool cbkav_btap2_appdlg::oninitdialog(){ .... afxbeginthread (mythreadproc,(lpvoid)getsafehwnd()); return true; // return true unless set focus control } this thread uint __cdecl mythreadproc( lpvoid pparam ) { dword totalphys; dword availablephys; dword memoload; cbt2class* pobject = (cbt2class*)pparam; pobject->getramandcpuinfo(totalphys,availablephys,memoload ); cbkav_btap2_appdlg dlgobject; dlgobject.ec_totalphys = totalphys; dlgobject.updatedata(false);<--- can not update data return 0; } cbt2class class in dll file created before. ec_totalphys edit_control. when run, return "debud assertion failed". dont know why. please me. thankss. p/s: think need use sendmessage update data dialog search every still can't work. you passing hwnd thread parameter. not pointer , should not cast ...

php - How to create multiple pages? -

Image
i using jquery mobile 1.4.2. i want create page this: i have create page login>delivery>payement.(its 3 step process) when complete login section goes delivery section. what want know whether have place contents in single .php file or should create separate .php files login,delivery,payment. 2.how create login>delivery>payement headings. please me this. you need create mix of everything. first need use multi page template every page inside 1 html. important top toolbar. if can see correctly top toolbar has 3 sections. in case need have 1 header 3 separate pages. give impression user working only 1 page. have 1 header, spend less time changing css. that 1 header have 3 separate parts. can use navigation widget (without icons) or create yourself. , depending on active page change navigation segment background. examples: make header/footer not changing while content changes: http://demos.jquerymobile.com/1.2.1/docs/toolbars/footer-persist-a....