Posts

Showing posts from August, 2012

jquery - click event does not works with copied HTML -

jquery - click event does not works with copied HTML - this question has reply here: event binding on dynamically created elements? 13 answers click event not works copied html? <ul class="dir">//the given ul <li> <img class="thumb" src="1.jpg" > </li> <li> <img class="thumb" src="2.jpg" > </li> <li> <img class="thumb" src="3.jpg" > </li> <li> <img class="thumb" src="4.jpg" > </li> <li> <img class="thumb" src="5.jpg" > </li> <li> <img class="thumb" src="6.jpg" > </li> <li> <img class="thumb" src="7.jpg" > </li> </ul> <ul class="copy"></ul>

xml - XSLT 2.0 - Keep default element, remove duplicate siblings, filter unnecessary entries by attribute -

xml - XSLT 2.0 - Keep default element, remove duplicate siblings, filter unnecessary entries by attribute - using xslt 2.0. i need filter elements have attribute @xml:lang attribute's values not in list of possible values define. ex allowable values: x-default , en , en-us , en-gb when @xml:lang detected on element, , if x-default exists, sibling element of same type @xml:lang value other x-default should compared element's text value of x-default , , if same element text value, removed. way, sibling duplicates of @xml:lang="x-default" should removed, based on element's text value comparison. bonus points if it's possible rank order of duplicates, such x-default chosen (if exists), followed sec tier ( en , fr , ru ), followed 3rd tier ( en-en , en-gb , fr-fr , ru-ru ), sec tier duplicates of first tier removed, , 3rd tier compared sec tier (if exists), or else first tier, 3rd tier removed if duplicate. need handled dynamically, there ma

Rails 4 Update Data Through View Page -

Rails 4 Update Data Through View Page - i have view page named "users". in view page, i'm displaying table attributes pulled users table such first name, lastly name, lastly login, admin, etc... in admin field, displays users table true or false. what accomplish create drop down, displays user's current value admin (true or false), , able alter attribute view page. currently, i'm having utilize console on server manually alter user's value true or false grant or revoke admin privileges. needless say, inconvenient. i'm still new rails , have been using scaffolds point. i'm not sure how accomplish this, , advise appreciated! users schema: create_table "users", force: true |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at&qu

ios - Parser to json JSON array using swift -

ios - Parser to json JSON array using swift - i doing ios (swift) app communicates server. response server json array contains json objects. when show console string response fine: [{"name":"","surname":"","id":5,"username":"dpcabo2"},{"name":"","surname":"","id":10,"username":"default"},{"name":"","surname":"","id":11,"username":"esteban"}] but when seek parser info json using this: var jsonresult: nsdictionary = nsjsonserialization.jsonobjectwithdata(self.my_data!, options:nsjsonreadingoptions.mutablecontainers, error: nil) nsdictionary println("\(jsonresult)") app crashes. so need solution parser correctly information. ps.self.my_data! nsmutabledata. thanks you can utilize below code parsing. prints , parse object p

python - Real-time plot does not show up -

python - Real-time plot does not show up - i plotting sensor info ftdi port using plt.plot() pyplot . unfortunately don't see line reason. when alter mark type: plt.plot(duration, temp, 'o') (or other point-like marktype) goes should. trying increment sleep time (reading problems plot , live-plotting other similar questions) not case.(i using ubuntu 14.04 if case reason) #!/usr/bin/python import time import numpy np import matplotlib.pyplot plt print "we plotting sonar values" f = open('/dev/ttyusb0', 'r') plt.axis() plt.ion() plt.show() duration = 0; while true: print f.readline() temp = f.readline() temp = int(temp[1:]) plt.plot(duration, temp, 'o') duration+=1 plt.draw() time.sleep(0.1) python matplotlib plot real-time

android studio - How can I disable PICK_CONTACT_REQUEST -

android studio - How can I disable PICK_CONTACT_REQUEST - i working on branding pre-packaged application, , has contact selector alternative need disable since serves no purpose us. it's single user search using personal address. have found article on how add together here: http://apiminer.org/doc/guide/components/activities.html they listed code this: private void pickcontact() { // create intent "pick" contact, defined content provider uri intent intent = new intent(intent.action_pick, contacts.content_uri); startactivityforresult(intent, pick_contact_request); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // if request went (ok) , request pick_contact_request if (resultcode == activity.result_ok && requestcode == pick_contact_request) { // perform query contact's content provider contact's name cursor cursor = getcontentresolver().query(data.getdata(),

jquery - How to add php code in JS file -

jquery - How to add php code in JS file - im using yii framework web development , text phone call specific php file in order help me exchange language. how have add together message js file, still need yii php phone call text . how that? bellow if coding i alter "english: 26 character","chinese: 16 character" , "other: 16 character". because in yii calling text other php this: in labels.php this: (eg: 'englishchar'=>'english: 26 character') so phone call text this: eg:<?php echo yii::t('labels','englishchar');?> $(function () { $('#select_gametitle').change(function () { var k = $(this).val(); if (k == "e") { $("#txtgametitle").attr("placeholder", "english: 26 characters").placeholder(); $("#txtgametitle").attr('maxlength', '26'); }

android - Where to put an asset file to be accessible for an application? -

android - Where to put an asset file to be accessible for an application? - got updates recently, i.e. moved eclipse android studio , started using gradle. besides, target api got updated 16 20 , things not working used to. i started refactoring part of application responsible fetching database file. logcat reports no assets in application/app/assets directory, ( assets @ same level src dir), although dbfile.sqlite there. as checked, have next things among assets: assetmanager assetmanager = getassets(); string[] assetfile = assetmanager.list(""); (int = 0; < assetfile.length; i++) { log.d(ptag, "assets found [" + + "]: " + assetfile[i]); } output: d/mainactivity﹕ assets found [0]: images d/mainactivity﹕ assets found [1]: sounds d/mainactivity﹕ assets found [2]: webkit nothing databases. know set database file , how provide application it? in classic android studio project, assets go in assets/ directory in main sour

How to invoke javascript function from href for multiple links within a table -

How to invoke javascript function from href for multiple links within a table - i have table contains column multiple filenames. filenames links of them pointing url , of them pointing local file. can download local file , point url in new window when clicked upon independently. however, when seek dynamically passing in filename via js function within href , encounter uncaught syntaxerror: unexpected token : . not seem problem when phone call js function without parameter, however, links point lastly filename in column. can see @ bottom of browser javascript:openlink(filename) proper filename, error happens. this code: function searchajax(){ var $table = $("#tablegrid").tablesorter(), $tbody = $table.children("tbody"); $.ajax({ datatype: 'json', url: 'table_results', type: 'get', data: $('#filterform').serialize(),

postgresql - I need to count the number of different rows a word appears in -

postgresql - I need to count the number of different rows a word appears in - so far have select word, count(*) (select regexp_split_to_table(coldescription, '\s') word tblcollection ) grouping word order count(*) desc which makes nice list of of words , how many times appear throughout description column. what need way display how many times word in row @ to the lowest degree once. for example, if info was: hello hello test hello test test test test hi it show word count # of rows appears in hello 3 2 test 5 3 hi 1 1 i'm much beginner databases, help appreciated! a sample table: create table tblcollection ( coldescription varchar(500) not null primary key); the sample info is: "hello hello test" "hello test test test" "test hi" each string beingness own row. the main obstacle subquery doesn't preserve info found ea

why do some short form of conditionals work in python and some don't? -

why do some short form of conditionals work in python and some don't? - take example: = "foo" if true else "bar" this executes fine , without problems. take: print("foo") if true else print("bar") this throws error. i assume first 1 works ternary operator. there way write sec statement without resorting total length: if true: print("foo") else: print("bar") something akin perl's print("foo") if true all paths of conditional expression, must evaluatable. in python 2.7, print statement, not function. so, cannot evaluated expression. since print statement violates point 2, cannot used. can do print "foo" if true else "bar" in python 3.x, print function, can write mentioned in question print("foo") if true else print("bar") since print function in python 3.x, result of function phone call result of evaluat

html - positioning in table by adding font for sorting -

html - positioning in table by adding font for sorting - what proper way accomplish right position of font sorting words of column title becomes more two. here sample of table: html: <thead> <tr> <th class="sortable"> <div> <span>name</span> <span class="icons unsorted"></span> </div> </th> <th cliass="sortable"> <dv> <span>testifying experience</span> <span class="icons unsorted"></span> </div> </th> </tr> </thead> css: thead th { font-size: 13px; background: #1797c0; padding: 3px 0; vertical-align: middle; } thead th div { display: inline-block; } before, i'm using span without putting them within div , setting th relative position , span unsorted icon absolute , works 1 word ,

lua - How to use if/then/else correctly here? -

lua - How to use if/then/else correctly here? - how can prepare this,when run,it not solve a,b,c,it outputs enter,for example,i come in 3,b,5,it outputs 3,b,5,not 3,4,5!please note,the trig ratio's not complete,and copied them in. print("welcome right triangle solver") print("what side a?enter if unknown!") a=io.read() print("what side b?enter b if unknown!") b=io.read() print("what side c?enter c if unknown!") c=io.read() print("what angle a?enter if unknown!") a=io.read() print("what angle b?enter b if unknown!") b=io.read() print("what angle c?enter c if unknown!") c=io.read() if == "string" a=math.sqrt(c^(2)-b^(2)) elseif b == "string" b=math.sqrt(c^(2)-a^(2)) elseif c == "string" c=math.sqrt(a^(2)+b^(2)) end print("great!") print("calculating") print("side is=" .. a) print("side b is=" .. b) print("side c is=" ..

Change comment-char in Notepad++ to "|" -

Change comment-char in Notepad++ to "|" - how alter # | comment sign in notepad++? in language syntax comments | ? i don't know language have | comments sign. you have define own language rules. can take comments sign in file langs.model.xml (in notepad++ installation directory), see attribut commentline= each language. comments notepad++

Struggling with python generator function -

Struggling with python generator function - i've checked out several yield examples, cannot figure out how i'm supposed utilize in task. i have create generator function has give 1 word read file when called (and next 1 , on). - pass file path function - read in word char char , assign variable - ........ yield word the thing want know is, how generator function yield 1 word , know next word. i'm not looking ready-made solutions, i'd understand what's going on. your generator function work non-generator function adds words list. except instead of adding them list, yield word. so function adds them list be: def per_word(filename): result = [] open(filename) fh: line in fh: word in line.split(): result.append(word) homecoming result the generator function yields instead: def per_word(filename): open(filename) fh: line in fh: word in line.split():

Is there way I can modify my hibernate.reveng.xml file for 2tables with composite keys having object references in the POJOs -

Is there way I can modify my hibernate.reveng.xml file for 2tables with composite keys having object references in the POJOs - <table schema="employees" name="dept_emp"> <primary-key> <generator class="native"> <param name="dept_emp">dept_emp_dept_no_seq</param> </generator> <key-column name="dept_no" /> <key-column name="emp_no" /> </primary-key> <column name="from_date" property="fromdate" type="date" /> <column name="to_date" property="todate" type="date" /> </table> <table schema="employees" name="employees"> <primary-key> <generator class="native"> <param name="employees">employees_emp_no_seq</param> </generator> <key-column name=&qu

ruby on rails - Show the latest content in the view by created at date -

ruby on rails - Show the latest content in the view by created at date - i able sort users created_at date using @users.sort_by(&:created_at).reverse.each |user| i need help sorting subscribe users subscription created_at date. <% @users.each |user| %> <li> <%= link_to user.username, user %> <% if user.subscription %> |<%= user.subscription.id %> | <%= user.subscription.plan.name %> | <%= user.subscription.created_at.strftime("%b %e, %y") %> | <% if user.subscription.stripe_customer_token.nil? %> paypal <% end %> <% if user.subscription.paypal_recurring_profile_token.nil? %> stripe <% end %> i think need alter of code in view, should showing users within subscription table. instead pulling users table, , grabbing subscription information. current code of course of study showing users without subscriptions. sort_by can take block. @users.sort_by {|user| user.subs

django - Crispy Forms: Is there a way to use crispy forms to render a completly readonly form view? -

django - Crispy Forms: Is there a way to use crispy forms to render a completly readonly form view? - i started utilize django, python , django-crispy-forms weeks ago. have spent lot of time finding way reuse form layout render readonly view. thinking on dry principle, have not much sense render form crispy , write same layout hand show user input, example, in confirm wizard step, or simple detail view. is there way this, replacing <input> elements <span> or <p> elements? thanks in advance. did mean that? : class commonformhelper(formhelper): def __init__(self): super(commonformhelper, self).__init__() self.disable_csrf = true self.form_tag = false class commonmodelformwithhelper(forms.modelform): def __init__(self, *args, **kwargs): super(commonmodelformwithhelper, self).__init__(*args, **kwargs) self.base_fields['some_field'].widget = forms.checkboxinput(attrs={'disabled': tr

c# - MVC 5 select list issues -

c# - MVC 5 select list issues - i have got number of problems: why <select id="setlang" data-bind="options: languagesettingex, optionstext: 'settedlanguage', optionsvalue: 'slid' "> </select> but @html.dropdownlistfor(m => m.selectedlanguagesettingex, (selectlist)model.languagesettingitemsex, new { id = "slid", data_bind = " options: languagesettingex, optionstext: 'settedlanguage', optionsvalue: 'slid'" }) this model public class langviewmodel { public string selectedlanguagesettingex { get; set; } public selectlist languagesettingitemsex { get; set; } } in using knockout read values , bind list, works in normal select, have got same type of way on application on fails. gives me error there no viewdata item of type 'ienumerable' has key 'selectedlanguagesettingex'. this knoutout.js bound json object i want either bin

arrays - Dealing with Categories in documents for elasticsearch -

arrays - Dealing with Categories in documents for elasticsearch - been wrestling while , need help. i have document array in php looks this array("title"=>"some title", "description" => "short description", "categories" => array ( array("id" => "1", "name" => "category 1"), array("id" => "5", "name" => "category 5"), array("id" => "55", "name" => "category 55"), ) ); so have document has many categories assigned. ultimate aim homecoming documents contain specific category id. i have setup mappings, , documents beingness index ok. have tried both "nested" type of mapping category, no mapping @ all, , "lists" type did not work @ error on creation of mappi

map function in Swift converting String to Int? -

map function in Swift converting String to Int? - let digitnames = [ 0: "zero", 1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine" ] allow numbers = [16, 58, 510] allow strings = numbers.map { (var number) -> string in var output = "" while number > 0 { output = digitnames[number % 10]! + output number /= 10 } homecoming output } // strings inferred of type [string] // value ["onesix", "fiveeight", "fiveonezero"] i hoping if there explain how code works (it taken apple's developer page swift under "closures). i'm not sure code in "while" loop means :/ how number converted string? map function higher order level function , used operation on single elements of array , homecoming transformed array generated a

css - Access inner html tag -

css - Access inner html tag - i got same front end end works need apply bootstrap. unfortunately, i'm not much front end end developer :p. anyway, here face problem described bellow: my html: <div class="container-fluid hidden-xs"> <div class="row"> <div class="col-xm-12 visible-xs hidden-sm hidden-md"> <a href="~/techroom/information?eventname=glassware"> <p class=" competencyuserstory" style="height:222px; width:110%;"> <img src="~/images/techroom/google-glass.jpg" style="height:222px; width: 107.6%; margin-left:-15px;" /> </p> </a> </div> <div class="col-md-4 hidden-sm hidden-xs"> <a href="~/techroom/information?eventname=glassware"> <p class=" competencyuserstory&

c++ - Sort actual QMap by key -

c++ - Sort actual QMap by key - i have qmap<qstring, myclass*> . need sort key using natural comparison. do: std::map<qstring, myclass*> map = c.tostdmap(); std::sort(map.begin(), map.end(), strnatcmp1<std::pair<qstring, myclass*>>); however, not compile. , if did, far understand, sort copy of original qmap . is there way sort qmap key function comparing keys provided? you have several appoaches take: store keys integers after converting qstring integer. you can utilize compare class std::map as per example: you can seek utilize specialize this template function qmap uses comparison. main.cpp #include <qmap> #include <qdebug> #include <map> struct str_num_compare { bool operator() (const qstring& lhs, const qstring& rhs) const {return lhs.toint()<rhs.toint();} }; int main() { qstringlist stringlist{"1", "10", "11", "2", "3", "4"

Trouble with socket connection in C and Linux -

Trouble with socket connection in C and Linux - i working on simple project because wanted larn more socket programming under linux. created simple server take connections , respond single statement. however, added while loop maintain connection alive, maintain sending commands without disconnecting. however, 1 time send first command, server respond connection. after first response, sits idle , quits responding. can tell code, tried take scheme phone call within , outside of while loop because not sure if calling take more 1 time on same client cause hang. 1 time moved take phone call outside of while loop, function still hangs, not sure go here. #include "server.h" #include <netinet/in.h> #include <sys/socket.h> #include <stdlib.h> #include <stdio.h> #include <string.h> struct server { int sockfd; int client_socket; //the socket used communication client int backlog; //maximum pending connections struct so

cordova - PhoneGap + AngularJS how to add camera Plugin -

cordova - PhoneGap + AngularJS how to add camera Plugin - i new phonegap , developing app android phonegap , angularjs. struck @ adding photographic camera plugin. i using cordova-plugin-camera. in config.xml, when add <gap:plugin name="org.apache.cordova.camera" version="0.2.9" /> it shows error saying: undefind prefix gap. my config file placed in appname/res/xml/acofig.xml how can add together this. the lines add together config.xml add together plugin when using phonegap build online service. if using command line interface (cli) create/build project, should add together plugins using cli : cordova plugin add together org.apache.cordova.camera angularjs cordova

silex - PHP Lazy loading with Pimple Dependency Injection Container? -

silex - PHP Lazy loading with Pimple Dependency Injection Container? - recently have started using pimple (together silex). depending on how pimple used can either service locator or dependency injection container. aware of reasons why service locator pattern should avoided. nevertheless 1 thing seems haunting me moment when dependency instance created. in case of dependency injection, instances of required classes created , passed constructor: class foo{ public $depend1; public $depend2; public function __construct($depend1, $depend2) { $this->depend1=$depend1; $this->depend2=$depend2; } public function task1() { homecoming $this->depend1->run(); } public function task2() { homecoming $this->depend2->run(); } } in case pass container class constructor, dependency instances not need created until needed. class foo{ public $app; public function __construct(\silex\application $

html - Bootstrap - Columns default value -

html - Bootstrap - Columns default value - on bootstrap grid system documentation says: content should placed within columns, , columns may immediate children of rows. so on next illustration smartphones , tablets: <div class="row"> <div class="col-xs-12 col-sm-12">column one</div> <div class="col-xs-12 col-sm-12">column two</div> </div> do have set classes col-xs-12 col-sm-12 when column should fill row width or there default class can set both devices? if don't set col classes, content pushed left , right due negative margins on .row class. as bootstrap mobile first, if set .col-xs-12 , div have total on every device. means don't have set .col-sm-12 . <div class="row"> <div class="col-xs-12"> <!-- 12-col on xs/sm/md/lg --> </div> <div class="col-xs-12 col-6-md"> <!-- 12-col on xs/sm

linux - How can I compile C programs that use deprecated functions, such as gets() -

linux - How can I compile C programs that use deprecated functions, such as gets() - for homework assignment, have seek utilize buffer overflows crash simple c program. problem compiler won't compile gets() function because deprecated , unsafe. understand this, sake of example, i'd override that. here code: #include <stdio.h> int main(int argc, char *argv[]) { int valid = 0; // char arrays w/buffer set 8 chars char str1[8]; char str2[8]; next_tag(str1); //this want utilize gets , not fgets or other secure functions... gets(str2); if(strncmp(str1, str2, 8) == 0) { valid = 1; } // print printf("buffer 1: str1(%s), str2(%s), valid(%d)\n", str1, str2, valid); } my gcc version is: rabbitfighter@echo:[~/code/c/bufferoverflowexamples]: gcc -v using built-in specs. collect_gcc=gcc collect_lto_wrapper=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.1/lto-wrapper target: x86_64-unknown-linux-gnu c

javascript - cannot POST /payment (Node.js and Stripe) -

javascript - cannot POST /payment (Node.js and Stripe) - i've embedded stripes checkout in file called payment.ejs <form action="" method="post"> <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" data-key="pk_test_odw7ojfvhlrjegfy0ppwzwee" data-amount="2000" data-name="demo site" data-description="2 widgets ($20.00)" data-image="/128x128.png"> </script> </form> i visit page , come in in credit card gets accepted. however, error cannot post /payment in app.js have app.post('payment', function(req, res){ //stripe console.log('posted') var stripetoken = req.body.stripetoken; var charge = stripe.charges.create({ amount: 1000, // amount in cents, 1 time again currency: "usd", card: stripetoken, description: "payinguser@ex

Nginx redirect all subdomains to main domain -

Nginx redirect all subdomains to main domain - i'm trying redirect subdomains main domain, far isn't working. here's how i'm doing it: server { hear [::]:80; server_name *.example.com; homecoming 301 $scheme://example.com$request_uri; } server { hear [::]:443; server_name example.com; ssl on; ssl_certificate /etc/ssl/certs/example.com.crt; ssl_certificate_key /etc/ssl/private/example.com.key; #enables versions of tls, not sslv2 or 3 weak , deprecated. ssl_protocols tlsv1 tlsv1.1 tlsv1.2; #disables weak ciphers ssl_ciphers "ecdhe-rsa-aes256-gcm-sha384:ecdhe-rsa-aes128-gcm-sha256:dhe-rsa-aes256-gcm-sha384:dhe-rsa-aes128-gcm-sha256:ecdhe-rsa-aes256-sha384:ecdhe-rsa-aes128-sha256:ecd$ ssl_prefer_server_ciphers on; root /var/www/html; index index.html; location / { # first effort serve request file, # dire

r - Remove lines based on duplicate values -

r - Remove lines based on duplicate values - i have bash file 2 fields. eg: abc 0.23 bca 2.30 azs 1.23 cda 2.11 xds 0.45 abc na cda na ang na there 2 duplicates in first column abc , cda. both these duplicates have na in sec column. want remove lines have duplicates remove 1 has na in sec while retaining others. desired output: abc 0.23 bca 2.30 azs 1.23 cda 2.11 xds 0.45 ang na i tried r output messy. hope there improve way in bash file around 40000 lines. thanks! here's 1 solution using awk : awk '( !($1 in val) || $2 != "na" ) { val[$1] = $2 } end { (k in val) { print k" "val[k] } }' output: cda 2.11 abc 0.23 azs 1.23 ang na xds 0.45 bca 2.30 if need preserve order of lines, require more work. r bash

node.js - 404 Error Due to Head request from Bot -

node.js - 404 Error Due to Head request from Bot - i have node.js app running express.js. site works fine when requesting: https://mysite.com/ browser. i setup grab 404 , log url requested (to see users getting confused, etc.). however, maintain getting 404 log message url https://mysite.com/ here more details on user agent triggers this: req.headers[user-agent]: "google-http-java-client/1.17.0-rc (gzip)" req.route.method : "head" i think bot requesting "head" instead of "get". why bot head request? should prepare allowing responses in express both head , get? node.js express http-status-code-404 web-crawler

ruby on rails - Resetting the database between rspec runs -

ruby on rails - Resetting the database between rspec runs - i have test this, fails after first run it 'should have login count of 1' ... (creates user 'test@example.com' email) expect(user.login_count).to eq 1 end the test fails because each time run it, user still in database , login count keeps incrementing. the login_count keeps incrementing because of method in programme either finds or creates user, each time though, increments login_count 1 what's best way have test think database clear each time runs? in order have clean state in database among each test execution may want utilize database cleaner gem: https://github.com/databasecleaner/database_cleaner rspec illustration setup (extracted github) rspec.configure |config| config.before(:suite) databasecleaner.strategy = :transaction databasecleaner.clean_with(:truncation) end config.around(:each) |example| databasecleaner.cleaning example.run end end

php - file_get_contents on times out when run on same server as target -

php - file_get_contents on times out when run on same server as target - if set in php file: echo file_get_contents("http://www.example.com/mypage.php"); if run script on example.com, page times out. if run same script on different server, loads correctly immediately. checked , allow_url_fopen 'on' in phpinfo(). ideas be? in advance. use this class for getting things dom url like $html = file_get_html("http://example.com"); echo $html; php

Adding extension to file via filewatcher in WebStorm 9 -

Adding extension to file via filewatcher in WebStorm 9 - i have send js files through outlook, means have modify extension of file txt or recipient can receive it. i'd ideally implement file watcher in webstorm output kid file .txt appended similar how it'll show kid css file less file. to sum up, given file named "file.js", output "file.js.txt" whenever create change. is there simple way go doing this? you can create .bat file (shell script) re-create files , configure file watcher. like: copy %1 %2 /y watcher settings: program: path/to/your/batfile.bat arguments: $filename$ $filename$.txt working directory: $filedir$ output paths: $filename$.txt webstorm file-watcher

c++ - OpenCV PointCloud from Depth map -

c++ - OpenCV PointCloud from Depth map - i trying generate point cloud minoru3d stereo camera, not work. generated points not correct. photographic camera correctly calibrated. rectified images(rec1, rec2), disparity map(disp) , depth map(depth): and pointcloud: i create depth image reprojectimageto3d , read points @ every pixel. total code: #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/contrib/contrib.hpp> #include <opencv2/calib3d/calib3d.hpp> #include "libcam.h" #include <stdio.h> #include <fstream> using namespace cv; using namespace std; int main(int argc, char** argv) { // photographic camera properties int w = 640; int h = 480; int fps = 20; // images, proceeded mat img1, img2; // grayscale versions of images mat gray1, gray2; // disparity , depth map mat disparity; mat depth(s

php - store arrays in variables inside foreach -

php - store arrays in variables inside foreach - sorry if title not clear need this: i have foreach printing info db , have multiple variables should store arrays , print main variable others variables. foreach ($aitems $i => $aiteminfo) { $var1 = ''; $var2 = ''; $var3 = ''; $var1 .= $aiteminfo['val1']; $var2 .= $aiteminfo['val2']; $var3 .= $aiteminfo['val3']; // operations db info if ($var1 > 0) { if ($var1 == 1 && $var2 == 0) { $a = 'some text.'; } else if ($var1 == 1 && $var2 == 1) { $a = 'some other text.'; } else if ($var1 > 1 && $var2 == 0) { $a = 'some new text.'; } else if ($var1 > 1 && $var2 == 1) { $a = 'some other new text.'; } $new_var = ''; // html code $new_va

Saving offline copy of Google Python tutorial using python. -

Saving offline copy of Google Python tutorial using python. - i trying write python code save offline re-create of "google python tutorial" can access file when not connected internet. importing next libraries - urllib, re, beautifulsoup, os thought identify urls under navigation path (class - gc-toc) , loop through each url , save html file locally. below code same. my questions are, the downloaded html files tries access css , js files online. how can download these files through program? the whole programme seem cumbersome @ moment. can suggest ways improve it? ex, avoid using re , utilize beautifulsoup extract links under 'gc-toc' class. import urllib import re beautifulsoup import * import os #the url tags scraped url = 'https://developers.google.com/edu/python/' html = urllib.urlopen(url).read() soup = beautifulsoup(html) #the scraped tags contain relative path. need append baseurl downloading base_url = 'https://developers.googl

php - Checking isset on session stops javascript -

php - Checking isset on session stops javascript - hey checking if existence of $_session variable javascript.. if (<?php echo isset($_session["variable"]); ?>){ //alert ("lol"); } if exists works fine, otherwise gives java script error. illustration alert("<?php echo isset($_session["variable"]); ?>"); gives empty alert, doesn't give errors what missing? echo won't output false getting if() syntax error. utilize var_export(isset($_session['variable'])) instead, either output true or false javascript php session

php - How can I rewrite URL's of a certain directory? -

php - How can I rewrite URL's of a certain directory? - ok, vague question title, know. wasn't sure how summarize in 1 line. have 2 applications in codeigniter installation: frontend , admin. there 2 front end controllers each set right application folder. currently, utilize index.php/home home page of frontend , admin.php/home home page of admin panel. i got around removing index.php url of frontend. admin cp, utilize example.com/admin instead of example.com/admin.php. need rewrite uri has admin first segment admin.php. figured adding rewriterule ^admin/(.*)$ admin.php/$1 htaccess trick, apparently doesn't... not anyway. 404 page not found every single page in admin cp. doing wrong? # deny or allow folder indexes. # since disable access php files # can leave on without worries. # or improve yet, create .htaccess file in # dir want allow browsing , # set +indexes options -indexes options +followsymlinks # set default file indexes directoryindex