Posts

Showing posts from February, 2011

CakePHP 3.1: Validation for translate behaviour fields (i18n) -

i'm trying add item including multiple translations in 1 form cakephp translate behaviour . how can validate translation fields? e.g. make specific languages required? let's assume have simple items table separate translations table items_i18n , set described in book. simple example items table has 1 field title translate , want save title in 5 languages. make form (in add view template): echo $this->form->create($item, ['controller' => 'items', 'action' => 'add']); echo $this->form->input('title', ['label' => __('english')]); echo $this->form->input('_translations.es.title', ['label' => __('spanish')]); echo $this->form->input('_translations.fr.title', ['label' => __('french')]); echo $this->form->input('_translations.de.title', ['label' => __('german')]); echo $this->form->inpu

java - Static method used in a class -

i have static method(additem) in class, why need wrap additem(..) uses static parenthesis? why need static word? tnx public class something{ static { additem(new dummyitem("1", "a")); additem(new dummyitem("2", "b")); additem(new dummyitem("3", "c")); } private static void additem(dummyitem item) { ...... } } the static block static { .... } defines static initializer. block of code run once, when class initialized. can call static methods in method, not in static intializers. example write public void foo() { something.additem(new dummyitem("1", "a")); } this code called whenever method foo() called.

java - Dropping the first or last index from an array without getting an "Out of Bounds" Error -

i've been assigned create program in 1 of methods have prompt user input index drop value of. problem when try drop index 0 arrayindexoutofboundsexception @ index -1. fix tried i <= currentsize + 1 fixed index 0 problem, last index out of bounds error because currentsize 1 more array size. appreciated. //this method drops value of selected index in array. private static void drop () { int m =0; system.out.println("choose index drop value of:"); if(input.hasnextint()) { m = input.nextint(); for(int pos = 0; pos < values.length; pos++) { if(pos == m) { for(int = pos+1; i<=currentsize+1; i++) { values[i-1]= values[i]; values[i]=0; } currentsize--; break; } else if(pos == 0) { system.out.println("er

python - sqlalchemy - Could not assemble any primary key columns for mapped table -

i'm using sqlalchemy reflect existing database no foreign keys defined. given following example: engine = sqlalchemy.create_engine(...) base = declarative_base() base.metadata.reflect(engine) class a(base): __table__ = base.metadata.tables['a'] class b(base): __table__ = base.metadata.tables['b'] class c(base): __table__ = sqlalchemy.outerjoin(a, b, onclause=a.foo==b.foo) how can limit fields used in c? i tried setting: __mapper_args__ = { 'include_properties': ['foo', 'bar'] } but error mapper mapper|c|join object on join object on join object on a(47698852085840) , b(47698852088016)(47698861282384) not assemble primary key columns mapped table

model view controller - Convert an object into list or array MVC -

i have mvc grid control passing collection controller object. object arraylist of rows grid , each row list represents instance of class called lineitem part of parent record class. i trying load object class looping through object array, create instance of lineitem class, , add parent record class parent.additem(lineitem). had created follows var items = requestdata.extrarequestdata["items"]; however determined, arraylist changed to list<string> mylist; arraylist items = (arraylist)requestdata.extrarequestdata["items"]; mylist = items.cast<string>().tolist(); i trying convert arraylist list can loop through , load class. model.parent parent = new model.parent(); model.lineitem lineitem = new model.lineitem(); (int = 0; < mylist.length; i++){ lineitem.a = item.a, lineitem.b = item.b parent.additem(lineitem) } i getting following error on line set mylist = items: {"unable cast object of type 'system.col

java - What can an Object[] array hold? -

Image
i new java programming language , had question arrays. string[] arrays hold strings. array[] arrays hold other arrays. object[] array? clearly, these hold object s. but, since object superclass in java, mean object[] array can hold every type of object in java? in other words, can array hold objects child classes of object array created hold? can number[] array hold integer? yes can learn lot trying small program: public class example { public static void main(string[] args) { string string = "string"; integer integer = new integer(1); int integerprimitive = 2; float floatboxed = new float(1.23); float floatprimitive = 1.23f; // can hold different types inheriting object object[] objects = new object[] { string, integer, integerprimitive, floatboxed, floatprimitive }; // can hold inherits number; cannot

javascript - PHP function fails to return correct result after ~1000 ajax posts -

i'm debugging code , in order repeatedly making ajax post php script on localhost apache24 server. in simple terms, php script takes integer value , returns different data string depending on input integer. i'm stepping through numerous integer values loop on javascript side, starting @ x=1. i've noticed, however, after ~980 ajax posts, php function stops returning correct data; seems return data x = 980, x continues increment. console.log confirms x value doesn't hang @ 980. i thought maybe script buggy restarted loop @ x = 980 and, sure enough, php script worked fine until x = ~1900, when stopped working again. is there reason php script fails work after ~980 requests? have received no errors on either web side or server side. function interpretdisplay(input_string) { var display = input_string.split("?"); (var x = 0; x < 16; x++) { document.getelementbyid("ids").inn

c++11 - Nice way to create a dynamic 2D matrix in C++ 11 -

i know how create dynamic 2d matrix using new , free using delete . since c++ 11 here many new memory features such unique_ptr , array container etc.; nice way create 2d matrix 1 needs not free matrix explicitly using delete operator? one of simplest ways use vector of vectors const int n = 10; const int m = 10; vector<vector<int>> matrix2d(n, vector<int>(m, 0)); // 10x10 zero-initialized matrix matrix2d[0][0] = 42; you of course use single vector , wrap accessor class vector<int> matrix(n * m, 0) // ditto above, needs stride-aware accessors i'll post small example here completeness' sake template <typename t> class matrix2d { std::vector<t> data; unsigned int sizex, sizey; public: matrix2d (unsigned int x, unsigned int y) : sizex (x), sizey (y) { data.resize (sizex*sizey); } t& operator()(unsigned int x, unsigned int y) { if (x >= sizex || y>= sizey)

performance testing - ansible command module: JMeter msg: [Errno 2] No such file or directory -

ansible 1.9.2/latest. os: centos 6.7/later java_home, path variable , other things setup correctly. i have following playbook runs in perf_tests/tasks/main.yml. run playbook run only, i'm using ansible tags. # run jmeter tests - name: run jmeter test(s) # command: "export path={{ jdk_install_dir }}/bin:$path && export java_home={{ jdk_install_dir }} && {{ jmeter_install_dir }}/bin/jmeter -n -t {{ common_download_dir}}/perf_tests/projecttest1.jmx -l {{ common_download_dir}}/perf_tests/log_jmeter_projecttest1.jtl" command: export path={{ jdk_install_dir }}/bin:$path && export java_home={{ jdk_install_dir }} && /apps/jmeter/apache-jmeter-2.13/bin/jmeter -n -t /tmp/perf_tests/projecttest1.jmx -l /tmp/perf_tests/log_jmeter_projecttest1.jtl become_user: "{{ common_user }}" tags: - giga files required jmeter executable present on target machine , i'm using "command" module in ansible start jmeter. [

javascript - Upload file with input[type="file"] without a second button to send -

i'm setting typical profile picture upload , crop feature site. i'm looking @ how others have set , see many managing have 1 input type="file" , not allows selecting file calls php or js display image. i'm stuck on how make after image has been chosen. does 1 have link or suggestion on how perform this? one way achieve convert file blob, present using html5 canvas . example: http://www.html5rocks.com/en/tutorials/file/dndfiles/ another option issue ajax request after file input has been changed. whatever server processing need (crop, save, etc.) return ajax call path file. append new <img src='filepath.jpg' /> dom.

php - Dynamic sidebar inside if ( is_user_logged_in() ) { echo ''; } else { -

i want show dynamic sidebar inside div when guest visiting website. idea? <?php if ( is_user_logged_in() ) { echo ''; } else { echo '<div class="slideraanmeldbuiten"> <div class="slideraanmeldbinnen"> <div class="slideraanmeld"> <div class="slideraanmeldinside"> <?php // custom widget area start if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('zoektermen 1') ) : ?> <?php endif; // custom widget area end ?> </div> </div></div></div>'; }; ?> <?php if ( is_user_logged_in() ) { echo ''; } else { echo '<div class="slideraanmeldbuiten"> <div class="slideraanmeldbinnen"> <div class="slideraanmeld"> <div class="slideraanmeldinside"> <?php // custom widget area start if ( !function_exists('dynamic_sidebar') || !dyn

How can I enable gzip compression on WCF websocket duplex nethttpsbinding -

i enable gzip compression following binding. here have in config file currently. <nethttpsbinding> <binding name="mutualcertificatebinding" maxreceivedmessagesize="9223372036854775807" receivetimeout="00:20:00" sendtimeout="00:20:00" transfermode="streamed" messageencoding="binary"> <security mode="transport"> <transport clientcredentialtype="certificate" /> </security> <websocketsettings transportusage="always" /> </binding> </nethttpsbinding> according msdn tcp, http, , https in wcf capable of compression of 4.5, i'm on 4.5.2. keep in mind i'm using wcf contract callback contract duplex required. i'm happy replace binding custom binding control both sides , both .net i've been unable figure out how create custom binding supports websockets. any appreciated, thanks. okay

java - Spring beans unresolved in IntelliJ -

i started project intellij worked did broke it. here applicationcontext.xml file. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean class="foo.bar" /> </beans> when inspecting file error cannot resolve bean 'foo.bar' the same thing happens classes try put in spring configuration file. clue ? here screenshots : spring file error : https://drive.google.com/file/d/0bwhiwys5tjdrawxjuzhbbdvnnk0/view?usp=sharing spring facet : https://drive.google.com/file/d/0bwhiwys5tjdrb1rhbglcow9xetg/view?usp=sharing i use maven import jars , classes exist in classpath. code assist doesn't give me tip when edit bean class property. without full log-trace, can make assumption on why happening did n

windows - bat file not updating the xml file -

i have written bat, 1 below update xml tag, not updating xml file. @echo off set prefix=room107- set suffix=\admin set /p pcname1=please enter desired number: set pcname=%prefix%%pcname1%%suffix% $ sed 's#\<userid>admin</userid># <userid>%pcname%</userid>#' test.xml the userid should updated room107-01\admin . by adding -i , double quotes should work @echo off set prefix=room107- set suffix=\admin set /p pcname1=please enter desired number: set pcname=%prefix%%pcname1%%suffix% sed -i "s#<userid>admin</userid>#<userid>%pcname%</userid>#" test.xml

c++ - g++-5.1.1 warns about unused variable only when optimization flag is used -

in large project, i've been getting compiler warnings g++-5.1.1 when building release version (which uses optimization flags) not while building debug version (which disables compiler optimization). i've narrowed down problem minimal example listed below commands reproduce problem. problem not occur if use g++-4.8.4. bug in g++-5.1.1? or, code doing legitimately wrong , warrants warning? why doesn't produce warnings last 3 cases listed in code (see edit @ bottom explanation)? for interested, here bug report in gcc's bugzilla. /* code complains variable 'container' unused if optimization flag used g++-5.1.1 while g++-4.8.4 not produce warnings in either case. here commands try out: $ g++ --version g++ (gcc) 5.1.1 20150618 (red hat 5.1.1-4) copyright (c) 2015 free software foundation, inc. free software; see source copying conditions. there no warranty; not merchantability or fitness particular purpose. $ g++ -c -std=c++11 -wall -g -o0 test_warning

python - How to Split String Using Delimiters -

i have file called so: test.txt dog;cat;mouse;bird;turtle;# animals dog;cat;mouse;bird;turtle;horse cow # animals i need breaking second line first line: dog;cat;mouse;bird;turtle;horse;cow;# animals the hard part has no set parameters on how many animal can inserted between 5th element , in front of '#' symbol. have 2 i'm showing in example or 10. i'm able break down two-dimensional array not sure how split second string. with open (file) f: lines = list (f) temp = [line.strip ().split (';') line in lines] output: for in temp: print (i) ['dog', 'cat', 'mouse', 'bird', 'turtle', '# animals'] ['dog', 'cat', 'mouse', 'bird', 'turtle', 'horse cow # animals'] desired output: ['dog', 'cat', 'mouse', 'bird', 'turtle', '# animals'] ['dog', 'cat', 'mouse', 'bird

dll - AutoIt (AutoItX) on C# Windows 7 App System.DllNotFoundException -

i have c# application uses autoitx automation. application works fine in windows 8.1 x64 environment compiled microsoft visual studio 2013 release 3. i pushed copy of app code bitbucket repository , cloned computer running windows 7 x64. autoitx version 3.14.2 installed , 32bit calls selected. application compiled using visual studio 2013 release 4 . the app compiled fine, first use of autoit functions resulted in error: an unhandled exception of type 'system.dllnotfoundexception' occurred in autoitx3.assembly.dll i tried following steps. app tested after each of these steps attempted register .dll manually using regsrv32 regsrv32 "c:\program files (x86)\autoit3\autoitx\autoitx3.dll" uninstalled visualstudio 2013 r4 , attempted reinstall visualstudio 2013 r3 {the installation of r3 failed because required internet explorer version 10 , version 11 has been installed on computer} r4 reinstalled uninstalled autoit , reinstalled selecting 64 bit li

c++ - Why is my code not exiting when Entering 3 in the Command prompt? -

i beginner , taking first c++ programming class. using ide named codeblocks , stumped. have searched forums answer cannot figure out on own. i trying figure out why code not exiting when entering 3 in menu on command prompt. trying figure out why when trying convert fahrenheit celsius formula not working, when believe correct formula. the code below: #include <iostream> #include <iomanip> #include <cstdlib> using namespace std; int main () { float celsius; float fahrenheit; char x; //menu user choose option //preform. looping in case type in incorrect // response , choose again. { cout << "please choose option. please press enter. \n"; cout << "1. convert celsius fahrenheit.\n"; cout << "2. convert fahrenheit celsius. \n"; cout << "3. exit program \n"; cin >> x; if (x == '1') system (&q

python - How can i rotate an image from the center rather than the corner in pygame? -

i creating game , need rotate ship, how can rotate ship center rather top left corner? using python 2.7 , pygame 1.9. here code have rotate image. shipimg = pygame.transform.rotate(shipimg,-90) however rotates image corner. rotate sprite set center of new rect center of old rect. way new 1 has same center when you're done, making rotated around center. here's example function pygame wiki : def rot_center(image, rect, angle): """rotate image while keeping center""" rot_image = pygame.transform.rotate(image, angle) rot_rect = rot_image.get_rect(center=rect.center) return rot_image,rot_rect and here's how use in example: # draw ship image centered around 100, 100 oldrect = shipimg.get_rect(center=(100,100)) screen.blit(shipimg, oldrect) # rotate ship , draw new rect, # keep centered around 100,100 shipimg, newrect = rot_center(shipimg,oldrect,-90) screen.blit(shipimg, newrect)

image - Coordinate loop in Processing -

i wanted make image , figured quickest way. idea there rows lines 5 pixels high, , every new row, amount of pixels in between lines 1 pixel more previous row. it's been while since have used java , far came size(800,800); int z = 2; int w = 5; int max = 800; for(int y = 0;y<max;y++){ for(int x = 0;x<max;x=x+z){ point(x,y); if(y%10 == 0)z++; } } this code not quite giving me expected, , can't figure out why. appreciated wow, feel dumb. size(800,800); int z = 2; int w = 5; int max = 800; for(int y = 0;y<max;y++){ for(int x = 0;x<max;point(x,y)){ x=x+z; } if(y%5 == 0)z++; } all had move if statement out of second loop.

node.js - How can I get data from table using parent() -

i try data table, there link "kaydet" when click it, must data table belong row, share table, below: https://hizliresim.com/pb3dmv sozlesme.js template.sozlesmelistele.events({ 'click .kaydet': function (event, template) { event.preventdefault(); var sozlesmebilgilerial = $(event.currenttarget).parent().parent().find(".secilenarac"); savesozlesmebilgisi = sozlesmebilgilerial.val(); alert(savesozlesmebilgisi); } }); sozlesmeal.html <tbody> {{#each sozlesmelist}} <tr> <td>{{kullaniciadi}}</td> <td>{{rezervasyonnumarasi}}</td> <td>{{kiradakalicakgun}}</td> <td>{{telefon}}</td> <td>{{alistarihi}}</td> <td>{{iadetarihi}}</td> <td class="secilenarac">{{secilenarac}}</td> <td>{{aracteslimadresi}}</td> <td>

Reserved IP for Azure Cloud Service doesn't persist -

i'm struggling grips reserved ip addresses in azure cloud service. i have cloud service staging , productions deployments , need @ least production deployment have stable ip address. set 2 reserved ip addresses described here assigned reserved ips production , staging deployments power shell: set-azurereservedipassociation -reservedipname myreservedip1 -servicename mycloudservice -slot “production” set-azurereservedipassociation -reservedipname myreservedip2 -servicename mycloudservice -slot “staging” all , reserved ips assigned respective instances , swapping maintains correct addresses. problem if delete 1 of deployments , redeploy ip address not maintained. i tried assigning reserved ip address cloud service without specifying "slot" , assigned fine not seem used in either production or staging deployments. set-azurereservedipassociation -reservedipname myreservedip -servicename mycloudservice my usual workflow deploy staging swap production once have

android - Is it possible to insert/paste image on a custom EditText? -

i wanted create custom text view. little bit advance text editor found here in stackoverflow, can insert text , images. wanted name wordview , create library can reuse across multiple projects. unfortunately not sure if base class allows this. need way insert/paste images directly in edittext. planning write custom view, although seems laborious, not quite if possible @ , if going right track. have tried similar before? according android documentation textview can have drawable object inside textview in following ways drawablebottom drawableend drawableleft drawableright drawablestart drawabletop there other methods can use, check out: 1. programmatically set left drawable in textview 2. how programmatically set drawableleft on android button? 3. http://androidsbs.blogspot.co.za/2013/12/androiddrawableleft-set-drawable-to.html

java - Adding increments to an array? -

so i'm trying use array program , have add 1 every time value within set range. /** imports **/ import java.util.scanner; import java.util.random; /** main code **/ public class droprate2 { public static void main(string[] args) { double min, max; min = 0; max = 1; scanner scan = new scanner(system.in); system.out.println("enter case type:"); string userinput = scan.nextline(); random rand = new random(); int drops[] = {1, 2, 3, 4, 5}; /** shadow **/ if (userinput.equalsignorecase("shadow")) { system.out.println("you chose " + userinput + " case.\n"); system.out.println("how many cases wish open?"); int loops = scan.nextint(); system.out.println("opening " + loops + " cases!"); (int = 0; < loops; i++) { double chance = min + (max - min) * rand.nextdouble(); if (chance >= .769)

magento 1.9 - How to get Order Incremented id in Mage::registry in All Totals page -

i want incremented id or order id mage::registry doing not work. class my_module_block_order_totals extends mage_sales_block_order_totals { protected function _inittotals() { parent::_inittotals(); $order = new mage_sales_model_order(); $order1 = $this->getorder(); $order_id = mage::registry('order_id'); } } my observer.php public function myfunction(varien_event_observer $observer) { $mydata=$observer->getevent()->getorder(); mage::register('order_id' , $mydata->getincrementid()); //mage::log(mage::registry('order_id')); } if on success page can id - $orderid = $this->getorderid(); on other pages can follows above code would't work on other pages. $orderid = mage::getsingleton('checkout/session')->getlastrealorderid();

json - Best way to use spring for Web and mobile application -

i new web development. planning create web service going act end both web site , mobile application. want know if possible use same method return data in different type. for example: if use http://somewebsite/getdetails.jsp should give me , modelview return type , http://somewebsite/getdetails.json should give model in json format. i don't want create 2 different controller handle this. if there other better way please share comments. i open alternative solutions spring 4.0 / spring boot enables achieve quite easily. developing web-service (api) mobile , backend browser based clients , split api mobile under url @requestmapping("/api"). in addition, spring allows implement restful url based application. recommend have 2 different controllers api , web mvc because ensures complete separation between 2 different logics. e.g. would implement following? @suppresswarnings("unchecked") public map<object, object> test(@requestparam(

c# - Insert an selected image from gridview to mysql -

i know how upload , insert images using fileupload toolbox control. time have insert selected gridview item(an image) mysql using asp.net. first select image gridview insert image 'image' table. problem mysql workbench can't open inserted image. predict inserted data not blob data. , think i'm missing basic concepts of image insert. codes given below. image data type blob. how can fix it? examples appriciated. thanks. protected void imageinsert() { { mysqlconnection con = new mysqlconnection(constr); mysqlcommand cmd = new mysqlcommand("insert images(image) values ('"+checkbox().tostring()+"')", con); con.open(); int s1 = cmd.executenonquery(); if (s1 > 0) { imgup1.text = "image uploaded succesfully!"; } con.close(); } } private string checkbox() { string url=null; foreach (gridviewrow row in gvimages.rows) { checkbox chkbox = row.findcontrol("chkrow") checkbox; if (chkbox !=null && chkbox.checked)

sql server - Delete rows from Table 1 based on the rows in Table 2 -

table 1 color ------ red red blue table 2 color ------ red blue result red (since red in table 1 2x , 1x in table 2) can please me design tsql delete rows in table 1 based on rows in table 2. in other words, iterate table 2 1 time , each color, delete 1 color table 1 (not colors equal current color of table 2) just number each color , delete number greater 1: ;with cte as(select t1.*, row_number() over(partition t1.color order by(select null)) rn table1 t1 join table2 t2 on t1.color = t2.color) delete cte rn > 1 or change to: delete cte rn = 1 if want delete 1 row each color.

php - javascript function inside loop not working -

i displaying online users. when click 1 of user, corresponding user should displayed in text box below. using javascript this, taking first user. when click second user, first user displayed in below text box. why taking first array? <?php foreach($query $row) { ?> <input type="text" name="user" id="user" value="<?php echo $row->users;?> onclick="select_online()"> <?php } ?> <script> function select_online() { var user=document.getelementbyid("user").value; document.getelementbyid("usersonline").value=user; } </script> name:<input type="text" name="usersonline" id="usersonline"> first of all, using same id many elements mistake. should make diverse id attribute generated inputs. second, should use this value of current element: function select_online() { var

java - Gradle build slow after adding symja and log4j-1.2.11 to android stuido -

i have tried this: build, execution, deployment > build tool > gradle and check offline work checkbox in global gradle settings. however not seem make difference. edit- have added --stacktrace compiler option ` apply plugin: 'com.android.application' android { compilesdkversion 21 buildtoolsversion "23.0.1" defaultconfig { applicationid "com.hr.hrproductions.mathapptake5" minsdkversion 21 targetsdkversion 21 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } }

python - Combine functions to later use in map -

i have list of items, coming 1 object of type a, , library operates on object of type b. i convert b, , later call b's function in pythonic way. have come far: def convert_a_to_b(a): return b(a.something, a.something_else) def dostuff(a_list): converted_to_b = list(map(convert_a_to_b, a_list) return list(map(b.function, converted_to_b)) i create lambda combine these functions, feel there should easier way. like: return list(map(combine(convert_a_to_b, b.function))) from functools import partial, reduce combine = lambda *xs: partial (reduce, lambda v,x: x(v), xs) the function usable such combine (a.foo, a.bar) (x) equivalent a.bar(a.foo (x)) . combine accept variadic number of functions, , return new function accepts single value. value passed through every mentioned function (in chain) until final result yield. sample usage map (combine (convert_a_to_b, b.function), a_list)

python - Positional and optional parameters in functions -

this question has answer here: python, default keyword arguments after variable length positional arguments 2 answers python syntax error *args optional arg 3 answers i trying pass both positional , optional parameters function. the below code works in python 3: def something(*args, cookie=none): arg in args: print(arg) print('cookie ' + cookie) something('a', 'b', 'c', cookie='oreo') but gives syntaxerror: invalid syntax when using python 2. is possible in python 2? if modify function slightly, can make work. looks python2 doesn't support exact syntax hoping for. syntax used works in python3 though. def something(*args, **kwargs): arg in args: print(arg) print(&#

repository - How to include libraries hosted on Github in a C++ project? (New C++ user - previously used language with package manager) -

i want include uwebsockets in c++ project , unclear on how this. i've compiled projects .so dependencies, when comes projects listed on github still confused. specifically: does third-party repository need compiled prior including in project? where store library in source code directory? how link source code third-party libraries? are tools such cmake needed? apologies in advance if these questions seem obvious or silly, come language package manager rather new me. update following "getting started" instruction in github repository, upon cloning repository, making sure dependencies installed , running make , following output observed: dave@desktop:~/gitrepositories/uwebsockets$ make make `(uname -s)` make[1]: entering directory '/home/dave/gitrepositories/uwebsockets' g++ -std=c++11 -o3 -i src -shared -fpic src/extensions.cpp src/group.cpp src/networking.cpp src/hub.cpp src/node.cpp src/websocket.cpp src/httpsocket.cpp src/socket.cpp src/e

Broadcast Exception with laravel pusher -

i'm using pusher laravel 5.4 . installed pusher using : composer require pusher/pusher-php-server "~2.6" after make necessary changes in .env , config/app.php , config/broadcasting.php . create taskevent : <?php namespace app\events; use illuminate\broadcasting\channel; use illuminate\queue\serializesmodels; use illuminate\broadcasting\privatechannel; use illuminate\broadcasting\presencechannel; use illuminate\foundation\events\dispatchable; use illuminate\broadcasting\interactswithsockets; use illuminate\contracts\broadcasting\shouldbroadcast; class taskevent implements shouldbroadcast { use dispatchable, interactswithsockets, serializesmodels; /** * create new event instance. * * @return void */ public $message; public function __construct($message) { $this->message=$message; } /** * channels event should broadcast on. * * @return channel|array */ public function b

node.js - How to insert data from HTML page as sub documents in mongoDB in Mean-stack application -

i trying insert data sub document in meanstack application. below schema: var employee = mongoose.model('employee', mongoose.schema({ weekstart : { type:date, default: date.now}, weekend : { type:date, default: date.now}, // user : [{ type: schema.types.objectid, ref: 'employee' }], timesheet:[{ project:{ type:string}, activity:{ type:string}, day:{type: string}, hours:{type: number} }] })); in above, want insert data html page activity, project, day , hours. the api return purpose is: app.post('/api/employees', function(req, res){ employee.create( req.body, function(err, employees,time){ if(err) return res.send(err); res.json(employees); console.log(employees); console.log(time); }); }); the service is: $scope.addtimesheet = function(data){ $scope.time = []; //var id = $routeparams.id; $http.post('/api/employees/', $scope.

Python, problems with global variable -

i declare global variable pos , anyway method printarr() doesn't see it. interpreter says: undifined variable pos . why? thanks import nltk class analyzer(): """implements sentiment analysis.""" def __init__(self, positives, negatives): global pos global neg positives=[] negatives=[] i=0 file = open("negative-words.txt","r") line in file: h=file.readline() if h!="": if h[0]!=';': negatives.append(h) i=i+1 print(h) i=0 file = open("positive-words.txt","r") line in file: h=file.readline() if h!="": if h[0]!=';': positives.append(h) i=i+1 print(h) neg=negatives pos=p

node.js - How to validate muliple js file using JSHINT -

i can validate current file in jshint below code jshint filename.js but want validate entire folder. *for example have in js folder* abc.js cde.js efg.js per cheatsheet-like post , do. jshint .

session listener in spring boot configuration does not fire automatically -

i migrated existing spring application spring boot. problem had sessionlistener in web.xml expire user when session has been timeout , migrating boot had configure boot documentations ok before spring boot. after , listener doesn't fire session timeout automatically firing listener must send request same ip fire listener. and here configuration's files : application.properties: server.session.timeout=1800 @configuration public class webapplicationconfiguration extends webmvcconfigureradapter { @bean public httpsessionlistener httpsessionlistener() { return new sessionlistener(); } //some other configs }

I am having trouble extracting a value from Javascript with PHP -

i received below code amongst whole lot of html fetch in php, code in script tags. having trouble using preg_match efficiently extract value of hardest27 on line. so have variable called $html contains whole lot of html contains line below. $("<input>").attr({name: "levelreached", value: "hardest27" }).appendto(newform); how can php return me value of levelreached ? you may try regex on content: "levelreached"\s*,\s*value:\s*"([^"]*)" group 1 contains expected value. regex demo sample demo source : preg_match_all($re, $html, $matches); foreach($matches[1] $matchgroup) echo $matchgroup."\n";

bootstrap select-box.css and select box.js are loading very slowly -

this link of website http://livebharath.com/lbwap.com/ i have 2 select boxes load slow after entire page loads. i had downloaded select-min.js , select-min.css files bootstrap select , included them in html <link rel="stylesheet" href="css/bootstrap-select.min.css"> <script src="js/bootstrap-select.min.js"></script> why taking long time load how resolve issue help..

python 2.7 - Pandas Dataframe: Add mean and std columns to every column -

i add mean , std column every column of dataframe. unfortunately code replaces original columns mean , std ones. np.random.seed(50) df = pd.dataframe(np.random.randint(0,9,size=(30, 3)), columns=list('abc')) print df df b c 0 0 0 1 1 4 6 5 2 6 6 5 3 2 7 4 4 3 6 4 5 1 5 0 6 6 3 2 7 3 3 3 8 2 0 3 9 2 0 3 10 0 0 7 11 3 8 7 12 4 4 0 13 0 3 3 14 1 4 5 15 7 0 3 16 5 6 1 17 4 4 4 18 5 4 6 19 3 0 5 20 8 3 6 21 2 8 8 22 5 4 7 23 8 4 4 24 2 1 8 25 7 1 5 26 8 3 3 27 5 3 6 28 8 6 0 29 8 2 1 here's code from: https://pandas.pydata.org/pandas-docs/stable/computation.html r = df.rolling(window=5) print 'agg mean , sdt df' print r['a', 'b', 'c'].agg([np.mean, np.std]) print output agg mean , sdt df b c mean std mean std mean std 0 nan nan nan nan na