Posts

Showing posts from July, 2011

javascript - Getting Youtube view counts for several videos using APIv3 (jquery) -

i'm trying create youtube social feed includes video, title, description, date, , view count. i've got work except last one, view count. i've been able view counts show out of order , i'm lost on how make them match respective videos. used video initial tutorial: [ https://www.youtube.com/watch?v=jdqsifw74jk][1] got me far, i'm lost again. here code via code pen: [ http://codepen.io/thatsmyjams/pen/ejzwex][2] here html: <div id="container"> <h2>results:</h2> <ul id="results"></ul> </div> and here javascript: var yourapikey = 'aizasydpy9fhgp7evndr5mgrxwwkgubtfm8l5pe'; var channelname = 'googledevelopers'; var vidcount = 5; var vidheight = 275; var vidwidth = 400; $(document).ready(function(){ $.get( "https://www.googleapis.com/youtube/v3/channels", { part: 'contentdetails', forusername: ch...

JNI code in Windows works with PATH but not java.library.path -

java 1.6 on windows working java library uses jni. want point @ dll's using java.library.path environment variable, doesn't work. when put same paths in path variable, works fine. successful case: c:>set path=\progra~1\company\compan~1\lib;\progra~1\java\jdk1.6.0_43\bin (setting path without drive or spaces try avoid space issues, though jars , libraries on c drive) java -cp %classpath% com.company.samples.ft.mainclass unsuccessful case 1: set path=\progra~1\java\jdk1.6.0_43\bin c:>java -djava.library.path=\progra~1\company\compan~1\lib -cp %classpath% com.company.samples.ft.mainclass ft\ft.cfg not load base company api library exception in thread "main" java.lang.unsatisfiedlinkerror: c:\program files\company\company client api\lib\companyapi.dll: can't find dependent libraries @ java.lang.classloader$nativelibrary.load(native method) @ java.lang.classloader.loadlibrary0(classloader.java:1807) ...

javascript - Show database records with json -

i building simple app intel xdk , need connect app mysql database. because intel xdk not allow php files needed connect html php via javascrapt , json. here php code found , edited sends php array json object intel xdk app: <?php if(isset($_get["get_rows"])) { //checks format client wants if($_get["get_rows"] == "json") { $link = mysqli_connect("localhost", "xxxx", "xxxx", "xxxx"); /* check connection */ if (mysqli_connect_errno()) { echo mysqli_connect_error(); header("http/1.0 500 internal server error"); exit(); } $query = "select * quotes limit 1"; $jsondata = array(); if ($result = mysqli_query($link, $query)) { /* fetch associative array */ while ($row = mysqli_fetch_row($result)) { $jsondata = $row; } /*...

Code, going through an array in javascript -

'm trying create function continuously loop through array , check if there still elements value. if there no more of these elements, function execute action. i'm checking '0'. if nothing ='0', want display image. here's have, suggestions? function partiewin() // on verifie si il y encore des cases avec pour valeur '0' et si non, on fini la partie { var found=false; (i=1; <= hauteur; i++) { (j=1;j <= largeur; j++) { if( decor[i][j]!=0) { window.alert("you win"); found=1; } } } if(!found) { } } this array var decor = new array(hauteur); (i=0; <= hauteur; i=i+1) { decor[i] = new array(largeur); } the array long list of shape : decor[1][1] = '24'; decor[1][2] = '21'; decor[4][8]='0' ; etc shouldn't work? i'm not getting alerts or answer whatsoever once '0' technically gone map.. var found = false; for(var = 0; ...

Running Java class with JMeter (Bean Shell) -

i have written java class use in jmeter, packaged project .jar file , moved file lib/ext folder in jmeter directory. have seen documentation on how proceed give contradictory answers. the first way use beanshell sampler import package , class, create object of class , run methods way. have used method using example classes more simple file structures of class want run. example classes work following beanshell script. import tools.jmetertools; jmetertools jt = new jmetertools(); jt.foo(); when try use method class want run, states variable declaration error , class cannot found. assume because not understand import exactly, file structure in project little odd. the second uses beanshell preprocessor add jar class path. method have not been able work @ all, have read many accounts of others finding success. works follows: addclasspath("directory path jar\lib\ext\foo.jar"); jmetertest jtm = new jmetertest(); jmt.test(); would have knowledge of way work better or ...

curl - How do I accept POST requests from Go and write output to a file? -

first of all, i'm trying create logging service in go, lightweight server accepting post requests log data service. i'm writing service in go because supposed fast , handle lot of post requests @ once. logic sound there? anyways, issue. i'm sending post requests test: curl -h "content-type: application/json" -x post -d '{"hello":"world"}' http://localhost:8080/log and here go script far: package main import ( "fmt" "log" "net/http" ) func logger(w http.responsewriter, r *http.request) { r.parseform() fmt.println(r.form) fmt.println(r.formvalue("hello")) } func main() { http.handlefunc("/log", logger) log.fatal(http.listenandserve(":8080", nil)) } it outputting: map [] why that? how write post data file on server? thank much! w r.method contains type of received request (get, post, head, put, etc.). you can read data r....

Convert SAS date time value to Java YYYY-MM-DD HH:mm:ss -

i have date time values coming sas ( 10 digits) 1627741415 . want convert them in java code generate java date time yyyy-mm-dd hh:mm:ss.0 i cant find how sas date time works this. 1627741415 corresponds july 31, 2011 2:33:35 p.m. , want be 2011-07-31 14:33:35.0. any appreciated. in advance since sas datetime value represents number of seconds between january 1, 1960, , specified date. think use difference epoch time 1970. i did quick test using code : localdatetime datetime = localdatetime.parse("2011-07-31t14:33:35.0"); system.out.println(datetime.tostring()); system.out.println(datetime.toepochsecond(zoneoffset.utc)); system.out.println(" difference : "+ (1627741415 - datetime.toepochsecond(zoneoffset.utc) )); and use difference of 315618600 calculate dates. so have 1627741415 subtract 315618600 endup epoch date can use in application.

bit manipulation - Write protocol headers in little endian to wire - Clean approach in Java? -

i'm experimenting quic example server chromium project, i'm trying implement simple java client speaks quic. how program header fields (quic defined in little-endian)? i'm throwing around byte-arrays , bitwise operators feels there should lot cleaner way this. libraries allow me set bits in header , stuff that? greetings you can use bytebuffer , define little-endian: bytebuffer buffer = ... buffer.order(byteorder.little_endian); then can call putint(value) put integer values using byte ordering want , later retrieve bytes , send them on merry way.

ios - After Removing App Extension Still Get App Installation Failed Error- This app contains an app extension with an illegal bundle identifier -

"this app contains app extension illegal bundle identifier. app extension bundle identifiers must have prefix consisting of containing application's bundle identifier followed '.'." i used create widget extension in project, after while deleted it, today tried run app on iphone got error. it works on simulator. , try install on other iphones works well. guess physical device specific problem. tried delete , reinstall app , restart device did not work, , checked again there no extension target or file in project, still getting same error. i had same problem. turns out need clean project , build folder shortcut command + option + shift + k

ios - About "Declaration is only valid at file scope" -

i have class+extension swift file. after adding delegate declared in file class, xcode shows "declaration valid @ file scope" @ extension line. don't know problem is. can me fix it? class listviewcontroller: uiviewcontroller, additemviewcontrollerdelegate {...} extension listviewcontroller: uitableviewdatasource{ func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: true) performseguewithidentifier("showdetail", sender: indexpath) } } the error somewhere in ... — error means listviewcontroller class didn't closed, extension being interpreted nested inside, this: class listviewcontroller { ... extension listviewcontroller { } } find missing closing brace , should solve problem.

binary search tree - What is the worst case complexity of the given program? -

program takes input balanced binary search tree n leaf nodes , computes value of function g(x) each node x. if cost of computing g(x) min{no. of leaf-nodes in left-subtree of x, no. of leaf-nodes in right-subtree of x} worst-case time complexity of program is my solution : for each internal node maximum cost n/2. every leaf node cost zero. and number of internal nodes balanced binary tree : leaf nodes - 1 so total cost : n/2 * (n-1) o(n^2) am right? i have different solution. worst case tree happen complete tree got right , therefore number of leaf nodes n/2. but case root node. for nodes @ level 1: total cost 2*n/4=n/2 for nodes @ level 2: total cost 4*n/8=n/2 and on till last level log(n) , cost again = n/2 total cost therefore in worst case =n/2*log (n) = o(n*logn), in complete tree can happen last level not filled in asymptotic analysis ignore such intricate details.

c++ - VS2013: Can't create vector from one size_t element -

just want make sure bug , i'm not doing wrong. compiles fine gcc (mingw): std::vector<size_t> a({1, 2}); // works std::vector<size_t> b({1}); // not work std::vector<int> c({1}); // works error: error c2440: 'initializing' : cannot convert 'initializer-list' 'std::vector<std::seed_seq::result_type,std::allocator<char32_t>>' it bug in vs2013 believe initializer-lists added in version. note if omit () seems work fine: std::vector<size_t> b{ 1 }; // works trying few other variations yields surprising results too: std::vector<size_t> b({ 1 }); // not work std::vector<size_t> b1({ 1u }); // not work std::vector<long> b2({ 1 }); // not work std::vector<long> b3({ 1l }); // works std::vector<long long> b4({ 1l }); // not work std::vector<unsigned int> b5({ 1u }); // not work std::vector<size_t> b6{ 1 }; ...

database - Can I connect Aldelo POS System (for a restaurant) to MySQL? I want to run queries more efficiently -

hello! i started @ popular restaurant chain , analyzing data. use pos system known "aldelo" @ moment, , has pretty limiting gui. i want know if it's possible connect/integrate such system , able use mysql programming in order able merge tables/databases more seamlessly , work more efficiently. (i liked using sqlyog in past ; ideal) as create more interesting queries observing our data. please let me know if can provide further details! , thank time, guys.

chef - knife-vsphere plugin not working -

following adding 'knife-vsphere' cookbook's gemfile: gem 'knife-vsphere' i try use following command: knife vsphere vm list and following error: "fatal: cannot find sub command for: 'vsphere'" clearly knife isn't aware it's installed, is. os x 10.10.3 chef 12.3.0 (in /opt/chefdk/bin) ruby 2.2.2 via rbenv knife-vsphere: https://github.com/ezrapagel/knife-vsphere use chef gem install knife-vsphere to install chefdk's ruby ( docs ).

javascript - Highcharts (Highstock) how to catch errors? -

is there way catch errors thrown highcharts? invalid negative value error quite common in case whenever app switches different dataset on server. i'm looking forward like: try { // code may or may not work } catch (err) { // print out error or come workaround } thanks guys!

Trying to Create Homepage with Random Background Image Each Time it is Accessed. Using HTML and JavaScript. What am I doing wrong? -

i'm trying make array of multiple background images , having browser choose 1 @ random display. i have attempted coding don't know i'm going wrong. here code working with <head> <meta charset="utf-8"> <title>christopher tameji foose</title> <script src="chrisfoose.js"> var imgsrcarr = ["/background/000.jpg", "/background/001.jpg", "/background/003.jpg"] window.onload = function() { var randnum = math.floor(math.random() * 3); console.log(randnum); document.getelementbyid("main").style.backgroundimage = "url('" + imgsrcarr[randnum] + "')"; } </script> <link rel="stylesheet" href="stylesheet.css"> ;<script> ;</script> a zip of website @ https://www.sendspace.com/file/2la4he . feedback appreciated. you have couple of issues here. first, document.g...

encryption - RSA Simple example with Javascript? -

Image
i know may kind of basic having exam on next week , wanted test knowledge of rsa. i have simple problem working on see mechanics of rsa, , want test if can encrypt , decrypt message in browser console. the rsa variables are: var p = 11 //the first prime number var q = 5 //the second prime number var m=72 // message var n=55 // rsa modulus, n = p*q var e=7 // (e,n) public key var d=23 //so (d,n) private key var fi_of_n=40 //the totient, fi_of_n = (p-1)*(q-1) = 40 to encrypt, doing: var c = math.pow(m,e)%n // m^e mod(n); c=8 i c equals 8 then want decrypt, using d follows: var m2 = math.pow(c,d)%n // c^d mod(n) but result 17! not 72 expected. don't know doing wrong , think simple example. the values of public , private key ones obtained in video: https://www.youtube.com/watch?v=kyasb426yjk rsa has limitation messages strictly smaller modulus can encrypted. message of 72 big modulus of 55. can see encryption , decryption work, because 17 = 72 (mod 55)...

Activity layout android ImageView, ImageButton scaling -

i want achieve of format shown in image. blue part background, image of guy , girl imagebutton. original images these 88x128 (trainer000, trainer001). want rescale imagebutton such image covers entire height , width adjusted accordingly. found 2-3 ways make use of separate class calculate width. want know if there way purely in xml file itself. what used: ` <imagebutton android:id="@+id/maleimage" android:layout_width="wrap_content" android:layout_height="fill_parent" android:adjustviewbounds="true" android:scaletype="fitstart" android:layout_alignparentleft="true" android:src="@drawable/trainer000" /> <imagebutton android:id="@+id/femaleimage" android:layout_width="wrap_content" android:layout_height="fill_parent" android:adjustviewbounds="true" android:scaletype="fitstart" android:layout_alignpa...

How to use hex value for bullet in CSS -

this question has answer here: adding html entities using css content 8 answers im trying use hex value bullet in css mentioned here can use html entities in css “content” property? note don't want use <li> element show bullet <table> <tr> <td> <span class="mybullet"/> <a href="#">link1</a> </td> </tr> </table> .mybullet { content:"\2022 "; color:#f00; } however not working. here jsfiddle http://jsfiddle.net/kq2fzb2v/ use either :before or :after : .mybullet:before { content: "\2022"; color: #f00; display: inline-block; } .mybullet:before { content: "\2022"; color: #f00; } <table> <tr> <td> <span class="mybullet"...

indexing - avi recording index failure -

since 3-4 weeks have problems video-file recording. everytime become index fail after close / finish recorded file. index important me, because recorded files should used later cut processes. index failure cut me wrong part video... the constalation follow: logitech (b910hd) webcam input source => xvid codec de/encoder => filewriter. done little, own developed tool of directshow (directshowlib-2005.dll). i tried logical debugging steps... has reinstalled codecs / tried lot of codec settings / tried other computers , other codecs (x264vfw) / reinstalled system (windows 7 pro x64 , windows xp pro sp3) / changed webcam (other b910hd , c920hd pro) / .... the more or less crazy thing working before 4 weeks , working fine on other machines (same os / same units , hardware). though maybe hardware failure units (maybe hdd or memory) tests of hardware too! thanks in advance possible solutions! comment: vlc media player says index defect. windows media player tell me nothin...

c# - Data accessing while database file size more than 4 GB -

i working on ormlite-servicestack , asp.net/c# sqlite database . facing issue while accessing data database file. size of database file 4.5 gb approximately. i trying load data complex sql query (atleast 6-7 million records in each table) asp.net , using sqlitedatareader executereader() . application hangs. in fact not able run sql query via sqlite-manager firefox (version 0.8.3.1) github sqlite browser. both tool become hang, have kill task manager. please suggest optimization tool or configuration setting sqlite database. can able access data via web application or web service. i believe sqlite have 2gb limit, apparently went beyond 2gb. here limitations of sqlite https://www.sqlite.org/limits.html if needs go beyond that, need consider using different database system sql server.

encoding - Python: UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 0: ordinal not in range(128) -> Excel -

i trying wrap head around while , have not yet seen solution not confuse me. i got script in python should write array words (german names) excel file. cell = [name_1, name_2, name_3] import csv fl = open('company_data.csv', 'w') writer = csv.writer(fl) writer.writerow(['name_1', 'name_2', 'name_3']) values in cell: writer.writerow(values) fl.close() the error comes ...,line 135, in writer.writerow(values) unicodeencodeerror: 'ascii' codec can't encode character u'\xfc' in position 0: ordinal not in range(128) [finished in 1.2s exit code 1] the names include german characters ü,ä,ö etc. how fix this? i think have open file , specify want write unicode. aussming want utf-8: import codecs fl = codecs.open("company_data.csv", "w", "utf-8")

How can I fill treeview with visual.net from db (access) -

how populate treeview control in visual basic (vb.net) db (access) that depends on data. in general, need create treeview first , populate nodes. did in c# once similar vb. documentation of microsoft quite helpful. in c# start this: var mytreeview = new treeview(); mytreeview.nodes.add("root"); this create treeview 1 node. nodes property list of child nodes. every treenode has property, can use combined indexing select node want. f.e. mytreeview.nodes[0].nodes.add("child") add child node root node.

Source control is null when accessing from a sub context menu item in C# -

i trying change color of button when click on sub menu item (colors > red) context menu strip. this code attached user defined amount of buttons. figure out button trying change, trying go sub item source control such: sender > owner tool strip > owner menu > source control. my code: private void redtoolstripmenuitem_click(object sender, eventargs e) { toolstripitem subitem = sender toolstripitem; if (subitem == null) return; toolstripitem mainitem = subitem.owneritem toolstripitem; if (mainitem == null) return; contextmenustrip menustrip = mainitem.owner contextmenustrip; if (menustrip == null) return; datagridview datagridview = menustrip.sourcecontrol datagridview; if (datagridview == null) return; //null here messagebox.show(datagridview.name); } from i've found on google, appears bug. there workarounds this?

ios8 - Swift TabBar Item color and background color -

Image
i'm trying set icon color , background color of individual item on tabbar within tabbarcontroller. i have 5 icons on tabbar, 4 of i've set color for, it's last icon i'm struggling with. i've attached link below of image show i'm trying achieve. the specific icon (the 1 in middle of image) camera feed, icon white , background red. code far such - on tabbarcontroller: var imagenames = ["feedicon", "exploreicon", "cameraicon", "activityicon", "myprofileicon"] let tabitems = tabbar.items as! [uitabbaritem] (index, value) in enumerate(tabitems) { var imagename = imagenames[index] value.image = uiimage(named: imagename) value.imageinsets = uiedgeinsetsmake(5.0, 0, -5.0, 0) } //for below i've used extension imagewithcolor set color of icons tabitems in self.tabbar.items as! [uitabbaritem] { if let image = tabitems.image { tabitems.image =...

path - Is there a way to drill down/search directory in dotcms? -

Image
for example, if wanted go mysite.com/this/is/the/path there way drill down path via search function? scrolling through layers , layers of folders no fun, on siteas big ours here @ work. as far can tell right now, there doesn't seem kind of search/filtering option, again, may not have turned on. any ideas? you can (since dotcms 3.2.1) search url content search screen. see searching pages under /about-us on http://demo.dotcms.com site:

css - Content height 100% producing vertical scrollbar -

i've found lot of questions asking similar this, none of solutions i've found have applied problem i'm facing. basically, i've got menubar, , content, want content's background colour fill height of page. when apply height: 100%; though, scrollbar. i've read margin collapse, , might that, no matter how many margins rid of , replace mere position: absolute; , can't bottom of situation. relevant bits of css here: body, html { color: #000000; font-family: 'open sans', sans-serif; font-size:12pt; background:#f2f2f2; padding:0; margin:0; height:100%; width:100%; } #menubar { position:absolute; top:0px; background:#fdbb30; height:80px; width:100%; font-weight:bold; } #content { position:absolute; top:80px; width:92%; left:50px; background:#ffffff; height:100%; } you can use calc in css: #content { height:calc(100% - 80px); } https://jsfiddle.net/ydyonjw9/1/

c# - Post an image with HTTPClient but also some parameters on windows phone -

i want multipartformdatacontent request. want pass lot of params it. when i'm doing post this: public async task<webservice> invitemembrs(list<keyvaluepair<string, string>> values) { string strurl = string.format("http://*****.com/nl/webservice/abc123/members/invite"); var http = new httpclient(); var request = new httprequestmessage(httpmethod.post, new uri(strurl)); request.content = new httpformurlencodedcontent(values); var result = await http.sendrequestasync(request); var data = new webservice { status = result.statuscode }; if (result.statuscode == windows.web.http.httpstatuscode.ok && result.content != null) { data.data = await result.content.readasstringasync(); debug.writeline(data.data); } return data; } this works perfect. want pass image it. found lot of exa...

c# - Assign Unique id's to buttons in foreach loop -

Image
i building online shopping website , @ time there 3 products in it. here's sample of products. first image, product name, description, price, id , "add cart" button build programmatically , dynamically. can see every product have own button created through foreach loop. confuse how can unique id's assigned it? means when click on add cart button, give me id=3 in foreach loop. now, want how "add cart" button identify product clicked , show specification of product , proceed according it. here's sample of code: using 3-tier architecture , here's sample of code: dataset ds=obj.searching_product(); datatable dt = new datatable(); dt = ds.tables["register_product"]; foreach(datarow dr in dt.rows) { literal li2 = new literal(); li2.text = "<br/>"; this.panel1.controls.add(li2); label lb1 = new label(); lb1.text = dr["name"].tostring(); this.panel1.controls.add(lb1); //adding here...

c - fgets() creating another copy of string at time of input? -

i'm wondering error here? i'm making causer cipher, , works fine when print encrypted message @ end, reprints unencrypted message. when comment out , set message sentence, works fine. when string using fgets creates copy. in advance! #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> int main(int argc, char *argv[]) { char message[100]; printf("please enter message encrypted: "); fgets(message, 100, stdin); unsigned char caeser[] = ""; int j = 0; if(argc >= 2) { int k = atoi(argv[1]); for(int = 0, n = strlen(message); < n; i++) { printf("%i\n",n); if(!isspace(message[i])) { if(islower(message[i])) { j = message[i] - 97; caeser[i] = 97 + ((j + k) % 26); } if(isupper(message[i])) { j = message[i] - 65; ...

c++ - openCV cv::mat release -

when using opencv cv::mat. http://docs.opencv.org/modules/core/doc/basic_structures.html understand sort of smart pointers being used. question is, in order memory optimization. should call cv::mat release() in order free unused matrices? or should trust compiler it? for example think of code: cv::mat filtercontours = cv::mat::zeros(bwimg.size(),cv_8uc3); bwimg.release(); (int = 0; < goodcontours.size(); i++) { cv::rng rng(12345); cv::scalar color = cv::scalar( rng.uniform(0, 255), rng.uniform(0,255), rng.uniform(0,255) ); cv::drawcontours(filtercontours,goodcontours,i,color,cv_filled); } /*% fill holes in objects bwimglabeled = imfill(bwimglabeled,'holes');*/ imagedata = filtercontours; filtercontours.release(); //should call line or not ? the cv::release() function releases memory , destructor take care of @ end of scope of mat instance anyways. need not explicitly call in code snippet have posted. example of when needed if siz...

c# - Visual Studio web browser control not running Javascript -

i'm using microsoft visual studio c# 2015 , have encountered problem. i'm creating small windows forms application program uses web browser tool. when launches, goes webpage uses javascript , doesn't launch these scripts. don't know how activate javascript on web browser control. ie works fine me. i'm using windows 8.1 64 bit. here code: edit: have enabled javascript on ie since website works when use ie access it. using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.windows.forms; namespace windowsformsapplication2 { public partial class form1 : form { public form1() { initializecomponent(); } private void webbrowser1_documentcompleted(object sender, webbrowserdocumentcompletedeventargs e) { } private void form1_load(object sender, event...

Requests on Jersey endpoints are not filtered through Filter by Guice's ServletModule in my JUnit test -

problem i working on restful api using jersey. allow mocking of objects in unit tests, use dependency injection framework guice (in particular guice-servlet). possible filter requests through own filter implementations, overriding configureservlet() method of servletmodule , adding: bind(myfilter.class).in(singleton.class); filter("path").through(myfilter.class); when running webapp in tomcat, requests correctly filtered through myfilter class. but, in junit tests none of requests filtered through it. can me find problem? example bitbucket repository example code web / web-inf / web.xml : used tomcat. defines applicationsetup guicefilter on path '/api/*'. src / main / java / applicationsetup.java : creates guice injector production environment (tomcat webserver). uses applicationmodule 1 of servletmodules. src / main / java / applicationmodule.java : servletmodule configures , binds myfilter , jersey endpoints on path '/api/*'. src / mai...

cakephp - Cake 3.x: List all models -

i need list of models of application (including plugins). in cake 2 use app::objects('model'); . how able in cake 3.x? thanks! bob i'm not sure if helps, should give information you're going able get. point of commenter(s), there aren't "models" in cakephp 3 - there tables , entities. use cake\datasource\connectionmanager; use cake\orm\tableregistry; // ... $tables = connectionmanager::get('default')->schemacollection()->listtables(); foreach($tables $key => $table) { $tabledata = tableregistry::get($table); debug($tabledata); } returns each table: object(app\model\table\photostable) { 'registryalias' => 'photos', 'table' => 'photos', 'alias' => 'photos', 'entityclass' => '\cake\orm\entity', 'associations' => [ (int) 0 => 'tags', (int) 1 => 'categorized' ], 'behaviors' => [ ...

ruby on rails - How to use session_path with simple_form? -

i'd adapt form_tag simple_form <%= form_tag sessions_path %> <%= label_tag :password %> <%= password_field_tag :password %> <% end %> it works fine, can log in normally. <%= simple_form_for(sessions_path) |f| %> <%= f.error_notification %> <%= f.input :password %> <%= f.button :submit %> <% end %> here no route matches [post] "/sessions/new" in routes.rb have following line get 'login', :controller => 'sessions', :action => 'new' could me fix it? form_for (and therefore simple_form_for ) assume have model , posting or patching resource route. but don't have model , route route, need pass in options simple_form make work. this should it: simple_form_for(sessions_path), method: :get but there's answer should (not accepted one, second one): does form_tag work simple_form?

excel - How to add a comma delimiter to the beginning of the city in an address -

Image
example: 1412 chestnut street philadelphia 494 w germantown pike plymouth meeting i add comma beginning of each city in list of 200 can see above city name not start @ last word in cell. is there overarching formula add comma before philadelphia , plymouth meeting ? here simple example can adapt use. have addresses in column a , city list in column b : the following macro scans addresses looking [space][city] , replaces city [,][city] sub commafication() dim acol string, ccol string dim ia long, ic long, va string, vc string '''''''''''''''''''''''''''''''''''' ' update these needed acol = "a" ccol = "b" iamax = 3 icmax = 6 ''''''''''''''''''''''''''''''''...

javascript - Backbone - remove last model in Collection, but only by filter -

this.keyscollection.pop(); removing last 1 pretty simple, i'd ideally (pseudo solution): this.keyscollection.pop({ type: 'foo' }); and remove last matching model collection. possible? edit: went - const models = this.where({ type: 'foo' }); const model = models[models.length - 1]; this.remove(model); pop gets last element , calls remove on result, backbone source pop: function(options) { var model = this.at(this.length - 1); this.remove(model, options); return model; }, since that's case can use where models match filter , pass last model results remove yourself. var matchingmodels = this.where({type: 'foo'}); this.remove(matchingmodels[matchingmodels.length - 1]);

How to implement Spring Security Ldap authentication using the configurer class correctly? -

hi i'm trying implement spring's ldap authentication using websecurityconfigureradapter class. so far can authenticate through in memory method , corp's ldap server, latter method i'm able authenticate if pass hardcoded userdn , password when create new context, if don't create new context or don't put userdn , password, jvm throws me: caused by: javax.naming.namingexception: [ldap: error code 1 - 000004dc: ldaperr: dsid-0c0906e8, comment: in order perform operation successful bind must completed on connection., data 0, v1db1\u0000]; remaining name: '/' my question is, how can user password , userdn login form can put in context? if not possible how can context password , userdn are? this code have: @configuration @enablewebmvcsecurity public class websecurityconfig extends websecurityconfigureradapter { @autowired public void configureglobal(authenticationmanagerbuilder auth) throws exception { auth.ldapauthentication().u...

How can I set position independent build setting using xcodebuild from the command line? -

i'm working third party tools generate xcode project files few subcomponents. tools generate project files generate position-dependent code set yes (potentially because tool generates project files os x builds , latest update has confused). while turn these flags off in gui, it's not convenient build process scripted generate each project file, build it, move binaries around, lipo them together, etc. i'm sure these settings can overridden on command line, i'm curious setting key is. instance, don't know if setting=value means setting name verbatim how displays in xcode (generate position-dependent code), there spaces in it. if can provide listing of settings can passed xcodebuild, super. the setting name gcc_dynamic_no_pic . "generate position-dependent code" description.

java - Images stored on disk - search by name -

i writing java application (actually struts2 web application) , need store , retrieve images. found out not idea store images in database ( can store images in mysql ) , preferable write them on disk, in directory. at point need access images name contains substring. if used database, write query this: select .. name %my_substring% . how can achieve same functionality using java file system? certainly, don't want load images, , iterate them find proper name. as marked answer in question linked states: do not store images in database. store images in directories and store references images in database . thus, query become select path name %my_substring% (where path name of column reference image stored). once query executed, application access images per result of query.

javascript - Wait for user action -

i looking solution, if possible wait data entered user in protractor. i mean test stop while , can enter value , these data used in further tests. i tried use javascript prompt, did not much, maybe possible enter data in os terminal? please give me example if possible. i not recommend mixing automatic , manual selenium browser control. that said, can use explicit waits wait things happen on page, e.g. can wait text present in text input , or element become visible, or page title equal expect, there different expectedconditions built-in protractor , can write own custom expected conditions wait for. have set reasonable timeout though. alternatively, can pass user-defined parameters through browser.params , see: how can use command line arguments in angularjs protractor? example: protractor my.conf.js --params.login.user=abc --params.login.password=123 then, can access values in test through browser.params : var login = element(by.id("login...

javascript - Cannot read property of 'appendchild' of null in a For-Loop -

i have small database have retrieved data , stored in html table. this table contains 3 columns , 3 rows. what want via javascript create div each row, within create div each cell in row of table (to allow me style in css). i have created number of loops go through , attempt this, problem second loop have created, goes through once , receive error of "cannot read property 'appendchild' of null". not sure why doing this. appreciated. var gettable = document.getelementbyid('projectstable'); var rowlength = gettable.rows.length; (i =0; i< rowlength; i++) { var divname = 'projects' + i; block = document.createelement('div'); block.id = divname; document.getelementbyid('javascript').appendchild(block); var getcells = gettable.rows.item(i).cells; var celllength = getcells.length; (var j = 0; j < celllength; j++) { var divname2 = 'projects' + j; var projectinfo = '...

sql - Improving my query efficiency - reducing full table scans? -

i wondering if me out have working query, feel not efficient be. ill go on explain: i have car table , carevent table. car table stores info such make, model etc of car. carevent table stores events happened on car such car has been crashed or car has been fixed. if no status of "crashed" exists on carevent table given car has not been crashed. query return cars have been crashed not fixed. way have wrote requires 2 scans of carevent table. what im wondering is, there more efficient way query? my query follows: select * car c (select count(ce.id) carevent ce car_id = c.id , ce.careventtype = 'crashed') > 0 , (select count(ce.id) carevent ce car_id = c.id , ce.careventtype = 'fixed') = 0 any advice appreciated. oh, infamous count() in subquery. want use exists , not count : select c.* car c exists (select 1 carevent ce ce.car_id = c.id , ce.careventtype = 'crashed') , not exists (select 1 ca...

javascript - Spring web MVC with Angular JS - Routing -

i new angular js , wondering how routing in angular js couples spring web mvc. spring controllers work on requests , hence, if routing login page home page, when - $routeprovider.when( '/', { templateurl : 'home/home.html', controller : 'homectrl' }) .when( '/login', { templateurl : '/login/login.html', controller : 'loginctrl' }) .when( '/register', { templateurl : '/login/signup.html', controller : 'registerctrl' }); then spring controller matching request url, , render view according. point is, entire view should rendered right? entire page reloaded, won't it? takes away entire point of using routing in angular. thinking wrong way? please correct me if thinking wrong. there 2 main option in hands: build single page angularjs application in scenario build fledged an...

selenium - I can't connect to my site -

i've started playing around behat, , loving it. shut down computer , went home day , when came back, nothing worked me anymore!! i've been trying trouble shoot couple of days, looks configurations vary widely, can't find works me. i'm getting following error given on homepage # drupal\drupalextension\context\minkcontext::iamonhomepage() not open connection: curl error thrown http post http://localhost:4444/wd/hub/session params: {"desiredcapabilities":{"tags":["rio","php 5.5.9-1ubuntu4.9"],"browser":"firefox","version":"14","ignorezoomsetting":false,"name":"behat feature suite","browsername":"firefox"}} requested url returned error: 500 server error (behat\mink\exception\driverexception) i've got behat.yml file setup such: default: default: suites: default: contexts: - featurecon...

multithreading - Changing address contained by structure and its members using function (ANSI C) -

[edit]i added main code , of external functions used code. code quite long, in summary sends message device measuring parameters of water in container, , device responds corresponding value measured sensor. after code uses value modify level , temperature of water. prints current status of container , makes log.txt file.[/edit] i want constructor object-oriented-like function in c, address of structure , members not being changed after malloc() them. saw answer changing address contained pointer using function , got idea of problem is, still can't solve it. below code doing constructor: udp.c #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include "udp.h" #define buf_size 1000 #define header_size typedef struct{ int socket; char header[4]; float *send_value; char *message_buffer; }message; void build_mess...

Working around the static type property of C++ -

consider piece of code template<typename t> void call_me(const t& arg) { } template<int i> struct custom_type { }; void foo(int i) { switch (i) { case 0: call_me( custom_type<0>() ); break; case 1: call_me( custom_type<1>() ); break; case 2: call_me( custom_type<2>() ); break; default: break; } } the switch statement incomplete in sense of meant do, i.e. work integers not few explicitly mentioned above. c++ won't allow statement custom_type<i> because i not constant expression. (..and can't change argument function foo constant expression). not use external code generator generates huge switch statement , feeds source code.. is there way in c++/11/14/17 allow writing function call call_me in elegant way, or answer just, 'no, c++ statically typed.'? something should work, addition of special case call_me_t<0> template <int n> struct call_me_t { stati...

c# - Regex - how to do html tag name replacement token -

i trying token replacement in html untokenised string has multiple <input></input> tags. want replace name attribute token <<vs_user_name>> example. regex replaces <input> regardless. below stand alone example. this desired output <div>username&nbsp;<<vs_user_name>></div><div>&nbsp;</div><div>full name&nbsp;<<vs_user_full_name>></div><div>&nbsp;</div><div>password&nbsp;<<vs_user_password>></div><div>&nbsp;</div><div>thanks</div> code: static void main(string[] args) { string text = "<div>username&nbsp;<input class=\"vsfield\" contenteditable=\"false\" name=\"vs_user_name\" style=\"background-color: rgb(220,220,200);\">[user name]</input></div><div>&nbsp;</div><div>full name&nbsp;<input cl...