Posts

Showing posts from April, 2012

java - table not found with apache calcite -

i trying basic things calcite understand framework. have setup simple example supposed read 2 json files. model looks { version: '1.0', defaultschema: 'people', schemas: [ { name: 'people', type: 'custom', factory: 'demo.jsonschemafactory', operand: { directory: '/..../calcite-json/src/test/resources/files' } } ] } in test, seems model being loaded fine because when pull database metadata information, can see file being loaded table under people schema. right after statement trying select * table , error table not found. > -- null people table --> jun 29, 2015 8:53:30 org.apache.calcite.sql.validate.sqlvalidatorexception <init> severe: org.apache.calcite.sql.validate.sqlvalidatorexception: table 'a' not found jun 29, 2015 8:53:30 org.apache.calcite.runtime.calciteexception <init> severe: org.apache.calcite.runtime.calcitecontextexception: @ line 1,

ios - UITableViewCell height incorrect, sizeToFit sizes incorrectly -

i attempting create custom uitableviewcell, , having issues cell frame having proper height. troubling because cell sizes correctly iphones 4s/5s running ios 8.4, not iphones 6/6+ running same os. chaos ensues around calling sizetofit on messagelabel . of labels appear have extra, blank lines below, not tall cell makes them out be. below custom cell. label appears cause trouble messagelabel. view frames of labels, let borders = true // // notestableviewcell.swift // urchin // // created ethan on 6/17/15. // copyright (c) 2015 tidepool. rights reserved. // import foundation import uikit let notecellheight: cgfloat = 128 let notecellinset: cgfloat = 16 let labelspacing: cgfloat = 6 class notecell: uitableviewcell { let borders = false var cellheight: cgfloat = cgfloat() let usernamelabel: uilabel = uilabel() let timedatelabel: uilabel = uilabel() var messagelabel: uilabel = uilabel() func configurewithnote(note: note) { usernamelabel

Sparkle appcast not working -

i'm having problem getting sparkle read appcast in website's root: <?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" xmlns:dc="http://purl.org/dc/elements/1.1/"> <channel> <title>myapp</title> <link>http://www.mywebsite.net/appcast.xml</link> <description> generate docs. </description> <language>en</language> <item> <title>version 6.2 (1 new feature)</title> <sparkle:releasenoteslink>http://mywebsite.net/myapp.shtml</sparkle:releasenoteslink> <pubdate>sun, 28 jun 2015 19:20:11 +0000</pubdate> <enclosure url="http://ywebsite.net/downloads/myapp.zip" sparkle:version=“6.2” length=“1500000” type="application/octet-stream" /> <sparkle:minimumsystemversion>10.10</sparkle:minimumsystemversion> </item>

java - How can I make my website communicate with my servlet? -

Image
i've created web app gets jqtree "coordinates" , send these coordinates var positions server gotten servlet create file containing "coordinates", however, i don't know how going make communication . me? thanks in advance. i made kind of chart right below explaining idea. 1 - user changes tree 2 - positions gotten code $(document).ready(function() { var positions; //var data dynamic json file should created in backend. var data = [{ label: 'node1', id: 1, children: [{ label: 'child1', id: 2 }, { label: 'child2', id: 3 }] }, { label: 'node2', id: 4, children: [{ label: 'child3', id: 5 }] }]; $('#tree1').tree({ data: data, autoopen: true, draganddrop: true }); console.log($('#tree1').tree('tojson')); //this give loading jqtree structure. $('#tree1').bind( 'tree.move&#

Cross validation for custom kernel SVM in scikit-learn -

i grid-search through cross-validation custom kernel svm using scikit-learn. more precisely following this example want define kernel function like def my_kernel(x, y): """ create custom kernel: k(x, y) = x * m *y.t """ return np.dot(np.dot(x, m), y.t) where m parameter of kernel (like gamma in gaussian kernel). i want feed parameter m through gridsearchcv , parameters = {'kernel':('my_kernel'), 'c':[1, 10], 'm':[m1,m2]} svr = svm.svc() clf = grid_search.gridsearchcv(svr, parameters) so question : how define my_kernel m variable given gridsearchcv ? you may have make wrapper class. like: class mysvc(baseestimator,classifiermixin): def __init__( self, # svc attributes m ): self.m = m # etc... def fit( self, x, y ): kernel = lambda x,y : np.dot(np.dot(x,m),y.t) self.svc_ = svc( kernel=kernel, # other parameters )

testing - Assert file had been created in Junit (Java 6) -

i'd write integration java program takes input file source directory, copies staging , writes result of processing output directory , removes temporary files staging . it's easy enough check output ok, there easy way check staging area being used correctly? 2 things come mind: monitoring folder file system events (any nice wrappers that?), or advanced permissions game (to allow create not delete). suggestions? thanks lot! n.b. java 6 on windows... assuming you're dead set on doing this, think easiest approach going checking file in staging folder after supposed have been copied , checking it's not there after it's supposed have been deleted. file f = new file(filepathstring); if(f.exists() && !f.isdirectory()) { /* */} how check if file exists in java?

php - Creating a multidimensional array using an array and loop through mysql table -

i have table following structure. there 9 students enrolled in 3 classes (classes 01, 16 , 52), 3 enrollments in each class. studentcode | classcode ------------------------- d3kcivyp | 01 ddihbc | 01 2vx0kv | 01 9p1pxwcv | 52 rnmfh1we | 52 mstbev | 52 yp4j3o | 16 fwq5oo | 16 6sxw3u | 16 this array current classes: $classes_array = array ( [0] => 01 [1] => 52 [2] => 16 ) using array go through mysql table , create multidimensional array classcodes used first level keys: array ( [01] => array ( [0] => d3kcivyp [1] => ddihbc [2] => 2vx0kv ) [52] => array ( [0] => 9p1pxwcv [1] => rnmfh1we [2] => mstbev ) [16] => array ( [0] => yp4j3o [1] => fwq5oo [2] => 6sxw3u ) ) foreach ($classes_array $key => $

Insert tag html into MYSQL using PHP (Codeigniter) -

i want insert tag html (embed youtube mysql) using codeigniter like <iframe width="560" height="315" src="https://www.youtube.com/embed/7je-ocfmu2y" frameborder="0" allowfullscreen></iframe> but in value in table like &lt;iframe width="560" height="315" src="https://www.youtube.com/embed/7je-ocfmu2y" frameborder="0" allowfullscreen>&lt;/iframe> what sholud solve it? this controller, it's still not work properly $emb=str_replace('&lt;', '<', $this->input->post('embed')); data = array( 'content' => $this->input->post('judul'), 'embed' => $emb, 'category' => 'video', ); $this->m_admin_tb_website->update_data('video', $data); did try using htmlspecialchars_decode function? try code: $emb = htmlspecialchars_decode($this-

vba - Get first cell value after finding column header -

i want find first cell value after finding header. currently have this:. dim ulimitrange range dim llimitrange range ulimitrange = worksheets("sheet1").cells.find("upper limit", , xlvalues, xlwhole) llimitrange = worksheets("sheet1").cells.find("lower limit", , xlvalues, xlwhole) ulimit = range("ulimitrange" & 1) llimit = range("llimitrange" & 1) however, returning "run-time error '91': object variable or block variable not set first line of code. any like this: dim ulimitrange range dim llimitrange range set ulimitrange = worksheets("sheet1").cells.find("upper limit", , xlvalues, xlwhole) set llimitrange = worksheets("sheet1").cells.find("lower limit", , xlvalues, xlwhole) set ulimit = ulimitrange.offset(1) set llimit = llimitrange.offset(1) comments : when setting range variables precede operation set statement if want move given ran

command line - GO: {GOOS} and {GOARCH} not recognised in environment -

i want change diretory go/pkg/darwin_amd64 $ cd $gopath/pkg/${goos}_${goarch} doesn't find folder though directory exists. $ echo $gopath/pkg/${goos}_${goarch} gives /go/pkg/_ instead of /go/pkg/darwin_amd64 . $ go env prints: goarch="amd64" gobin="" gochar="6" goexe="" gohostarch="amd64" gohostos="darwin" goos="darwin" gopath="/users/sahilkapoor/go" gorace="" goroot="/usr/local/go" gotooldir="/usr/local/go/pkg/tool/darwin_amd64" cc="clang" gogccflags="-fpic -m64 -pthread -fno-caret-diagnostics -qunused-arguments -fmessage-length=0 -fno-common" cxx="clang++" cgo_enabled="1" we can see goos , goarch defined here. using terminal on mac osx 10.10.3. missing? $goos , $goarch defined in shell if have exported them (which, unless doing cross compilation, unlikely). when run go env , default values shown when

multithreading - stackless python and multiprocessing slowdown -

i have program runs multiple tasklets using stackless python, , problem though fast, notice slowdown if start 1 or more processes run same code. for example, using threads inside processes takes program 6 seconds complete, , if start 2 processes still takes 6 seconds complete. if use tasklets program takes 2 seconds complete, takes 4 seconds if run 2 processes simultaneously , 6 seconds if run 3 processes , etc. my question is, normal behavior of stackless python? checked make sure tasklets in separate processes using separate schedulers , each process can see tasklets, maybe tasklets in processes still fighting on system resources? it's explanation can think of why each additional process cause slowdown when using tasklets not threads. need explain me can figure out if there's wrong code or if unavoidable issue.

Git 'Refusing to fetch' error -

i'm not sure has happened, command used work now. have branch named refactorizacion checked out. if run command git fetch , seems work fine (no error shown), if run git fetch origin refactorizacion:refactorizacion , gives me following error: fatal: refusing fetch current branch refs/heads/refactorizacion of non-bare repository unexpected end of command stream this causing team > synchronize workspace command of egit in eclipse show error: fetch operation failed synchronization continued based on data in repository. can disable fetching changes before synchronization in preferences: team > git > launch fetch before synchronization

javascript - Is it good practice to manipulate a function parameter from within a function? -

is acceptable (or frowned upon) in javascript practice modify function parameter of type reference value (object) inside function? i’m aware of how works in function parameters passed value , reference value parameter pointer object’s memory location. thank you! edit: i've removed "pass reference" title , description make wording more correct , avoid confusion readers. correct answer (and helpful comments) still apply you seem know isn't passed reference, can't imagine "treating it" like. remember, because there no pass-by-reference in javascript, means can't reach out function , change variable value passed in (not object refers to). it's neither or bad practice; it's impossible. function foo(a) { = {"different stuff": "here"}; } var b = {stuff: "here"}; foo(b); // `foo`'s assignment `a` has nothing whatsoever // `b` , has no effect on console.lo

swift - Run Two Action At The Same Time Inside ONE Sequence -

i'm not sure if i'm seeking possible, i'm checking make sure i'm not doing thing hard way. at moment have 2 sequences, both run @ same time. each sequence starts off waiting 3 seconds , 1 sequence scales node, other adjusts node's alpha. code looks this: node.runaction(skaction.sequence([animationwait, animationscale])) node.runaction(skaction.sequence([animationwait, animationalpha])) but there way of running both animationscale , animationalpha @ same time inside 1 sequence? (this doesn't work, i'm hoping can see i'm trying do): node.runaction(skaction.sequence([animationwait, (animationscale, animationalpha)])) you can group actions sequence: var actions = array<skaction>(); actions.append(skaction.sequence([animationwait, animationscale])); actions.append(skaction.sequence([animationwait, animationalpha])); let group = skaction.group(actions); node.runaction(group); when action executes, actions comprise group sta

php - Extra column in HTML table -

may know how come there 1 column @ table between payment id , update payment column not debug? code below. note: not post picture not have enough reputation. <td width="52">bookng id</td> <td width="78">deposit</td> <td width="149">total_amt_paid</td> <td width="149">balance</td> <td width="149">payment status</td> <td width="57">card type</td> <td width="62">total price</td> <td width="94">payment id</td> <td width="62"></td> <td width="293">update payment</td> </tr> <?php { ?> <tr> <th height="45"><?php echo $row_recordsetupdatepayment['booking_id']; ?></th> <th><?php echo $row_recordsetupdatepayment['deposit']; ?></th>

javamail - polling mailbox after every 10 minutes through java -

i have below program act mail box listener is configured pop3 protocol , when program executed connected mail box , download mails , attachments in specified folder , query how can modify below program in such way should keep polling mail box listner lets in every 10 minutes , download mails , polling should happen in every 10 minutes please advise how can modify below program achieve this.. import java.io.*; import java.util.*; import javax.mail.*; import javax.mail.internet.mimebodypart; public class receivemailpop3 { private static final string host = "pop.gmail.com"; private static final string username = "myemail@gmail.com"; private static final string password = "******"; public static void doit() throws messagingexception, ioexception { folder folder = null; store store = null; try { properties props = new properties(); props.put("mail.store.protocol", "pop3s"); // google uses pop3s not po

html - Is it possible to have a php script read from column A and write the string in column B,C,E,etc in the same table -

i'm trying plan ahead since i'm super new php. i plan on doing script takes votes multiple people, stores in database, php script calculates average, , writes in table. item specific meaning each (a) column row different 1 below. this plan: // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "select db (a); the last part stuck. want have menu ( scroball type of thing ) user can select name column a. know how make table/echo out of input. i've found this: <form action ="register.php" name="myform" method = "post"> <select name="gender" id="gender"> <option value="">select one</option> <option value = "m">male</option> <o

ruby on rails - Devise: User exists when using apartment gem -

i have setup apartment gem, , have user table in each tenant, if tries create user same email in 2 different tenants, "user exists" when tries create user in second tenant. no user data saved public scheme. what have overlooked?

php - Laravel 5 TokenMismatchException on Multiple file uploads -

in laravel 5 application, there provision made admin upload product image , product's pdf file. so, form has 2 input fields this: <div class="col-md-4 col-sm-6"> <div class="form-group"> {!! form::label('image', 'image file:') !!} {!! form::file('image', ['class' => 'form-control input-sm'] ) !!} </div> </div> <div class="col-md-4 col-sm-6"> <div class="form-group"> {!! form::label('leaflet', 'leaflet:') !!} {!! form::file('leaflet', ['class' => 'form-control input-sm'] ) !!} </div> </div> when upload image , leaflet both less 2mb, gets uploaded successfully. when using, leaflet more 2mb, tokenmismatchexception @ line 46 in php.ini file located @ /etc/php5/apache2/php.ini have configuration so: ; maximum allowed size uploaded files. ; http://php.net

github - Beginner Git merge confuse about two branches -

i new git, , i'm confused. here's example: i build repo called prj in office. i add image , commit github later, when home, clone repo, check out new branch (let's call home ) , replace image 1 same name. then, after go office, delete old image, , update remote branch. seems work @ stage. i use git diff master origin/home , shows new node added image. however, when run git merge origin/home , image added @ home can not added local master. where did wrong? how can svn update? on office computer - don't delete image. reset local changes image file, pull. should see it's content update. if still don't see update, delete old image, commit deletion, try adding new image again. git weird replacing files have same name.

ruby on rails - RoR help protecting my CRUD links in the views -

i have 4 models: class country < activerecord::base has_many :postcards end class postcard < activerecord::base belongs_to :country has_many :photos has_many :tips end class photos < activerecord::base belongs_to :postcard end class tips < activerecord::base belongs_to :postcard end the routes nested this: rails.application.routes.draw resources :countrys resources :postcards resources :photos, :tips end end end i followed crud architecture , working fine, controllers working. used private / country_params create , update controllers method. but.... now realise if deploy app, can click links in views create/edit/destroy database. what "good practice" solution limit access? building user model me , take admin-right ? creating new set of view without crud access ?(is possible?) using admin gem (railsadmin or activeadmin) ? to limit content on application accessed you, must implement simple authentic

php - Select a value from one of the tables if a value equels a value from the other table -

there 2 mysql tables games_server , orders_order . need select value called full_address first table if value id table equals value server_id of second table orders_order . but not value. has where service_type = 'be_first' , status = 'running' i've read possible solutions here , tried that: select server_address games_server id in select server_id orders_order service_type = 'be_first' , status = 'running' order updated desc but didn't work. i'm not mysql. please out. select a.thing want select table want select join other table b on b.some column = a.some column criterion met , criterion met

html - Multiple Modal Dialog Cause Browser unable to load -

i facing issue on how allow multiple modal dialog run on web. when include 2 modal dialog in html code, web page unable load. basically html code <div class="form-group"> <label>new user? <a id="btn_signup_now" runat="server" data-toggle="modal" href="#mysignup" data-backdrop="true"> sign free </a> </label> </div> <div id="mysignup" class="modal hide fade" role="dialog" tabindex="-1"> <div class="modal-header"> <asp:button runat="server" class="close" data-dismiss="modal" aria-hidden="true" text="*"/> <h4 class="modal-title" id="mymodalsignup">candidate sign up</h4> </div&g

c# - TrelloNet objects always returning null -

itrello trello = new trello(appkey); trello.authorize(token); member me = trello.members.me(); for example, in case return user return null, want know how fix it. thaks. are sure passing correct appkey string trello constructor? per documentation, have so. itrello trello = new trello("[your application key]"); where [your application key] key string https://trello.com/1/appkey/generate (need logged in trello before access url. the token in 2nd line string, not class. trello.authorize("[the token user got]"); source: trello.net wiki

android - update view at 5hz: surfaceview or view? -

a ble peripherall send me data @ 5hz, receive in service send data through "local broadcast msg" ux @ same rateo after interpolation. on ux have draw custom indicator rateo. i think use surfaceview i'm wondering if normal view extension enough. can give me suggestion ? there's no fixed rate limit custom views. if planning render canvas, custom view more efficient surfaceview, because can take advantage of hardware acceleration . canvas rendering onto surfaceview surface done in software (as of 5.0 @ least). the advantage of surface that, because it's on separate layer, you're not tied view ui's invalidate/redraw cycle. at 5 updates per second think have pretty free hand in choosing solution.

how to add test dependency with android gradle plugin experimental 0.1.0 -

Image
i followed this guide build ndk hybrid project on android studio 1.3.0 rc1 gradle-experimental:0.1.0 . everything ok, if try add test library dependency, found method androidtestcompile not supported more. this: and testcompile cause same error. the offical guide doesn't talk this. so, how can add add test dependency gradle-experimental or version not supports function? this build.gradle(project): // top-level build file can add configuration options common sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle-experimental:0.1.0' } } allprojects { repositories { jcenter() } } this build.gradle(moudle): apply plugin: 'com.android.model.application' model { android { compilesdkversion = 22 buildtoolsversion = "23.0.0 rc3" defaultconfig.with { applicationid = "co.yishun.onemo

ios - Create a Paging UICollectionView with Swift -

i'm trying create uicollectionview paging , each item max width 250 points, i've managed create it, have 2 problems: first item start not should be, more space @ start , when try swipe, there wont let me swipe smooth. this how looks: video link this code: centercellcollectionflowlayout.swift class centercellcollectionviewflowlayout: uicollectionviewflowlayout { override func layoutattributesforelementsinrect(rect: cgrect) -> [anyobject]? { var attributestoreturn:[uicollectionviewlayoutattributes] = super.layoutattributesforelementsinrect(rect) as! [uicollectionviewlayoutattributes] var = 0 ; < attributestoreturn.count ; i++ { var currentlayoutattributes: uicollectionviewlayoutattributes = attributestoreturn[i] var maximumspacing: cgfloat = 50 let origin: cgfloat if - 1 >= 0 { let previouslayoutattributes = attributestoreturn[i - 1] origin = previ

angularjs - ng-repeat elements are removed from the DOM after a moment rather than immediately -

i have instagram feed page shows liked media specific user, results limited 6: <li ng-repeat="p in pics | limitto: 6"> <a href="{{p.link}}" target="_blank"> <img ng-src="{{p.images.standard_resolution.url}}" /> </a> </li> <button ng-click="shuffle()">shuffle</button> i added shuffle button when click picks 6 pictures @ random total amount of pictures in json. when click shows them second. there way stop happening? js app.controller('showimages', function($scope, instagramapi){ $scope.layout = 'grid'; $scope.data = {}; $scope.pics = []; $scope.shuffle = function() { $scope.pics.sort(function() { return 0.5 - math.random() }); }; instagramapi.fetchphotos(function(data){ $scope.pics = data; console.log("length "+data.length) }); }); you can see here: http://alexanderlloyd.info/angular-instafe

android - NullPointerException in userdefined method "insert" in datahelper class -

this question has answer here: what nullpointerexception, , how fix it? 12 answers this logcat 07-11 04:34:41.360: e/androidruntime(10132): fatal exception: main 07-11 04:34:41.360: e/androidruntime(10132): process:app.example.movierating, pid: 10132 07-11 04:34:41.360: e/androidruntime(10132): java.lang.nullpointerexception 07-11 04:34:41.360: e/androidruntime(10132): @ model.datahelper.insert(datahelper.java:75) 07-11 04:34:41.360: e/androidruntime(10132): @ app.example.movierating.mainactivity1$1.onclick(mainactivity1.java:85) 07-11 04:34:41.360: e/androidruntime(10132): @ android.view.view.performclick(view.java:4424) 07-11 04:34:41.360: e/androidruntime(10132): @ android.view.view$performclick.run(view.java:18383) 07-11 04:34:41.360: e/androidruntime(10132): @ android.os.handler.handlecallback(handler.java:733) 07-11 04:34:41.360: e/androidruntime(

algorithm - Finding all points in certain radius of another point -

Image
i making simple game , stumbled upon problem. assume several points in 2d space. want make points close each other interact in way. let me throw picture here better understanding of problem: now, problem isn't computing distance . know how that. at first had around 10 points , check every combination, can assume, extremely inefficient increasing number of points. if had million of points in total, of them distant each other? i'm trying find suitable data structure or way @ problem, every point can mind surrounding , not whole space. there known algorithms this? don't know how name problem can google want. if don't know of such known algorighm, ideas welcome. you're still going have iterate through every point, there 2 optimizations can perform: 1) can eliminate obvious points checking if x1 < radius , if y1 < radius (like brent mentioned in answer). 2) instead of calculating distance, can calculate square of distance , compare square

magnetometer - MPU-9250 how to configure pass through I2C -

i have mpu-9250 connected via i2c intel edison arduino board (pins a4/a5). i can read , works reading acc , gyro mpu9250_address = 0x68 now disable i2c master module i2c.writereg(user_ctrl, 0b00000000) # i2c_mst_en # 1 – enable i2c master i/f module; pins es_da , es_scl isolated pins sda/sdi , scl/ sclk. # 0 – disable i2c master i/f module; pins es_da , es_scl logically driven pins sda/sdi , scl/ sclk. now enable i2c bypass mux i2c.address(mpu9250_address) i2c.writereg(int_pin_cfg, 0b00000010) # bypass_en set high # when asserted, i2c_master interface pins(es_cl , es_da) go ‘bypass mode’ when i2c master interface disabled. the pins float high due internal pull-up if not enabled , i2c master interface disabled. so according the datasheet if disable i2c master module inside chip , activate bypass , should able access directly compass via i2c. not no reason believe still happens " ... float high due internal pull-up ... ", because looked oscillosco

How to limit JProfiler to a subtree -

Image
i have method called com.acmesoftware.shared.abstractderrivedbean.getderiveduniqueid(). when jprofiler application, method, getderiveduniqueid(), buried 80 methods deep expected. method invoked on behalf of every bean in application. i'm trying record cpu calltree starting method down leaf node (ie, 1 of excluded classes). i tried following didn't produce expected outcome: find method above method targeted profiling, eg, markfordeletion(). set trigger start recording @ getderiveduniqueid() set trigger stop recording @ markfordeletion() i expecting see below markfordeletion(), saw not including getderiveduniqueid(), opposite of intended goal. worse yet, 5ms sampling, trigger increased previous running time 10 minutes "i terminated after 3 hours of running". seems trigger adding giant amount of overhead on top of overhead. hence, if figure out how correctly enable trigger, added overhead seem render ineffective. the reason need limit recording method is:

How to download a zip file in asp.net mvc? -

Image
folder structure... /albums/test.zip i have button on web page on button click, test.zip inside albums should downloaded. i not needing build zip, on button click, available zip should downloaded. thats it. using asp.net mvc it's simple this: <a href="~/albums/test.zip"> <img src="~/images/download.png" alt="download zip file." /> </a> the download start when user clicks image.

apache - How to configure PHP on Mac for developing -

i'm doing installation php on mac, following this tutorial . i checked httpd.conf , little different mine following items. load module php5_module addmodule mod_php5.c addtype application/x-httpd-php .php what have load module php4_module , don't have item 2 , item 3, added these httpd.conf file. after restart apache server apachectl restart , says this webpage not available . checked console of chrome , found get http://localhost/info.php net::err_connection_refused . and found that: if didn't add item 2 , item 3 configuration file, php script shows on browser, seems it's not parsed. if add itme 3, when accessed info.php browser, it's downloaded instead of being displayed. anyone knows what's going on here? did miss more configuration? by way, grateful if can provide proper tutorial beginner set envrionment learning php, found many articles online, no 1 can work correctly. have @ akrabats tutorials on how install php on mac

java - Android animation fade in / fade out is not setting the visibility of the view in the callback function -

i have android view want fadein , fadeout when users click on button. animation being called , callback being called when animation triggers view cannot seen. think problem xml layout, have been stuck on hours if can appreciated. my main layout: - view in question <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="left|top" android:background="@color/whiteoverlay" android:gravity="center_vertical|center_horizontal" android:id="@+id/uploadoptions" android:alpha="0" android:visibility="gone"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="cen

android - How to push notifications with Google Cloud Messaging? -

i'm trying implement push notification in android app. understand, need sender , receiver installed on device. i googled on gcm found need create project in google dev console. got project id , api key. i found there third party applications (mixpanel) can send push notifications information above. can use google play send notifications app users? on programming side, got permissions required in manifest.xml file <uses-permission android:name="android.permission.internet" /> <!-- gcm connects internet services. --> <uses-permission android:name="android.permission.internet" /> <!-- gcm requires google account. --> <uses-permission android:name="android.permission.get_accounts" /> <!-- keeps processor sleeping when message received. --> <uses-permission android:name="android.permission.wake_lock" /> <!-- creates custom permission app can receive messages. --> <permission a

C# Use int constants vs Enums without cast -

i have int constants grouped in several enum, like: enum myenum{ object_a = 10, object_b = 13 }; now have several functions take enums , something, like: void myfunc(myenum e) { .... } in code, need use myfunc in both these 2 ways: myfunc(myenum.object_a); myfunc(13); this gives error because ints aren't casted enum implicitly. what recommend best practice preserving readability of code? an obvious solution use myfunc((myenum)13); boring because 1 needs cast int every time , code gets heavy. so far did (avoiding enums @ all): using echannelint = system.int32; public static class echannel { public static readonly int ch_connection = 10; public static readonly int ch_data = 50; } public void doit(echannelint ch) { .... } doit(echannel.ch_data); doit(10); which works, don't because seems "trick" or renaming thigs. suggest? perhaps "implicit operator" may useful? thank you you can overload myfu

php - Insert batch in Laravel 5 -

i using laravel 5. have tried insert following data in laravel using insert. not working anymore. i have $permission array contains following array detials. array ( [0] => array ( [permission_id] => 1 [role_id] => 1 ) [1] => array ( [permission_id] => 2 [role_id] => 1 ) [2] => array ( [permission_id] => 3 [role_id] => 1 ) [3] => array ( [permission_id] => 4 [role_id] => 1 ) ) db::table('permission_role')->insert($permission) array ( array ( [permission_id] => 1, [role_id] => 1, ), array ( [permission_id] => 2, [role_id] => 1, ), array ( [permission_id] => 3, [role_id] => 1, ), array ( [permission_id] => 4, [role_id] => 1, ) )

jquery - Where to put off()? -

i have common.js file use , have ajax function form submits i'm not sure put off() handler. go within submit handler or outside of it? i'm trying avoid duplicate form submits. this have: $(function () { $("body").on("submit", "form[data-ajaxform]", function (e) { e.preventdefault(); /* handle ajax post */ }); }); you can use off() directly after submit below: $(function () { $("body").on("form[data-ajaxform]", "submit", function (e) { /*submit should in second param can submitted*/ e.preventdefault(); /* handle ajax post */ // use off here $(this).off("submit");//after submission of form no more submitted }); });

weather api - NWS - Temperature per hour -

i'm looking national weather service's api , trying temperature per hour location in next 24 hours. i'm using test client generate requests: http://graphical.weather.gov/xml/soap_server/ndfdxml.htm input from: 2015-06-29t15:00:00 to: 2015-06-30t15:00:00 product: time series variables: hourly temperatures, dewpoint temperature, apparent temperature unit: standard <time-layout time-coordinate="local" summarization="none"> <layout-key>k-p3h-n9-1</layout-key> <start-valid-time>2015-06-29t17:00:00-04:00</start-valid-time> <start-valid-time>2015-06-29t20:00:00-04:00</start-valid-time> <start-valid-time>2015-06-29t23:00:00-04:00</start-valid-time> <start-valid-time>2015-06-30t02:00:00-04:00</start-valid-time> <start-valid-time>2015-06-30t05:00:00-04:00</start-valid-time> <start-valid-time>2015-06-30t08:00:00-04:00</start-valid-time> <start-valid-ti

java - Android AES/CBC encryption -

currently i'm using aes/cbc encryption using javax.crypto.cipher library, however, i'm finding little slow. takes anywhere between 45s-1m decrypt 10 minute .mp4 video file. is there better way on android? i'm looking around , found posts openssl faster? any links, helpful posts and/or comments appreciated. use streaming instead of file decryption. if stream video can perform decryption of video need it. if use ctr or cbc mode can skip specific place within stream, although take additional tricks make happen. leaving decryption default provider should first choice, can speed things using native decryption library.