Posts

Showing posts from June, 2011

is possible to make html input type number only show numbers which are multiple of 5 -

is possible make html input type number shows numbers multiple of 5 (5,10,15....)? <input type="number" name="pax"> for html 5 only <input type="number" name="pax" step="5"> there other javascript or regex solutions shouldn't necessary. further reading on type input: http://www.w3schools.com/html/html_form_input_types.asp here example using more popular attributes of number inputs. <input type="number" name="pax" min="0" max="100" step="5" value="0">

python - Not able to connect to MongoDB using django/mongoengine (auth failed) -

below screen dump of when try connect mongodb ps d:\projects\project1> python manage.py shell traceback (most recent call last): file "c:\python33\lib\site-packages\pymongo\mongo_client.py", line 381, in __init__ self._cache_credentials(source, credentials, _connect) file "c:\python33\lib\site-packages\pymongo\mongo_client.py", line 456, in _cache_credentials auth.authenticate(credentials, sock_info, self.__simple_command) file "c:\python33\lib\site-packages\pymongo\auth.py", line 243, in authenticate auth_func(credentials[1:], sock_info, cmd_func) file "c:\python33\lib\site-packages\pymongo\auth.py", line 222, in _authenticate_mongo_cr cmd_func(sock_info, source, query) file "c:\python33\lib\site-packages\pymongo\mongo_client.py", line 687, in __simple_command helpers._check_command_response(response, none, msg) file "c:\python33\lib\site-packages\pymongo\helpers.py", line 178, in _che...

wso2esb - Does WSO2 ESB support SOAP attachments -

i looking wso2 esb our integration need. 1 of scenario requires use of soap attachment. know if support soap attachments? not clear documentation. if no, how difficult extend existing functionality? wso2 based on axis2, supports swa , mtom attachements. check sample 51 article in order see in action: https://docs.wso2.com/pages/viewpage.action?pageid=33136025

three.js - Transparent object behind outline object -

Image
i have outlined object. behind want draw transparent object. problem outline blends transparent object. how can draw outline doesn't blended? # plane geo1 = new three.planegeometry 500, 500 mat1 = new three.meshphongmaterial({color: 0x00ff00, transparent: true, opacity: 0.5}) plane = new three.mesh geo1, mat1 plane.position.z = -100 scene.add plane # shaded model torusknotgeo = new three.torusknotgeometry 50, 10, 128, 16 phongmat2 = new three.meshphongmaterial 0xffffff torusknot = new three.mesh torusknotgeo, phongmat2 scene.add torusknot # outline uniforms = offset: type: "f" value: 2 shader = shader['outline'] shadermat = new three.shadermaterial uniforms: uniforms, vertexshader: shader.vertex_shader, fragmentshader: shader.fragment_shader, torusknotoutline = new three.mesh torusknotgeo, shadermat torusknotoutline.material.depthwrite = false outscene.add torusknotoutline jsfiddle (based on https://stackoverflow.com/a/231981...

javascript - loading a markup if a class exists -

i want load markup documents based on present of classes in document.but problem if definite class not exists @ loads. my codes are (function($){ 'use strict'; var prefixmarkup = '<ul class="filter-elements hidden" >'+ '<li><a href="#" class="current"></a></li>'+ '</ul>'; if($('body').has('.filter-container')){ if(!$('body').hasclass('filter-elements')){ $('footer.footer').before(prefixmarkup) } } })(jquery); here if .filter-container not exists prefixmarkup loads , if .filter-elements exists prefixmarkup loads should now? first: the .hasclass() method return true if class assigned element, if other classes are. the .has() method constructs new jquery object subset of matching elements. your need change: if($('body').has(...

sockets - Using TCP in Standard ML -

i'm trying write minimal tcp server in standard ml , getting type errors don't understand. i've got far is fun sendhello sock = let val res = "http/1.1 200 ok\r\ncontent-length: 12\r\n\r\nhello world!\r\n\r\n" val wds = map (fn c => word8.fromint (char.ord c)) (string.explode res) val slc = arrayslice.full (array.fromlist wds) in socket.sendarr (sock, slc) socket.close sock end fun acceptloop serv = let val (s, _) = socket.accept serv in print "accepted connection...\n"; sendhello s; acceptloop serv end fun serve () = let val s = inetsock.tcp.socket() in socket.ctl.setreuseaddr (s, true); socket.bind(s, inetsock.any 8989); socket.listen(s, 5); print "entering accept loop...\n"; acceptloop s end the latter 2 functions work fine (if comment out sendhello line, typecheck without complaint, , set server prints accepted connect...

java - I am having issues with a basic contact manager that I am creating. -

i having problems bit of code. first thing did created arrays, these arrays hold information each contact, building basic contact manager. main method calls menu method start sequence. @ menu, user has choice of want do. whichever choice choose determined number enter on keyboard. in turn, activate different method. the problems having follows: after pressing "1" view contacts, computer either spits out 100 nulls or 100 repeats of whatever last inputted in "2", add contacts. although yes want menu repeat after action has taken place, instantaneously. example, repeats happen after push "1" goes straight main menu, , difficult read way. import java.io.ioexception; import java.util.scanner; ``public class mainhub { // global variables needed static string[] name = new string[100]; static string[] number = new string[100]; static string[] email = new string[100]; static string[] address = new string[100]; static string[] birthday = new string...

android - LibGDX, intermittent lagging whilst moving an object -

i create little sprites of sheeps on top of screen, should go down , after crossing bottom line disappear. problem when going across screen noticable lag. milliseconds possible see it. happens absolutely randomly. change position gdx.graphics.getdeltatime(); public void update (float deltatime) { updatemotionx(deltatime); updatemotiony(deltatime); // move new position position.x += velocity.x * deltatime; position.y += velocity.y * deltatime; } here code of spawing them: private sheep spawnsheep(){ sheep sheep = new sheep(); sheep.dimension.set(dimension); // select random cloud image sheep.setregion(regsheeps.random()); // position vector2 pos = new vector2(); pos.x = -0.19f; // position after end of level pos.y = 5; sheep.position.set(pos); //speed vector2 speed = new vector2(); speed.y = 3.5f; sheep.terminalvelocity.set(speed); speed.y *= -1; sheep.velocity.set...

caching - CircleCI cache bundle install -

is there way cache dependencies bundler (using bundle install)? know there's cache_dependencies command can use in circle.yml, i'm not sure pathway pass it. for reference, in travisci, can cache bundler using cache: bundler by default, circleci cache vendor/bundle , ~/.bundle if let run bundler should cached automatically.

ruby on rails - How to fire CoffeeScript/Javascript after user presses back button -

different parts of ui on rails 4 application rely on dynamically populated select controls, option selected in first select determines options available in second select. script sets options of second select runs when select's onchange event fired. everything works fine, until user clicks browser's button , returns form contains 2 select controls. first select retains user's selection, second select (which dynamically populated script) reverts default options. browsers don't seem fire event @ when user uses button, there doesn't appear me hang script on. how can script run after user presses button? what alternatives if can't actual script run? have ditch dynamic selects in favor of single, massive select lists options in 1 control? this inelegant, expedient solution: rather recreating own session history mechanism, added javascript_tag form included copy of script runs on page load (including when user hits button, whereas script in assets...

forms - Jquery submit() wait for file upload prompt -

i have simple code , i'm trying find way inlcude form submitting directly in it. $('#falsebutton').click(function() { $('#filetoupload').click(); }); how add $("form").submit(); trigger after file upload prompt? p.s: don't have submit button. the default action of button inside form submit form. if want else, need prevent default action: $('#falsebutton').click(function(e) { e.preventdefault(); $('#filetoupload').click(); }); now, if understood right, want trigger form submit after user chooses file upload? if so, can listen change event on file input , submit form when fires: $('#filetoupload').on('change', function() { $('form').submit(); });

sql - Setting a column as timestamp in MySql workbench? -

Image
this might elementary question, i've never created table timestamp() before, , i'm confused on put parameters. example, here: i randomly put timestamp(20) , 20 parameter signify here? should put in here? i googled question, didn't come so... anyway i'm new sql, appreciated, thank you!! you don't need put length modifier on timestamp . timestamp itself. but aware first timestamp column defined in table subject automatic initialization , update. example: create table foo (id int, ts timestamp, val varchar(2)); show create table foo; create table `foo` ( `id` int(11) default null, `ts` timestamp not null default current_timestamp on update current_timestamp, `val` varchar(2) default null ) what goes in parens following datatype depends on datatype is, datatypes, it's length modifier. for datatypes, length modifier affects maximum length of values can stored. example, varchar(20) allows 20 characters stored. , decimal(10,6) a...

javascript - Why won't featureClick work in my cartoDB map? -

i can except featurecclick work. my js: window.onload = function(){ var cartodbtablename = 'sipri_import_export_map_1950_2014'; var domid = 'map'; var mapstyle = document.getelementsbyclassname('map-style'); var lat = 0; var lon = 0; var zoomlvl = 2; var options = { center: [lat,lon], zoom: zoomlvl }; var mapobject = new l.map(domid,options); var layersource = { user_name: 'chrismp', type: 'cartodb', sublayers: [ { sql: "select * "+cartodbtablename+" (gwsyear <= 1950 , gwsyear > 0)", cartocss: mapstyle[0].innerhtml } ] }; l.tilelayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png') .addto(mapobject); cartodb.createlayer(mapobject,layersource) .addto(mapobject) .on('done',function(layer){ layer.gets...

Android DatePicker style messed up -

Image
i'm developping android app , @ point needed use datepicker. i'm using bit of code here . datepickerfragment pops has style messed : this layout of activity : <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="narthe.compteur_km.exportactivity" android:background="#ff1a2530" android:gravity="center" android:orientation="vertical"> <textview android:id="@+id/showmydate" android:layout_width="fill_parent" android:layout_height="wrap_cont...

Making an R package PDF manual using devtools -

i making r package using devtools , roxygen2. can pdf manual using r cmd curious whether can done using devtools. devtools' build(), check(), install() don't make pdf manual. tied making vignettes? i have read , referred similar thread package development : location of pdf manual , vignette after install it, can use: pack <- "name_of_your_package" path <- find.package(pack) system(paste(shquote(file.path(r.home("bin"), "r")), "cmd", "rd2pdf", shquote(path)))

c# - How to display search with Help.ShowHelp? -

in code contents , index working search doesn't.i not sure helpnavigator.find ok? there other way display search chm file? using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; namespace spomenik { public partial class pomoc : form { public pomoc() { initializecomponent(); } private void help_click(object sender, eventargs e) { system.windows.forms.help.showhelp(this, "..\\..\\slika\\spomenikpomoc.chm"); //help.show(this, "..\\..\\slika\\spomenikpomoc.chm"); ne radi jer mi je naziv dugmeta } private void index_click(object sender, eventargs e) { system.windows.forms.help.showhelpindex(this, "..\\..\\slika\\spomenikpomoc.chm"); } private void search_click(object sender, eventargs ...

Eclipse: missing menu option to create new Remote C/C++ Project -

i running eclipse cdt luna sr 1 (version 4.4.1) , have installed remote system explorer end-user runtime , remote system explorer user actions packages (both version 3.7.0). can browse remote system , create link remote folder through rse using ssh, cannot create new remote c++ project luna documentation describes here . menu options in manual not exist. necessary install rse server somewhere first? wouldn't make lot of sense, since rse can use local providers. appreciated.

PyQt ToolTip for QTreeView -

please axplain how enable , show tooltip each item in qtreeview. found sample of code class treemodel(qabstractitemmodel) due beginner's level can't understand how apply needs. data tooltip should taken value of key "note" in dictionary data_for_tree . #!/usr/bin/env python -tt # -*- coding: utf-8 -*- pyqt5.qtgui import * pyqt5.qtcore import * pyqt5.qtwidgets import * import sys reload(sys) sys.setdefaultencoding('utf8') data_for_tree = {"tomato":{"color":"red","ammount":"10", "note":"a note tomato"},"banana":{"color":"yellow","ammount":"1", "note":"b note banana"}, "some fruit":{"color":"unknown","ammount":"100", "note":"some text"}} class treemodel(qabstractitemmodel): def data(self, index, role=qt.displayrole): #... i...

java - Problems to reach internet url for wildfly cartridge -

i deploy ear web application on wildfly 8 app in openshift. deploy terminate successfully. in local mode (127.0.0.1) webapp respond correctly on http://127.0.0.1:8082/ <> rhc port-forward on. if helps, below output of rhc port forward : haproxy 127.0.0.1:8080 => 127.12.6.2:8080 haproxy 127.0.0.1:8081 => 127.12.6.3:8080 java 127.0.0.1:3528 => 127.12.6.1:3528 java 127.0.0.1:7600 => 127.12.6.1:7600 java 127.0.0.1:8082 => 127.12.6.1:8080 java 127.0.0.1:9990 => 127.12.6.1:9990 but dont't reach application internet urls. try http://"full openshift app url":8080/"context-root" or http://"full openshift app url"/"context-root" not work. what's wrong?

python: updating file by finding unique values between two files, and then appending further data to bottom -

i haven't got idea python. have file, substance.txt, list of 4k substances. have log file, log.txt, contains updates these substances @ moment, manually reflecting in substance.txt. log has format + tab @ start if new concept or -tab @ start if concept should removed substance.txt using python, tying go through , first, copy in substance.txt not in log new file. then, trying go through logfile , append has '+ tab' bottom of new file. give me existing substance.txt content not affected + new terms log.txt , have removed concepts flagged in log.txt removal. this code: import re import fileinput # write concepts not not in log open("log.txt", 'r') f, open("substance.txt", "r") oldfile, open('new_substance.txt', 'w') newfile: withconceptsremoved = [x x in oldfile if x not in f] newfile.write(withconceptsremoved) # new file has comments neither positive or negative in log. if copy positive ones, we...

javascript - Why won't my grunt task work - emailBuilder -

i trying run simple bare bones grunt task , not working. installed using npm install package: { "name": "ent-nmo-fasg-younger-mills-em-1", "version": "0.1.0", "devdependencies": { "grunt": "~0.4.5", "grunt-contrib-jshint": "~0.10.0", "grunt-contrib-nodeunit": "~0.4.1", "grunt-contrib-uglify": "~0.5.0", "grunt-email-builder": "^3.0.1" } } then in gruntfile.js have added code: module.exports = function(grunt) { grunt.initconfi({ pkg: grunt.file.readjson('package.json'), emailbuilder: { files : [{ expand: true, src: ['dev/*.html'], dest: 'dist/', }] } }); grunt.loadnpmtasks('grunt-email-builder'); grunt.registertask('dist',['emailbuilder']); }; the error getting in terminal a...

javascript - Set dynamic value to Array in JS like PHP -

this question has answer here: how insert item array @ specific index? 10 answers my question how set value array in js php? example: in php have array named arr, set new value in n position using arr[] = value but try same in js display error use push command arr.push(value)

php - Is it possible to read response headers server side? -

hey if have laravel 5 apps, & b i want set header paramaters on , redirect b , read headers in app b. redirect()->to($url)->headers('key', $key); this sends headers in response , thats fine how read them server side? thanks this not seem possible flow is: 1) browser -[request]-> 2) browser <-[redirect]- 3) browser -[request]-> b 4) browser <-[content]- b your response headers on step 2 not automatically sent server b in next request (that automatically executed browser due redirect). a workaround comes mind add key $url parameter this: $url = $url.'?key='.urlencode($key); on application b can redirect remove 'key' parameter address bar, when set.

java - How test classes get reference of source classes in junit test? -

junit test classes reside in totally different target folders, while running test cases how possible test class reference source classes? the test framework makes use of classpath feature of jvm. classpath indicates program running tests should find classes needs. environment (your ide, example) sets classpath search in both location of test classes , location of classes testing. set classpath search in location of test classes and then search in location of classes being tested.

ember.js - Using same model for two different templates -

i have model , use 2 different templates on page. didn't find on how specify model use template (other name). for example, display subusers model "subusers" in template named "assignationdd". right now, have template named "subusers" links model automatically, can reuse model in template? edit : i have multi-model ressource because need both conversations , subusers @ root of app. should have precised before. there no change in url or route, want display model in 2 different templates. , yes read docs on ember-data (and shows few , simpler examples). router : app.router.map(function(){ //routing list raw namespace path this.resource('conversations', { path : '/' }, function() { this.resource('conversation', { path : '/:conversation_id'}); }); }); route : app.conversationsroute = ember.route.extend({ subusers: null, currentuser: null, model: function(params){ return this.store.find('...

javascript - How does !!~ (not not tilde/bang bang tilde) alter the result of a 'contains/included' Array method call? -

if read comments @ jquery inarray page here , there's interesting declaration: !!~jquery.inarray(elm, arr) now, believe double-exclamation point convert result type boolean , value of true . don't understand use of tilde ( ~ ) operator in of this? var arr = ["one", "two", "three"]; if (jquery.inarray("one", arr) > -1) { alert("found"); } refactoring if statement: if (!!~jquery.inarray("one", arr)) { alert("found"); } breakdown: jquery.inarray("one", arr) // 0 ~jquery.inarray("one", arr) // -1 (why?) !~jquery.inarray("one", arr) // false !!~jquery.inarray("one", arr) // true i noticed if put tilde in front, result -2 . ~!!~jquery.inarray("one", arr) // -2 i don't understand purpose of tilde here. can please explain or point me towards resource? the tilde operator isn't part of jquery @ - it's bitwi...

f# - Map and pattern matching -

i have assignment here i'm struggling with: type multimap<'a,'b when 'a:comparison , 'b:comparison> = mmap of map<'a, list<'b>> the assignment states we define canonical representation of multimap representation elements in value-lists ordered. declare function canonical: multimap<'a,'b> -> multimap<'a,'b> when 'a : comparison , 'b : comparison canonical m returns canonical representation of m . right have: let toorderedlist (mm:multimap<'a,'b>) = match mm | mmap m -> i don't know how pattern match on this. help? :3 ok, give answer function looking can written this: let cannonical (mmap m) = m |> map.map (fun _ vs -> list.sort vs) |> mmap this deconstructs multimap right in argument definition (pattern-matching) , pipes map<> m through - sorting list s map.map , wrapping mulitmap using construc...

PHP mb_split(), capturing delimiters -

preg_split has optional preg_split_delim_capture flag, returns delimiters in returned array. mb_split not. is there way split multibyte string (not utf-8, kinds) , capture delimiters? i'm trying make multibyte-safe linebreak splitter, keeping linebreaks, prefer more genericaly usable solution. solution user casimir et hippolyte, built solution , posted on github ( https://github.com/vanderlee/php-multibyte-functions/blob/master/functions/mb_explode.php ), allows preg_split flags: /** * cross between mb_split , preg_split, adding preg_split flags * mb_split. * @param string $pattern * @param string $string * @param int $limit * @param int $flags * @return array */ function mb_explode($pattern, $string, $limit = -1, $flags = 0) { $strlen = strlen($string); // bytes! mb_ereg_search_init($string); $lengths = array(); $position = 0; while (($array = mb_ereg_search_pos($pattern)) !== false) { // capture split $le...

node.js - Redis pub/sub limit -

using redis pub/sub, there way limit number of listeners redis publish to? http://redis.io/commands/publish for example, using node.js parlance: var redis = require('redis'); var rcpub = redis.createclient(); var rcsub = redis.createclient(); rcpub.publish('channel','messagea',{limit:1}); //desired functionality/syntax basically, when send messagea redis, want tell redis publish message 1 listener/subscriber. seems possible, can redis this? in redis docs, command is: publish channel message what looking is: publish channel message limit where limit integer. seems reasonable, , easy implement redis' perspective. you can add channel per subscribed, , publish single user's channel when need communicate him.

python - Pip default behavior conflicts with virtualenv? -

i following tutorial http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world/page/5 when got virtualenv flask command, received error message: can not perform '--user' install. user site-packages not visible in virtualenv. this makes sense point of virtualenv create new environment can control, , --user command places in specific location, defeating objective of separation of dev environment. it seems pip defaults --user installations though, can change default behavior? and, better, can pip play nice virtualenv @ times? to clarify, here terminal looks like. melchior:miguelgrinberg-microblog megablanc$ virtualenv flask new python executable in flask/bin/python installing setuptools, pip, wheel... complete output command /users/megablanc/dev...log/flask/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip wheel: can not perform '--user' install. user site-packages not visible in virtualen...

mysql calling stored procedure for where id in -

i have created stored proc returns 1 column of id's linking. sql = call myproc(555) the above works returning result set of id's. sql = "select * mytable id in (call myproc(555))" the above query says syntax incorrect , bombs. suggestions? glenn

groovy - Step assertion based on different step result - soapUI (run test case and test step from script assertion) -

in soapui test case i've "update" soap test step. right after i've groovy script step in verifying "update" running different test step,say "search" (located in different test case), programmatically withing script. now, mark "update" step pass or fail script assertion (so can green/red thing), based on result of "search". as testrunner not available in script assertion (as per knowledge) , how assert on "update" based on "search". because "search" has run between run of "update" , run of assertion script of "update". i've tried using context object described here , failing script assertion doest not show access properties set in context object in groovy script step. has faced such issue? appreciated. resolved issue running testcase assertion script this. messageexchange.modelitem.teststep.testcase.testsuite.gettestcasebyname("test case name...

asp.net web api - Azure No 'Access-Control-Allow-Origin' header is present on the requested resource -

i'm trying move api service (written in web api) azure. have openned website , moved there. in web api have these attributes: [enablecors(origins: "*", headers: "*", methods: "*")] on old website (not azure) requests return data, regardless domain trying data. after moved web api new website in azure, started recieve next error: no 'access-control-allow-origin' header present on requested resource when web api located on old website, works (from localhost, , other kinds of sources). is there configuration in azure portal? or perhaps change web.config? thank you my team , have created demo demonstrates how build web api angularjs front end requires cors enabled. here source code a few things note sample: uses microsoft.aspnet.webapi.cors nuget package enable cors in webapiconfig.cs in app_start folder web.config: remove handlers: optionsverbhandler , traceverbhandler , webdav web.config: remove module: webdavmo...

swift - iOS - retain View Controller state after presenting modal on top of it -

so have view controller a, presents view controller b modally. set delegate b when b presented. b has 2 buttons @ top: done , cancel. both call dismissviewcontrolleranimated(true, completion: nil) but done calls delegate method stores information in array in a. works great, except when go b stuff stored array previous done click, , click cancel time instead, array initialized default empty state. how dismiss b while maintaining existing state of array? thanks. edit sorry - realized impossible visualize describing, here gist of code: class a: uiviewcontroller, bprotocol { var array: [user] = [] func viewdidload() { ... } func bprotocolfunction(newarray) { array = newarray } func prepareforsegue() { ... b.delegate = self } } class b: uiviewcontroller { var delegate: bprotocol? // works great, copies new array array in a. however, // if go modal, , click cancel, // array reset fu...

vb.net - Program crashing Visual Basic -

i programming in visual basic , have program created loan calculator. pretty have correct , works , operates way want too. here code far: public class form1 private minamt decimal = 1000 private maxamt decimal = 200000 private drate decimal private loan decimal private sub form1_load(sender object, e eventargs) handles mybase.load '== load rate , terms combo, 'click reset r decimal = 0 0.1475 step 0.0025 '== add each successive value combo list cbxrate.items.add(format(r, "00.00%")) next t byte = 12 120 step 6 cbxterm.items.add(format(t, "00")) next btnreset.performclick() end sub private sub btnreset_click(sender object, e eventargs) handles btnreset.click '== set defaults, , clear prior answers cbxrate.text = "06.00%" cbxterm.text = "36" tbxloan.text = "10,000" lblpayment.text = "" end sub private sub btncalc_click(sender object,...

c# - Programatically access currently-selected XML Map in Excel -

i'm developing excel addin needs know selected xml map in xml source pane. i haven't found way access it. i've been digging in docs microsoft office tools excel , haven't find saying it's impossible. anybody has gotten it?

html - .htaccess rewriterule affected css path -

Image
im not sure if title correct. have .htaccess file 2 rewriterule 's. rewriteengine on rewriterule ^user/([0-9a-za-z]+) user.php?user=$1 rewriterule ^success/message/([0-9a-za-z]+)/([0-9a-za-z]+) successful_register.php?user_username=$1&user_activate_url=$2 and html file ( successful_register.php ) <!doctype html> <html> <head> <title>peter</title> <?php include("backbone/include_header.html"); ?> </head> <body> <?php include_once("backbone/navigationbar.html"); ?> </body> i can open file on 2 ways http://localhost/fragen/success/message/asdasdasd/0ab605102670807b661d9a1a4e6187 successful_register.php?user_username=username&user_activate_url=0ab605102670807b661d9a1a4e6187 include_once("backbone/navigationbar.html"); works!, include("backbone/include_header.html"); not. inside of include("backbone/include_heade...

Use JavaScript regex to capture all string values from VBA code -

i want use javascript regex list string values used in vba code. example: if cmd = "history report" range("d2").formula = "=text(""" & createdate & """,""" & replace(subtitleformat, """", """""") & """)" comment = "this task completed!" end if the result be: 1> "history report" 2> "d2" 3> "=text(""" 4> """,""" 5> """" 6> """""" 7> """)" 8> "this task completed!" i'm glad have better ideas solve problem. ""*[^"]*"*" try this.see demo. https://regex101.com/r/pg1ku1/19 edited: "(?:"{2})*[^"]*(?:"{2})*" try this.see demo. https://regex101.com/r/pg1ku1/23 ...

Prolog Lists - Finding items with multiple constraints -

i need write prolog program "dump." can data database constraints: imagine simple database a(int,color) a(1,blue). a(1,red). a(1,green). a(2,green). a(3,yellow). a(3,blue). a(4,green). a(4,purple). a(4,blue). a(4,red). i need program "dump." give me int elements related color 'blue' , 'red' , related other color , output color not blue , red. example query be ?- dump. 1 green 4 purple 4 green true here not care know 3 related yellow because 3 not related both blue , red. can me? :) first of all, stick pure relations! there no need print things, prolog printing you. redblue_number(nr) :- a(nr, red), a(nr, blue). nr_related(nr, related) :- redblue_number(nr), dif(related, red), dif(related, blue), a(nr, related). ?- nr_related(nr, related). nr = 1, related = green ; nr = 4, related = green ; nr = 4, related = purple ; false.

javascript - Order of script execution when using document.write -

i need run library called fastclick in order handle 300ms click delay that's on mobiles. @ same time, don't need run if i'm not running on mobiles. i'm looking this: <head> <script> var useragent = navigator.useragent; if (screen.width < 851 || useragent.indexof('ipad') !== -1 || useragent.indexof('iphone') || useragent.indexof('android')) { document.write('<script src=\"/externalfiles/fastclick.js\"></script>'); } </script> //second script <script> if (fastclick) {...} </script> </head> as can see, second script checks see if fastclick loaded. on local machine, works. however, i'm wondering if works because file loaded instantaneously file system (ie no delay) or if in fact, document.write statement triggers load , script execution on hold until script loaded. i'm looking latter b...

How would you display each element of an array that is returned from another method in Java? -

for example, have main method method returnodds(original), returns integer array "odd" how print elements of array in main method? loop? a for loop work. if don't care format, though, simpler solution might use arrays.tostring , convert in form "[elem1, elem2, ..., elemn]" .

java - using android layout and android id -

view v=inflater.inflate(r.layout.fragment_b,container,false); view v = findviewbyid(r.id.fragb); i want know when use r.id.fragb and when use r.layout.fragment_b. can't use r.id.fragb in place of r.layout.fragment_b in first statement. all references under r.layout refer layout files themselves. example, if define layout fragment in fragment_b.xml , r.layout.fragment_b way framework reference file. references under r.id identifiers. identifiers views in layout, or generic identifiers create other purposes. your layout xml might start root view has id, might not. layout xml can contain views many different ids. 2 not interchangeable.

memory - How to prevent MatLab from freezing? -

Image
is there way limit amount of time evaluation allowed run? or limit amount of memory matlab allowed take doesn't freeze laptop? let's answer questions 1 @ time: question #1 - can limit amount of time matlab takes execute script? as far know, not possible. if want this, need multi-threaded environment 1 thread actual job while thread keeps eye on timer... functionality, afaik, matlab not have supported. way stop script running if punch ctrl + c / cmd + c . depending on being executed... example mex script or lapack routine, or simple matlab script, may work pushing once... or may have mash sequence like maniac . (note: above image introduced try , funny. if don't know image from, it's movie flashdance , 1 of songs soundtrack she's maniac , i've provided youtube link song above.) see post more details: how can interrupt matlab when gets really busy? question #2 - can limit amount of memory matlab uses? yes can. have seen in posts...

angularjs - jasmine spyOn on javascript new Date -

i unit testing client code in angulajs , understand code means var newdate = new date(2013,6,29); spyon(date.prototype, 'gettime').and.callfake(function() { return newdate; }); we mockout gettime() methode of date object. want mock out new date() instead. example code want test contains line payload.created_at = new date(); i dont have access payload.created_at. want tell jasmine whenever see new date(), replace given date give you. thinking of doesnt work. spyon(date.prototype, 'new date').and.callfake(function() { return newdate; }); but new date not method of date. please can me figure out? thanks the jasmine clock api allows fake out javascript date functionality without manually writing spy it. in particular, read section mocking date .

oop - Possible improvements for an OO PHP written script -

okay, wanting expand armoury within php, i've been researching oo php. researched knowledge went on create quick script reads csv file , outputs results. csv class: class csv { private $file; public function __construct($filename, $mode) { $this->file = fopen($filename, $mode); } public function endfile() { return feof($this->file); } public function getcsv($mode) { return fgetcsv($this->file, $mode); } public function close() { fclose($this->file); } } the test file: require('class.csv.php'); $csv = new csv('postcodes.csv', 'r'); while(!$csv->endfile()) { $postcode = $csv->getcsv(1024); echo $postcode[0] . "<br />"; } $csv->close(); i wondering if there are... or improvements make in regards oo approach. purely script me put knowledge i've learnt together. i'm not 'following crowd person' creates ev...

c# - Telerik PdfViewer - Binding to a PDF source -

i've tried samples on telerik's website well, , no avail. have code: public icommand emailpopupcmd { get; set; } private void emailpopup(object sender) { //todo: pdf viewer pop selecteddatarow = (datarow)sender; var window = new window(); window.content = new emailview() { datacontext = this}; //shares same data context memorystream str = new memorystream();//= new memorystream(pdfasbytearray);//new system.uri(@"pack://application:,,,/resources/testpdf.pdf", system.urikind.relativeorabsolute); using(filestream fs = file.openread(@"c:\source\ui.mailviewer\resources\testpdf.pdf")) { str.setlength(fs.length); fs.read(str.getbuffer(),0, (int)fs.length); } attachmentpath = new pdfdocumentsource(str); if (window.showdialog() == true) { //from child parent } } c:\source\ui.mailviewer\resources\testpdf.pdf pdf located , bind ...

Is there a way to programatically stop gatling test? -

i have requirement need run test until data items feeder exhausted. i.e. stop exection after gatling has iterated through data. how achieve this? understand how stop after duration. gatling automatically stops when feeders exhausted, have nothing special on side.

node.js - Accessing local path using node server -

Image
in below code can able listen port 9080 need access local file path (d:\xampp\htdocs\ln\try\index.html) using http request var http = require('http'); const port=9080; function handlerequest(request, response){ response.end('it works!! path hit: ' + request.url); } var server = http.createserver(handlerequest); server.listen(port, function(){ //callback triggered when server listening. hurray! console.log("server listening on: http://localhost:%s", port); }); installing http-server using node ( npm install http-server -g ). when add globally node module can run server in path.

iOS 8, Xcode 6 - Localization not working -

Image
i localized app , followed through several tutorials on setting localization. in target build info settings, have both english , spanish set base internationalization checked. i have localizable.strings file in project contain both english , spanish translations. and have 2 storyboards - 1 english , 1 spanish..for both iphone/ipad. auto layout enabled , have english , spanish checked in storyboard settings. when edit scheme run through debugger spanish - translations work perfectly. have ios device , simulator language set spanish , correct region files associated with. although when not running through xcode, app in english, regardless of whether or not device settings set spanish. i've deleted app, cleaned, rebuilt, , re-deployed both simulator , ios device. there still no change. know of else might missing? appreciated. after visiting ios dev forms, found answer. my problem localization set spanish (united states) while ios supports plain ol' spa...

php - Facebook Comment Count on Comments Plugin -

i run many news sites use facebook comments plugin, e.g. <script> (function(d, s, id) { var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) return; js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js#version=v2.3&xfbml=1&appid={appid}"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> this display comment plugin total count @ top, relative current site , not total comments on of facebook. number i'm looking get. now, want make widget on sites find top commented articles. i'm using ancient rest api this: $rest_url = "http://api.facebook.com/restserver.php?format=json&method=links.getstats&urls=".$allurls; $json = json_decode(file_get_contents($rest_url),true); where $allurls comma-separated list of article urls. however, comment_count returns total number of comments on fb. ...

What is a solution( In visual studio)? -

i read msdn solutions "contain items need create application". mean? mean contains code need create application? if that's case, why not call application? why not call application? because solution can contain many applications, many supporting libraries used applications, various artifacts used building , testing applications. solution may contain no application @ all, class library projects. think of solution container projects logically grouped in way, various artifacts may used projects. project in case may application, class library, set of database scripts, etc.

apache - Why do some Python packages work in CGI apps but not others? -

i trying write python script record sound when called browser. using xampp on macbook pro test server. pyaudio package using collect sound samples. ran installer , can import , utilize fine when script executed apache, import fails. can import standard packages fine however. when apache runs script: #!/usr/bin/env python # -*- coding: utf-8 -*- # enable debugging import sys import cgitb cgitb.enable() print "content-type: text/plain;charset=utf-8" print import pyaudio i error in browser: please build , install portaudio python bindings first. running in shell not problem. i have tried changing hashbang heading exact location of shell interpreter made no difference.

c# - How to add GPS data to metadata on windows phone 8.1 RT -

i making camera app in c# windows phone 8.1 rt , want add gps location metadata of taken picture. reading location data gps not problem. reading metadata (in case) image.jpg not problem. writing/editing data is, because fields readonly. take picture, saving: public async void take_picture() { imageencodingproperties format = imageencodingproperties.createjpeg(); format.width = resolutionwidth; format.height = resolutionheight; var imagestream = new inmemoryrandomaccessstream(); await capturemanager.capturephototostreamasync(format, imagestream); //some more code storagefile file = await knownfolders.pictureslibrary.createfileasync("nameofpicture.jpg", creationcollisionoption.generateuniquename); var filestream = await file.openasync(fileaccessmode.readwrite); await randomaccessstream.copyasync(imagestream, filestream); } read metadata. (these properties empty, properties can read picture.) private async void metaread_button_...

sql - Is there any alternate way to write this query? -

i have below tables shown below: table: employee 1.empname 2.empno 3.deptid table: department 1.deptid 2.deptname i need find "total number of employees in each department employee name": i have written query- select count(*) total, d.deptname, e.empname employee e join department d on e.deptid = d.deptid group d.deptname, e.empname; the above query works fine, wanted learn how can write query avoid including e.empname in group by clause, , still select it? is there alternative way accomplish using oracle database. if need find "total number of employees in each department employee name", can try subquery group join employee table distinct. sample sqlfiddle select distinct e.empname , t.deptname, total employee e join (select count(*) total, d.deptname, d.deptid employee e join department d on e.deptid = d.deptid group d.deptname, d.deptid) t on...

html - How to know when to put closing tag on nested elements -

i'm converting following xml html: <rule> <condition type="and"> <condition type="and"> <condition type="not"> </condition> </condition> </condition> </rule> from structure, can infer condition can have other condition's (or not last condition). i'm trying make same structure in html , not sure when/how/where put closing tags conditions have conditions inside of them. output i'm getting output above: <rule> <condition type="and"> </condition> <condition type="and"> </condition> <condition type="not"> </condition> </rule> here's xsl: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="html" /> <xsl:te...

arrays - Magento upgrade from 1.6.2 - php error when checking magento list-upgrades in SSH -

i'm using ssh upgrade magento 1.6.2 latest version. when enter command ./mage list-upgrades repeated lines of following before see upgrade results: php warning: array_combine(): both parameters should have @ least 1 element in /var/www/vhosts/mywebsitename/httpdocs/downloader/lib/mage/connect/rest.php on line 227 php warning: ksort() expects parameter 1 array, boolean given in /var/www/vhosts/mywebsitename/httpdocs/downloader/lib/mage/connect/rest.php on line 228 i have latest version of php installed (i think) , checked online find original rest.php script , looks identical. ideas?

swift - Two scenes sharing a different scene wont segue -

so have 2 different scenes in storyboard , both have tableview cell segues date picker scene. first scene built segue date picker scene works , has unwind segue. the second scene's segue wont fire when trying segue same date picker scene. has unwind segue. dont want have recreate scenes use them different segues. way around this? new ios , swift. the way got around use 2 done buttons on date picker scene because 1 button cant have 2 unwind methods. when segue 1 scene date picker scene send boolean in prepare segue. in date picker scene set done button.hidden boolean. essentially hiding , unhiding correct button can unwind correct segue.