Posts

Showing posts from February, 2014

javascript - Loading images upon scrolling -

suppose have python script dumps 1000 images on webpage, when user opens webpage, browser tries open of them @ once, slows down page. is there way make sure images loaded, lie in current field of view of user, somehow load them depending upon position of scroll bar ? we call design pattern lazy loading . there lots of plugins achieved it, such loading images scrolling. lazy load plugin jquery : lazy load jquery plugin written in javascript. delays loading of images in long web pages. images outside of viewport (visible part of web page) wont loaded before user scrolls them. opposite of image preloading. using lazy load on long web pages containing many large images makes page load faster. browser in ready state after loading visible images. in cases can reduce server load. you can go web page checkout full example , api.

java - Preserve edittext entry after pressing onOptionsItemSelected -

hello have reverse of this problem, entries disappear. i want retain entries in edittext after selecting menu button. here code. have pass intents if want preserve information? public boolean onoptionsitemselected(menuitem item){ switch(item.getitemid()){ case r.id.seesavedroutes: intent launchnewintent = new intent(mainactivity.this,savedroutes.class); startactivityforresult(launchnewintent, 0); super.onpause(); onpause(); return true; } return false; } you shouldn't explicit call onpause , called android system. android widgets save , restore state default (note: in order android system restore state of views in activity, each view must have unique id, supplied android:id attribute.). may save additional state (or state of views without id) in onsaveinstancestate , restore in oncreate(bundle) or in onrestoreinstancestate(bundle) . please, read: this , this

javascript - Plug in for turn.js in wordpress -

i want insert webpage in wordpress. created webpage in turn.js using javascript, css, html & jquery. turn.js link stored in local. want know how store turn.js link in wordpress. i want upload flipbook using turn.js in wordpress blog. working fine in local. plugin install in wordpress first have create template file not js file. can create new page , assign template page.also have upload necessary js , css file wordpress blog.

Printing information from perl arrays/hashes -

i trying access data returned api, cant correct values out of array, know api returning data dumper can print out on screen no problem. when trying print information array know print out receiving hash. sorry if confusing, still learning. using following code getting below output, foreach $hash (@{$res->data}) { foreach $key (keys %{$hash}) { print $key, " -> ", $hash->{$key}, "\n"; } } output stat -> hash(0xf6d7a0) gen_info -> hash(0xb66990) do of know how can modify above traverse in hashes? the bottom line of trying print out value array. please see dumper of array. print dumper(\$res->data); http://pastebin.com/raw.php?i=1dejzx2f the data trying print out guid field. i thought like print $res->data->[1]->{guid} but doesn't seem work, i'm sure i'm missing here , thinking more should, if point me in write direction or write me correct print , explain doing wrong great thank you ...

knockout.js - What is the purpose of config and shim in RequireJS -

i trying use requirejs knockout in mvc4 project . when started learning require js found following code @ many places . requirejs.config({ shim: { 'backbone': { deps: ['underscore', 'jquery'], exports: 'backbone' } } }); i need know why config block use . shim inside config , why use , benefits . thanks in advance . "shim: configure dependencies, exports, , custom initialization older, traditional "browser globals" scripts not use define() declare dependencies , set module value." http://requirejs.org/docs/api.html#config-shim meaning: backbone not support requirejs out of box, hence have define dependencies yourself.

php - create virtual subdomain from folder throught htaccess in shared hosting panel -

i want access www.domain.com/test test.doamin.com , many more test2.domain.com,test3.. creating virtual subdomain through htaccess. have tried , follow link no change found. think because have shared hosting , subdomains created cpanel. please provide complete guidance on it. i followed follwing links: https://forums.digitalpoint.com/threads/how-to-create-virtual-dymanic-subdomain-in-php-with-htaccess.1521742/ virtual subdomain htaccess how create virtual subdomain using htaccess? http://www.webmasterworld.com/apache/3638570.htm but still problem not solved. gives ooops not find.. i had same issue before, must use cpanel create subdomain. if remember right there dns issue code: rewritebase / rewritecond %{http_host} !^www\.domain\.com [nc] rewritecond %{http_host} ([^\.]+)\.domain\.com [nc] rewritecond %{request_uri} !^/index [nc] rewriterule ^(.*) http://domain.com/%1 [p] if don't want use cpanel creating wildcard domain entry such *.domain.com should h...

linux - Puppet - How to chage umask setting for the previlage user -

for changing umask setting , had created puppet script insert line "umask 0027" in file "/etc/profile" , doesn't show umask value 0027, when echo umask. when relogin show value 0027. take effect after relogin. but want immediate effect of change without relogin , added 1 more line puppet script "source /etc/profile" doesnot work , gave error below 'source /etc/profile' not qualified , no path specified. please qualify command or specify path. could me on issue ? my puppet file looks below exec {"modify-umask-entry": command => "sed -i 's/umask [0-9]\{3,\}/umask 027/g' /etc/profile", path => "/bin:/usr/bin/", } exec { "/bin/echo 'umask 027' >> '/etc/profile'": unless => "/bin/grep -fx 'umask[\t][0-9]{3}' '/etc/profile'", # onlyif => "/bin/grep -i 'umask[ \t][0-9]{3}' /etc/profile | wc -w...

jqplot - not able to replot the bar chart properly -

i have jqplot given below var s1 = [200, 600, 700]; var s2 = [460, -210, 690]; var ticks = ['center 1', 'center 2', 'center 3']; plot1 = $.jqplot('chart1', [s1, s2], { seriesdefaults: { renderer: $.jqplot.barrenderer, rendereroptions: { filltozero: true } }, axes: { xaxis: { renderer: $.jqplot.categoryaxisrenderer, ticks: ticks }, yaxis: { pad: 1.05 } } }); plot1.legend.show = false; when try replot graph setting plot1.series[0].data , plot1.series[1].data ploting "center 1" tick. could please me. you heading down right path: it when update plot1.series[0].data need provide array of data [[x,y],[x,y]] in format. think providing values right now. jsfiddle link var s1 = [260, 600, 700]; var s2 = [460, -250, 690]; var ticks = ['center 1', 'center 2', 'center 3']; plot1 = $.jqplot('chart1', [s1, s2], { seriesdefaults: { renderer: $.jqplot...

node.js - Winston doesn't pretty-print to console -

i'm trying winston pretty print console, stuck in file , ran node: var winston = require('winston'); winston.cli(); winston.data({ a: "test", of: "many", properties: { like: "this" } }); winston.data('data', { a: "test", of: "many", properties: { like: "this" } }); the terminal spit following (not pretty) messages: data: a=test, of=many, like=this data: data a=test, of=many, like=this i'm following instructions on winston readme ("using winston in cli tool"). misreading something? missing setting somewhere? i figured out answer (the documentation incorrect). if use constructor, , manually add transports, can set options, both winston, , individual transports. options need added winston directly, while others need added transport. e.g.: var winston = require('winston'); var logger = new (winston.logger)({ levels: { trace: 0,...

html5 - Want to make clickable cells of rows using jquery -

below code making rows clickable $(document).ready(function () { $('#mytabledata').on('click', 'tr', function() {alert('hello');}); }); but want first 2 cells of rows clickable , how can make it? try $(document).ready(function () { $('#mytabledata').on('click', 'tr td:first-child,td:nth-child(2)', function() { alert('hello'); }); }); demo: fiddle using :lt(2) not work if there more 1 row: fiddle if not want use event delegation $(document).ready(function () { $('#mytabledata tr').find('td:lt(2)').click(function () { alert('hello'); }); }); demo: fiddle

mysql - What's the syntax error in below PHP code? -

my sql query php file follows : $sql = " insert $this->mtablename(contact_list_name, contact_list_desc, "; $sql =." contact_list_created_date) value('".clean($form_data['contact_list_name']). "' "; $sql =." ,'".clean($form_data['contact_list_name'])."', unix_timestamp()) "; it's giving me following error: php parse error: syntax error, unexpected '.' in contactlist.php on line 60 i tried change many things didn't work me. can me in resolving syntactical error , building proper query? in advance. 1 more thing instead of values i'm using value preconfigured in system. there no issue word value. should $sql .= not $sql =. $sql .=" contact_list_created_date) value('".clean($form_data['contact_list_name']). "' "; $sql .=" ,'".clean($form_data['contact_list_name'])."', unix_timesta...

php mysql database connection in an array with port number -

in php doing connection mysql database in simple way this <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('could not connect: ' . mysql_error()); } echo 'connected successfully'; mysql_close($link); ?> but want more professional way of database connection in array (where variable in array) can use variable mysql port number within that. can kindly tell me how this? , suggestions appreciable. thanks.. for more professional, start worrying switching pdo. there tons of tutorials on it. same sql, different way of working it. beyond doesn't matter if it's array or separate variable if you're using globals procedural programming fine when needed. my main advice whenever need use db, use single configuration file include gather these variables, b/c many times when clean sites later have go hunting through 50 different files update connection strings. $dbconfig = arr...

cordova - PhoneGap ajax call fails everytime -

i developing mobile application using phonegap , , have access services project . using jquery-2.0.0.js , jquery-mobile-1.3.2.js . $.ajax({ url: 'http://localhost:62465/api/account?email=johndoe@yahoo.com', datatype: 'json', success: function (data) { alert(data.name); }, error: function (xhr, type) { alert("failed load data"); alert(xhr + " " + type); } }); this ajax call fails everytime. in config.xml have following line: <access origin="*" /> where might going wrong! the problem phonegap application requesting local file isn't webserver. local file delivered no http headers - means no "200 ok" header , no "404 not found" errors. so, status code assumed 0. straight javascript xhr need ignore status , perform action on readystate == 4 (finished , ready). this: ...

javascript - Raphael position element right and scale it there -

i have problem , couldn't find solution this. var sunsmallset = raf.paper.set(); var sunset = raf.paper.set(); raf.paper.importsvg(rafsvg.sunsmall(), sunsmallset); raf.paper.importsvg(rafsvg.sunfull(), sunset); sunsmallset.transform("t62, 62"); sunset.transform("t62, 62"); var anim = raphael.animation({transform: "s0.8 0.8"}, "2000", function(){ sunset.animate(animback); }); var animback = raphael.animation({transform: "s1 1"}, "2000", function(){ sunset.animate(anim); }); sunset.animate(anim); the upper transform used translate both suns position. with transform in animation try scale sun on current position. what happens sun moving 0, 0 position. here simplified example: jsfiddle.net/vx4c9 when have raphael element.transform documentation , you'll learn transformations using animations sets of cumulative operations performed on target, reset each time transform again. means once app...

html - Menu appears in reverse order -

i've been trying build navbar website using foundation. however, after i've tried items in menu bar appearing in reverse order. on right hand side, rather saying "portfolio contact" says "contact portfolio". ideas? html: <div id="header-container"> <div id="header" class="row"> <nav class="nav-bar"> <ul class="left"> <li data-slide="1" class="andrewgu"><a href="">andrewgu</a></li> </ul> <ul class="right"> <li data-slide="2" class="portfolio"><a href="">portfolio</a></li> <li data-slide="3" class="about"><a href="">about</a></li> <li data-slide=...

VBA Outlook Item Move -

i have hacked following piece of code in outlook 2007 vba judicious copying of others code sites this. not programmer, apologies in advance obvious failings. the routine monitors email on way out , asks user want file outgoing email. looks emails indentical conversation topic , files in same place. all works fine purposes, except bit files identical items. colitems returns correct number of emails in inbox , colfiltered returns correct number of emails identical conversation topic. unfortunately, if there are, say, 5 items in colfiltered, moves 3 of them, leaving 2 in inbox have manually filed. am missing obvious.? any appreciated. julian private sub application_itemsend(byval item object, cancel boolean) dim intres integer dim strmsg string dim save_mess dim await_replies_fldr folders dim objns namespace dim objfolder mapifolder 'variables select linked emails bit dim ofolder outlook.mapifolder dim colitems outlook.items dim colfiltered outlook.items dim oitem obj...

sql - Entity Framework Dynamic Lambda to Perform Search -

i have following entities in entity framwork 5 (c#) : orderline - id, orderid, productname, price, deleted order - id, customerid, orderno, date customer - id, customername on order search screen user can enter following search values: productname, orderno, customername for example might enter: product search field: 'car van bike' order search field: '100 101 102' customer search field: 'joe jack james' this should or search (ideally using linq entities) each entered word, example output following sql. (productname 'car' or productname 'van' or productname 'bike') , (orderno '100' or orderno '101' or orderno '102') , (customername 'joe' or customername 'jack' or customername 'james') i want using linq entities, guessing need sort of dynamic lambda builder don't know how many words user might enter each field. how go doing this, have had quick browse cant see s...

about file upload on PHP -

i have question file upload. this html source. <th scope="row">upload file</th> <td> <input id="file" name="file" type="file" title="lable text"> </td> here file properties. path : /www/temp/bulk_files type: folder location : ftp://anisfra@example.com//www/anisfra/www/partner/bulk_files what use that? also using set permissions here. @chmod('ftp://anisfra@example.com/www/anisfra/www/partner/bulk_files', 0777); but, doesn't work. what missing? <form action="" method="post" enctype="multipart/form-data"> <label for="file">filename:</label> <input type="file" name="file" id="file" /><br /> <input type="submit" name="submit" value="submit" /> </form> after file attribute echo "upload: " ...

functional programming - A bigger loop in Scala -

i'm using scala create program, hitting wall how many iterations loop can do. i'm still quite new when comes functional programming , programming in scala, have @ moment: val s = range(1, 999999999).view.foldleft(0)(_ + _ / whatever); but can't loop few orders of magnitude bigger 999999999, in max value of long. know use loop, cant see fold option that. anyone know how can achieved? thanks. as you've found, seqs cannot contain more int.maxvalue elements. until feature fixed, don't use seq. can 1) use while-loop 2) use for-loop without sequence but these ways can't use methods of scala collections foldleft in example. so need iterator . e.g. def bigiterator(start: bigint, end: bigint, step: bigint = 1) = iterator.iterate(start)(_ + step).takewhile(_ <= end) then bigiterator(0, bigint("3000000000")).foldleft(bigint(0))(_ + _) etc work. note: if don't need full range of bigint , use long instead it's f...

location - how to get lat and long in android -

i facing minor problem in code , getting stuck due it.following code:- public class mainactivity extends activity { textview textview1; location currentlocation; double currentlatitude,currentlongitude; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview1 = (textview) findviewbyid(r.id.textview1); findlocation(); textview1.settext(string.valueof(currentlatitude) + "\n" + string.valueof(currentlongitude)); } public void findlocation() { locationmanager locationmanager = (locationmanager) .getsystemservice(context.location_service); locationlistener locationlistener = new locationlistener() { public void onlocationchanged(location location) { updatelocation(location,currentlatitude,currentlongitude); toast.maketext( mainactivity.this, ...

jquery wordpress template path -

need little bit of jquery. im bit of noob jquery wise. i got template_dir in var: $('#someid').click(function() { var templatedir = '<?php bloginfo("template_directory") ?>'; if(autostart) { $(this).html('<img src=" 'templatedir here' /images/pauze-play.png" />'); } else { $(this).html('<img src=" 'templatedir here' /images/pauze-play.png" />'); } autostart = !autostart; $('#mainslider.royalslider').royalslider('toggleautoplay'); }); i did stackoverflow searches , tried figure out ain't working due lacking skills, though feel rather simple. thought this: <img src=" 'templatedir +' /images/pauze-play.png" />' but no... thanks in advance /paul the code danyo poste work fine, on route chose defining templatedir javascript variable have : $(this).html('<img src="...

python - Serve static files through a custom handler or register in app.yaml? -

in project i'm developing i'm using several python projects dependencies. these projects each come static files (javascript, images, etc.) , set of handlers (with default urls). register urls handlers add them routes in wsgi application. static files need registered in app.yaml. avoid becomes breeze register both handler urls , static files. i thought implementing request handler takes file location , serves http cache (like think default static handlers do). i've discussed idea colleague , thought bad idea. told me when registering static files in app.yaml files served in more optimized way (possibly without python). before go , implement static handler i'd hear pros/cons of both methods , if static handler idea idea. in current projects let buildout generate app.yaml template. static files added there. (obvious) downside process error prone (if done automatically) or redundant (if done manually). use static handler: you don't need startup i...

java - DOM parser, why do I get just one child of an element? -

my question "dom parser, why 1 child of element?" i looked this , this one, not point. what i'm trying following: i have xml file (see extract below) : <poitem> <item> <po_item>00010</po_item> <short_text>item_a</short_text> <matl_group>20010102</matl_group> <agreement>4600010076</agreement> <agmt_item>00010</agmt_item> <hl_item>00000</hl_item> <net_price>1.000000000</net_price> <quantity>1.000</quantity> <po_unit>ea</po_unit> </item> <item> <po_item>00020</po_item> <short_text>item_b</short_text> <matl_group>20010102</matl_group> <agreement>4600010080</agreement> <agmt_item>00020</agmt_item> <hl_item>00000</hl_item <net_price>5.000000000</net_price...

string as variable name in javascript -

this question has answer here: javascript “variable variables”: how assign variable based on variable? 3 answers i have array of objects : recs6 , recs7 , recs8 ...... recs23 . want add factor in array using inner for loop. 'recs+n' interpreted string , not variable name. how can make represent existing variables - rec6 , rec7 etc? for(var n=6; n<24; n++){ for(var m=0; m<'recs+n'.length; m++){ hourbusyness += parsefloat(('recs'+n)[m].gtse); } houravgbusyness = hourbusyness / ('recs'+n).length; console.log(houravgbusyness); } use this['recs'+n] instead of ('recs'+n)

javascript - IEWebGL IE acts strange -

i developing webgl web application , i'm using iewebgl plugin display 3d model ie. however, ie acts strange. example - on laptop, 3d model displays , renders both on ie9 , ie10. , when try access model other machine in room - displays error, says 'error occurs during webgl context creation: [can't initialize egl]'. both machines running windows 7. other browsers run without problems. i've tried on several machine's ies , of them display correct, while other don't. i've tried updating video card drivers didn't help. thanks in advance.

ajax - jquery does not deliver paramater to the controller function -

i have following lines of jquery code in codeigniter view file gets form field values , sends them add_emp_performance function in employees controller. var emp_id = "<?php echo $this->uri->segment(3); ?>"; var title = $("#title").val(); var date = $("#date").val(); var url = "<?php echo base_url().'index.php/employees/add_emp_performance/';?>"+emp_id; //alert(emp_id); ---> works fine //alert(url); ---> works fine $.ajax({ type: "get", //type: "post", url: url, //data: 'emp_id='+emp_id+'&title='+title+'&date='+date, success: function(r){ if(r==1){ alert("performance saved!"); }else{ alert("error!"); } } }); controller employees function add_emp_performance : function add_emp_performanc...

c# - Displaying an image based on value in XAML -

this question has answer here: bind icon depending on enum in wpf treeview 3 answers how can display image based on value in xaml? i have gender enumeration [datacontract(name = "gender")] public enum genderenum { [enummember] notspecified, [enummember] male, [enummember] female, } at model class have property of enumeration type called "gender". want display image based on value of "gender" via xaml side. xaml: <image tag="{binding gender}" width="48" height="48"> <image.style> <style targettype="image"> <style.triggers> <datatrigger binding="{binding gender}" value="male"> <setter property="source" value="/resources/client_male.png...

How does SVN 1.8 merging compare with DVCS like Git & Mercurial? -

i asked question 3 years ago: how and/or why merging in git better in svn? back think on svn 1.6 we've reached 1.8 , seems merging 1 area they've done substantial work on. so in light of these changes, has svn 1.8 caught better merging , branching support in dvcs git? svn 1.8 seem have advanced things 'reingtegration' being automatic action . don't have dance keep branch alive after it's been merged more. these real annoyances me, , it's they're gone. the thing svn merging seems have problems handling of mergeinfo records. if you're not aware, these properties added points in tree when merge done. record versions ancestors of merged version, when merge done changes in versions aren't re-merged. unfortunately svn seems confused , i've see apply changes multiple times. think there's fundamental flaw way records it's merged, i've never been able work out what's gone wrong. fact branching , merging aftert...

coordinate systems - how to display georeferenced image in matlab GUI? -

i have gui goal show multispectral satellite image. import image follow: [img, r] = geotiffread('myimage.tif'); thus have coordinate of 4 corner(r). wonder how display coordinate in gui , value of coordinate when click on image? command use is: imshow(img); should use command mapshow? final gui should mapview that show coordinate , scale of image below it. able show frame coordinate in static text box have problem real coordinate. many many thanks ok unfortunately after month nobody answered me found answer. it simple. pix2map function matlab's "mapping toolbox" converts pixel coordinate map coordinate. that took.

common lisp - How to utilize the SBCL provided semaphore against race conditions -

as far knowledge semaphores goes, semaphore used protect resources can counted , vulnerable race conditions. while reading sbcl documentation of semaphores not figure out, how use provided semaphore implementation protect resource. a usual work flow, recall be: a process wants retrieve of semaphore protected data (which sake of example trivial queue). semaphore counter 0, process waits another process puts in queue , semaphore incremented, signal sent waiting processes given possibility of interleaving, 1 has protect of resource accesses might not in order, or linear order @ all. therefore e.g. java interprets each class implicit monitor , provides syncronized keyword programmer can define protected area can accessed 1 process @ time. how emulate functionality in common-lisp, pretty sure current code thread safe without semaphore, semaphore has no clue code protect. ;;the package (defpackage :tests (:use :cl :sb-thread)) (in-package :tests) (defclass thread-queue (...

How to compare a system date with the date from MySQL database in php -

i want compare system date date mysql database , comparison should if system date has diffrence of 10 days date table's date. for e.g. sytem date: 2013-7-31 , table's date 2013-8-10 should echo msg "10 days left renewal." i know how add days date in php have no idea of how should compare these two. $mydt = date("y-m-d"); $alertday = date('y-m-d', strtotime($mydt. " + 10 days")); just convert db table time normal unix timestamp subtract , divide number seconds in day $now = time(); $dbtime = strtotime($tabledate); $daysleft = ($now-$dbtime) / ( 60*60*24);

Visio 2010 - How to show page number for Off-page reference shape? -

i‘m making logic-diagrams in visio 2010 , using off-page reference link between pages. show on off-page reference shape page number reference to. means if there reference page 1 page 3 visio automatically show “page 3” on shape @ page 1 , vise-verse. there have solution problem? you can try clicking on off page reference shape once (just it's selected, if double click it'll take off page reference) , start typing "page 1". doesn't it's selected , ready type b/c border selected it'll work.

wcf - Parsing SoapObject Responst in android -

my code is: public class mainactivity extends activity implements onclicklistener { button b; private static string namespace = "http://tempuri.org/"; private static string method_name = "getlist"; private static string soap_action = "http://tempuri.org/iwcfmasterrole/getlist"; private static string url = "http://172.16.0.1:55355/wcfmasterrole.svc"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); b = (button) findviewbyid(r.id.button1); b.setonclicklistener(this); } @override public void onclick(view v) { if (v.getid() == r.id.button1) { new myclass().execute(""); } } class myclass extends asynctask<string, void, soapobject> { soapobject result; @override protected soapobject doinbackground(string... params) { try { soapobject request = new soapobject(namespace, meth...

proxy - nginx proxypass with multiple locations -

i try setup nginx such proxies requests multiple locations. e.g. /location1 , /location2 should both proxied http://localhost:8080 . can't figure out how configure without using multiple location blocks. tried: location /(location1|location2) { proxy_pass http://localhost:8080/ } which give 404s. , i've tried: location ~ /(location1|location2) { proxy_pass http://localhost:8080/ } which thrown error regular expressions not allowed proxy pass. is possible configure proxy without having create multiple location blocks? apparently missing slash , ';'. try this: location ~ (/location1|/location2) { proxy_pass http://localhost:8080; }

Java: Receive answer from Windows Azure Service Bus Queue -

i'm trying implement request response queue using windows azure service bus queue. created 2 queues: request , response. my client side send message request queue, server side take message request queue, , put response response queue. client side check response queue if there messages. when run 1 client it's working fine. when run more 1 client, after time clients side don't pull off message response queue. queue sure isn't empty, because client side check how many messages there. for receiving message use: receivemessageoptions options = receivemessageoptions.default; options.setreceivemode(receivemode.peek_lock); options.settimeout(20); receivequeuemessageresult resultqueuemessage = service.receivequeuemessage(responsequeuename); brokeredmessage receivedmessage = resultqueuemessage.getvalue(); any appreciated, asia the clients locking messages never deleting them. as described in how use service bus queues : ...

xmpp - Can't get user online on Openfire through WebSockets and strophe-openfire.js -

i trying make real-time chat using html5, websockets, strophe-openfire.js library ( https://code.google.com/p/openfire-websockets/source/browse/trunk/src/ofchat/js/strophejs/src/strophe-openfire.js ) , openfire server. use code snippet make connection: function connecthandler(cond) { log("connected"); connection.send($pres()); } var url = "ws://localhost:7070/ws"; connectbutton.onclick = function() { var username = document.getelementbyid("username").value; var password = document.getelementbyid("password").value; var connection = new openfire.connection (url); connection.connect(username, password, connecthandler); } i see on openfire admin console in client sessions tab user "authenticated" still offline. on chrome console see response openfire 101 switching protocols , appropriate headers nothing more. so question can cause connection.send($pres()) doesn't work , how send p...

jquery - How to make resizable Fancybox v2 image and border change size together? -

i'm trying create resizable fancybox v2 window using jquery ui. the thing happens - change image size or border size separately. html: <a rel="gallery" title="image" class="fancybox" href="http://fancyapps.com/fancybox/demo/2_b.jpg"><img src="http://fancyapps.com/fancybox/demo/2_s.jpg" alt=""/></a> resizable image: http://jsfiddle.net/g2pjr/ js: $(".fancybox").fancybox({ arrows: false, autoresize: false, aftershow: function () {$('.fancybox-image').resizable();} }); resizable border: http://jsfiddle.net/hrvka/ js: $(".fancybox").fancybox({ arrows: false, autoresize: false, aftershow: function () {$('.fancybox-skin').resizable();} }); how force image change size border? jquery ui resizable widget includes alsoresize option bind resizable .fancybox-wrap selector , alsoresize .fancybox-inner , .fancy...

jquery - Why does quicksand get image positions wrong? -

i've got quicksand set sort list, can see demo here (this drupal site developing locally, had make static html page things don't quite right, can see issue): website if make browser's width 1090px (on actual site issue happens across broader range of resolutions, on demo seems happen @ 1090px - @ least in chrome) , click "all" you'll notice images wobble little bit, when should not move @ all. how can fix this? don't forget add "position: relative;" parent container. in case: <div class="mm_quicksand_container"> this div should have "position: relative;" on it. should rid of little wobble/hitch see when finishes animating.

c# - Moving Picturebox on a Grid is inaccurate because Mouse Positions are inaccurate -

i have application put pictureboxes on panel. after implemented drag&drop pictureboxes, wanted add grid option conviniently move pictureboxes on panel. code used is private void pb14_mousemove(object sender, mouseeventargs e) { if (e.button == mousebuttons.left) { if (grid) { if (mouseposition.x % 10 == 0) { pblist[14].location = new point(plist[parent].pointtoclient(new point(mouseposition.x, mouseposition.y)).x, pblist[14].location.y); } if (mouseposition.y % 10 == 0) { pblist[14].location = new point(pblist[14].location.x, plist[parent].pointtoclient(new point(mouseposition.x, mouseposition.y)).y); } } else { ... } } } plist list of panels, plist[parent] parent in picturebox (out of pictureboxlist) pblist[14] is. the ...

jquery - javascript change color of textbox -

i have code wont work. problem be? syntax wrong or whole method wrong? <input checked="checked" class="form-field" id="iscurrentlysmokingrightnej" name="iscurrentlysmokingright" type="radio" value="nej"> <input class="form-field" id="iscurrentlysmokingrightja" name="iscurrentlysmokingright" type="radio" value="ja"> <input id="iscurrentlysmokingrighttextbox" name="iscurrentlysmokingright" type="text" style="background-color: rgb(0, 255, 0); float: right; width: 50px;"> javascript: $(document).on("change", "iscurrentlysmokingrightnej", function() { var elem = document.getelementbyid("iscurrentlysmokingrightnej"); var ele = $("#iscurrentlysmokingrighttextbox"); if (elem.checked) { ele.css("background-color", "rgba(0, 255, 0, 1)");...

python - Plotting surface of implicitly defined volume -

having volume implicitly defined x*y*z <= 1 for -5 <= x <= 5 -5 <= y <= 5 -5 <= z <= 5 how go plotting outer surface using available python modules, preferably mayavi? i aware of function mlab.mesh, don't understand input. requires 3 2d arrays, don't understand how create having above information. edit: maybe problem lies unsufficient understanding of meshgrid()-function or mgrid-class of numpy. see have use them in way, not grasp purpose or such grid represents. edit: i arrived @ this: import numpy np mayavi import mlab x, y, z = np.ogrid[-5:5:200j, -5:5:200j, -5:5:200j] s = x*y*z src = mlab.pipeline.scalar_field(s) mlab.pipeline.iso_surface(src, contours=[1., ],) mlab.show() this results in isosurface (for x*y*z=1) of volume though, not quite looking for. looking method draw arbitrary surface, "polygon in 3d" if there such thing. i created following code, plots surface (works mayavi, too). need modify code part...

c++ - Mex compilation macro -

i wish include header file when code compiled via mex command in matlab. if it's compiled directly visual studio not want included. is there macro can that? i'd of sort: #ifdef mex_compile_flag #include "mexdependent.h" #end you can use macro matlab_mex_file this. mex.h work properly, macro must defined if , if compiled object linked mex file. mex command makes sure define when calls compiler.

javascript - jQuery .toggle() equivalent in Google Closure -

i rewriting of javascript files rid of jquery , use google closure instead. have got date picker user can toggle show or hide. @ moment following code being used: if (this.open == open) return false; $(this.eldatepicker).toggle(open); this.open = open; return true; where el.datepicker element date picker inside, in case div. i looking way rewrite piece of code change jquery google closure. idea's how should possible? you should able do goog.style.showelement(this.eldatepicker, !goog.style.iselementshown(this.eldatepicker)); source: google closure style.js doc

jquery mobile radio button onchange event does not fire -

i have implemented jquery mobile shopsystem generates different radio buttons payment methods this: <input type="radio" name="newmethodofpayment" onchange="openwaitscreen();jquery('#theform').submit();return false;" value="1000" title="paypal" checked="checked" id="paymentmethod1000"> by testing desktop browsers works fine when choosing different payment methods when using iphone, example, page reloads , checked radio button not checked. i don't it. makes me crazy.

c# - How to get HttpRequestMessage data -

i have mvc api controller following action. i don't understand how read actual data/body of message? [httppost] public void confirmation(httprequestmessage request) { var content = request.content; } from this answer : [httppost] public void confirmation(httprequestmessage request) { var content = request.content; string jsoncontent = content.readasstringasync().result; }

batch file - copy specific value from text1 to text2 by dos -

i need copy specific value text1 text2 dos batch. text1 that; 20130701,xxxx,xxxx,xxx 20130702,yyyy,yyy,yyyyyyy i want copy "20130701" line text1 text2 , using dos command. help. this create text2.txt lines text1.txt start 20130701 findstr "^20130701" <"text1.txt" >"text2.txt" original answer below: set text1=20130701,xxxx,xxxx,xxx set text2=20130702,yyyy,yyy,yyyyyyy set text3=%text1:~0,8%%text2:~8% echo %text3%

PayPal guest payments outside US -

i need process payments customers have credit cards, not paypal account - , need not required sign paypal either. have found in docs far, seems need so-called adaptive payments that. work rest api , can outside (i live in austria)? both paypal payments standard , paypal express checkout support guest transactions; don't need adaptive payments this. i suggest take @ express checkout documentation , including getting started guide have available.

XOR encryption Javascript and PHP fails with some keys -

i'm trying crypt/decrypt $session_key string, generated random function, in php , javascript. works not strings. $session_key, in example, result it's different. can see result opening browser console. <?php function xor_this($str, $key) { $result = ''; ($i = 0; $i < strlen($str); $i++) { $tmp = $str[$i]; ($j = 0; $j < strlen($key); $j++) { $tmp = chr(ord($tmp) ^ ord($key[$j])); } $result .= $tmp; } return $result; } #session_key generated substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"), 0, 40) $session_key = 'h9pyae6kcex5g7081snjcfbpvfux3brtmdydwwhq'; $password = '9b06a9342b5ac4a825088a0f0c2a2e7cc091393f'; echo xor_this($session_key, $password); ?> <html> <script> function xor_this(str,key) { var xor = ""; (var = 0; < str.length; ++i) { tmp...

Is there an eval() equivalent in apex/Salesforce? -

i've looked this, , seems there no directly related function available since apex typed, wondering if had found workaround. i'm designing credit risk object , client wants able insert expressions such "150 + 3" instead of "153" when updating fields speed things on end. unfortunately, i'm new salesforce, i'm having trouble coming ideas. feasible? you allow hand-entering of soql statements , use dynamic soql process them. require bit more "150 + 3." otherwise in javascript , pass value apex calculated number.

c# - Issue with AppDomain.CreateInstanceFromAndUnwrap -

i'm using appdomain.createinstancefromandunwrap() create object in different appdomain . couldn't work because kept throwing following error @ me: could not load file or assembly 'comon, version=2.0.4960.27874, culture=neutral, publickeytoken=null' or 1 of dependencies. module expected contain assembly manifest. however, found because tries load dll (which has same name .net assembly). this how call method: _script = (script)_appdomain.createinstancefromandunwrap(assembly.getexecutingassembly().location, "comon.scripting.script"); it works fine long there isn't native dll file same name .net assembly. why happen when i'm passing full path , filename of .net assembly? when i'm passing full path , filename of .net assembly? that's not how method works. first argument display name of assembly. not file name. msdn article recommends take @ assembly.fullname learn more display names. so normal clr search rules...

taking first column of one file and making it the first column of a second file in perl or unix -

examples: file 1 : contig01 contig02 contig03 contig04 file 2: (tab delimitated) 9.8 5.4 5.7 8.7 5.6 4.5 6.4 4.6 3.4 4.3 2.4 4.5 3.4 3.6 6.5 3.5 i want file merges them get contig01 9.8 5.4 5.7 8.7 contig02 5.6 4.5 6.4 4.6 etc the files in same order thanks you want paste command. $ cat <<eof >file1 > contig01 > contig02 > contig03 > contig04 > eof $ cat <<eof >file2 > 9.8 5.4 5.7 8.7 > 5.6 4.5 6.4 4.6 > 3.4 4.3 2.4 4.5 > 3.4 3.6 6.5 3.5 > eof $ paste file1 file2 contig01 9.8 5.4 5.7 8.7 contig02 5.6 4.5 6.4 4.6 contig03 3.4 4.3 2.4 4.5 contig04 3.4 3.6 6.5 3.5

php - Upload file doesn't save to specify folder, throw error -

the error warning: move_uploaded_file(uploads/cv/23456543555555curriculum vitae.doc): failed open stream: no such file or directory in c:\wamp\www\job-application\include\application.class.php on line 121 warning: move_uploaded_file(): unable move 'c:\wamp\tmp\php7ea1.tmp' 'uploads/cv/23456543555555curriculum vitae.doc' in c:\wamp\www\job-application\include\application.class.php on line 121 the code follows below; $allowedextsdoc = array("docx", "pdf", "doc"); $temp = explode(".", $_files["file"]["name"]); $extensiondoc = end($temp); $uploaddircv = 'uploads/cv/'; $uploadfilecv = $uploaddircv . basename($phone.$_files['file']['name']); if (in_array($extensiondoc, $allowedextsdoc)) { if ($_files["file"]["error"] > 0) { ...

visual studio 2012 - Porting old Code to Cocos2d-x rc0 2.1.3 giving error -

i have old code. porting new cocos2d-x rc0 2.1.3 .it giving me errors in following lines: 1. in gamescene.cpp ccscene *scene = ccscene::node(); gamescene *layer = gamescene::node(); 2. in gamescene.cpp userpaddle_->runaction(ccmoveto::actionwithduration(0.3 * diffx / gamearea_.size.width, destposition)); 3. in gamescene.cpp ccpoint location = touch->locationinview(touch->view()); 4. in gamescene.cpp if (ccrect::ccrectcontainspoint(toucharea_, location)) 5. in gamescene.cpp if (ccrect::ccrectintersectsrect(ballrect, cc_sprite_rect(paddle))) 6. in appdelegate.cpp pdirector->setopenglview(&cceglview::sharedopenglview()); 7. in gamescene.h // implement "static node()" method manually layer_node_func(helloworld); for full list of cocos2d-x api changes, please refer http://www.cocos2d-x.org/projects/cocos2d-x/wiki/api_change_list_from_v1x_to_2x and http://www.cocos2d-x.org/projects/cocos2d-x/wiki/about_static_constructo...

sql server - Error: No process is on the other end of the pipe -

i'm using sql server 2012 (localhost only) , sql server management studio (ssms) view table picture contains binary values (pictures), 928 rows in size not large. , table has problem. it shows below error, both locally , pc, after restarting sql server: msg 233, level 20, state 0, line 0 a transport-level error has occurred when receiving results server. (provider: shared memory provider, error: 0 - no process on other end of pipe.) i start checking consistency of data. run dbcc checkdb against db. may have corruption in table. can try selecting against msdb.dbo.suspect_pages

Magento: How to filter a collection (sales/order) by a certain category? -

i spend lot of hours solve problem, don't :( need selection of ordered items special category. how can filter collection e.g. categoryid '44' ? here code: <?php require_once '/home/web/public_html/app/mage.php'; mage::app(); //$_category = mage::getmodel('catalog/category')->load($category_id); $salescollection = mage::getmodel("sales/order")->getcollection(); echo $salescollection->getselect(); foreach ($salescollection $order) { $items = $order->getallitems(); ... ?> thanks helping me, best, rik here's 1 (perhaps) not elegant approach doing so... first grab products in category want $category_id = 44; $category = mage::getmodel("catalog/category")->load($category_id); $products = mage::getmodel("catalog/product")->getcollection() ->addcategoryfilter($category); next collect product ids can use them $product_ids = array(); foreach ($products $product) $produc...

urllib - Python: Traceback namerror -

traceback <most recent call last>: file "wexec.py", line 37, in <module> urlopen = urllib.urlopen('%xs' % (hcon)) nameerror: name 'hcon' not defined i problem doing code in python: def hell(): hcon = raw_input(fore.red + style.bright + "website: ") h1 = httplib.httpconnection('%s' % (hcon)) urlopen = urllib.urlopen('%s' % (hcon)) hell() as can see, don't see problem @ all. giving error. do?

java - Hadoop Streaming Memory Usage -

i'm wondering memory used in following job: hadoop mapper/reducer heap size: -xmx2g streaming api: mapper: /bin/cat reducer: wc input file 350mbyte file containg single line full of a 's. this simplified version of real problem we've encountered. reading file hdfs , constructing text -object should not amount more 700mb heap - assuming text use 16-bit per character - i'm not sure imagine text uses 8-bit. so there these (worst-case) 700mb line. line should fit @ least 2x in heap i'm getting out of memory errors. is possible bug in hadoop (e.g. unaccary copies) or don't understand required memory intensive steps? would thankful further hints. the memory given each child jvm running task can changed setting mapred.child.java.opts property. default setting -xmx200m , gives each task 200 mb of memory. when saying - input file 350mbyte file containg single line full of a's. i'm assuming file has single line ...

c# - Why the backgroundworker cancel button dosent cancel the backgroundworker operation? -

i added 2 lines in top of form1: backgroundworker1.workerreportsprogress = true; backgroundworker1.workersupportscancellation = true; in button click event start added: timer2.enabled = true; if (this.backgroundworker1.isbusy == false) { this.backgroundworker1.runworkerasync(); } this dowork event: private void backgroundworker1_dowork(object sender, doworkeventargs e) { backgroundworker worker = sender backgroundworker; if (worker.cancellationpending) { e.cancel = true; return; } if (filescontent.length > 0) { (int = 0; < filescontent.length; i++) { file.copy(filescontent[i], path.combine(contentdirectory, path.getfilename(filescontent[i])), true); } } windowsupdate(); createdriverslist(); gethosts...