Posts

Showing posts from January, 2012

javascript - Alternative to setTimeout for images -

if want create div high (responsive) image using javascript, resorting settimeout. example might have code this settimeout(function(){ var $imgheight = $('img').height(); $('.mydiv').height($imgheight); }, 400); is there alternative this? know imagesloaded plugin, there simpler alternative? many thanks you can use load event know when images loaded: $('img').on('load', function(){ $('.mydiv').height(this.height); }); http://jsfiddle.net/083d89me/ though don't see need set divs height. doesn't adjust image height default?

css3 - Can we make our webpage open defaultly in landscape mode for mobile/tablets using media query/js/jquery? -

is possible make web page open default in landscape mode in mobile or tablet if orientation of screen off using css3 media query or jquery ?? you this. wether idea or not i'll let decide (hint: isn't). check portrait orientation css , rotate body if necessary: @media screen , (orientation:portrait) { body { transform: rotate(-90deg); transform-origin: 50% 50%; } rotating body in way not cause it's width , height update suit it's new orientation have correct jquery: function checkorientation() { var winwidth = $(window).width(); var winheight = $(window).height(); if (winheight > winwidth) { $('body').width(winheight).height(winwidth); // swap width , height of body if necessary } } checkorientation(); // check orientation on page load // check orientation on page resize (mainly demo it's unlikely tablet's window size change) var resizeend; $(window).resize(function(){ cleartimeou

clickable list of divs in html/css -

i want make horizontal list of divs clickable. got this: <div id="header"> <a href="/"></a> <ul id="list"> <li id="column1"> <div></div> </li> <li id="column2"> <div></div> </li> </ul> </div> styles: #header { height: 200px; width:500px; } a{ display: block; width: 100%; height: 100%; } the problem is,an "a" element not in same place list, , want list cliackable. if want clickable on page use javascript event listeners not anchor tags. when want element clickable add event listener click action on client code , define behaviour of object. use anchor tags if object's behaviour link place. this make code cleaner , easier read, easier place every object want be.

jquery - how to mantain mouseover / hover on a concealed div -

i trying combine 2 effects on grid of images, 1 image grows within frame when mouse hovers on , reverts when mouse leaves frame, , semi-transparent div appear on image links other places. the code using image zoom here: $(function () { //the size of image when hovered over, 200/0/0 $('#container img').hover( function () { var $this = $(this); $this.stop().animate({ 'opacity': '1.0', 'height': '500px', 'top': '-66.5px', 'left': '-150px' }, //this following number defines speed of animation enlargement ( in ms) 20); }, function () { //the size of image when left alone var $this = $(this); $this.stop().animate({ 'opacity': '0.5', 'height': '400px', 'top': '-66.5px', 'left': '-150px' }, //this following number defines sp

java - AlarmManager fires alarm in the wrong time if timezone is different than GMT(UTC) -

i know question asked billion times, , have tried make use of answers can't seem work expect to. i'm having trouble setting alarms via alarmmanager - seems working fine utc ( or gmt -whatever prefer), when comes other timezones alarms not fired @ right time. if set alarm @ 12:00 if timezone (+2) fires @ 14:00, 2 hrs late. here's snippet: //todays date in seconds long current = (system.currenttimemillis()/86400000)*86400; long time =current + 43200; alarmmanager.set(alarmmanager.rtc_wakeup, time*1000, operationbroadcast); the time on device 6:42 here's i've found in alarmmanagers "dump" file rtc_wakeup #10: alarm{420f49b8 type 0 com.pocketenergy.androidbeta} type=0 when=+7h17m37s418ms repeatinterval=0 count=0 operation=pendingintent{420f3b20: pendingintentrecord{420f4808 com.pocketenergy.androidbeta broadcastintent}} as far i've read on several places time should set in utc whatever ti

How to display date picker dialog box extends from linear layout view in android -

i making custom view extend linear layout. here want display date picker when click getdate button. how this? public class xmltest extends linearlayout implements onitemselectedlistener, ondatesetlistener{ date = calendar.getinstance(); btndate.setonclicklistener(new button.onclicklistener() { @override public void onclick(view v) { datepickerinput=v.getid(); (int d = 0; d < mlistdatetimebutton.size(); d++){ if (listdatetimebutton.get(d).getid() == v.getid()){ showdatedialog(etlocationtest, date); } } } }); } protected void showdatedialog(edittext etlocationtest2, calendar date2) {

how to replace variables like two-third, one-fifth, two-hundreth number form using java -

i want take input in name form two-third or one-fifth , want system convert numerical form , give answer. que: two-third of thirty is? the system should output 20 how can program it? as general problem natural language processing (nlp) - you're talking - difficult open-ended problem. there lots of libraries stuff. if want background here: is there natural language processing library or natural language processing in wikipedia. however said want , you're new programming. first thing need break problem down. that's how solve programming problems. so first try writing program can read string containing single word , map number. example "one" outputs 1, "two" outputs 2, "thirty" outputs 30. next try , write program cuts string constituent words. want use array here. that's process called tokenizing , java has built in stringtokenizer that. might want code yourself, you're learning , might moment start learn

django - Search criteria language parser in Python? -

i writing web app django , djangorestframework internal app school. replacement old homegrown app written in microsoft access 2003. 1 of functionalities users have able search field (e.g. donation_amount in donation table) not exact amount query such this: < 130 , > 125 access allows sort of functionality , useful, unaware of way implement without inserting queries directly sql (extremely dangerous) or using eval in python expression (even more dangerous). are there libraries or sub-languages permit this? i'm not familiar django's ecosystem, python standard library contains ast.parse , parses valid python expression string , produces abstract syntax tree, can dissect , translate query - or serie of function calls, or whatever need. if can't find more specific, might of use. this code: ast.parse('donation_amount < 130 , donation_amount > 125') returns following ast structure: ast.module( ast.expr([ ast.boolop(ast.and(),

transactions - Progress 4GL support for SetPoint in Oracle -

i have been working on issue need reduce record locking time particular transaction. read abl transaction control mechanism openedge doc's , having simple mechanism when transaction complete abl send commit signal oracle else send rollback signal oracle. wanted know there provision in abl use setpoint concept of oracle, can rollback transaction point only. no - progress either commits tx or rolls completely.

visual studio - SQL View is not showing up in LightSwitch HTML client project -

Image
i use view instead of table data item in screen , view not showing in data source->applicationdata in my solution explorer . so, of course not showing in data item list during screen editing. i using latest ide version: ms visual studio professional 2013, verison 12 update 4. what did a) created test table (the code show lightswitch did, used solution explorer create table) create table [dbo].[testpersons] ( [id] int identity (1, 1) not null, [name] nvarchar (255) default ('') not null, [rowversion] rowversion not null, primary key clustered ([id] asc) ); b) created test view (i used sql server object explorer this) create view [dbo].[testpersonview] select id, name [testpersons] -> added test data on sql server object explorer , shown correctly. i tried this ° explicit cast ( lightswitch datasource views missing list ) create view [dbo].[testpersonview] select distinct cast(id int) id,

PHP equivalent of JavaScript bind -

first excuse english i'm not native speaker , sorry if looks rough, first time post on site. problem quite simple think. let's say, have : class { function foo() { function bar ($arg){ echo $this->baz, $arg; } bar("world !"); } protected $baz = "hello "; } $qux = new a; $qux->foo(); in example, "$this" doesn't refer object "$qux". how should make reffer "$qux"? as might in javascript : bar.bind(this, "world !") php doesn't have nested functions, in example bar global. can achieve want using closures (=anonymous functions), support binding of php 5.4: class { function foo() { $bar = function($arg) { echo $this->baz, $arg; }; $bar->bindto($this); $bar("world !"); } protected $baz = "hello "; } $qux = new a; $qux->foo(); upd: however, bindto(

java - My program is not working properly -

i have following code in java overflows when shouldn't. why? public classo { public static void main(string[] args) { int big = integer.max_value; system.out.println("big = " + big); long bigger = big + 2; system.out.println("bigger = " + bigger); } } i output: big = 2147483647 bigger = -2147483647 why overflow? have defined bigger long. wrong? big+2 overflow big max. value while (long) big not long bigger = (long) big +2 will work treat big long instead of integer. so make cast of float it.

ios - Map rotation horribly slow on ios8 -

i got following code in vc in old project (no storyboard, pure code) : - (void)viewdidload { [super viewdidload]; self.mapview = [[mkmapview alloc] initwithframe:cgrectinset(self.view.frame, 10, 10) ]; [self.view addsubview:self.mapview]; self.view.backgroundcolor = [uicolor redcolor]; self.mapview.autoresizingmask = uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexiblebottommargin | uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth; self.view.translatesautoresizingmaskintoconstraints = no; // <--- line } if comment last line, rotation portrait landscape or other way 3 seconds under ios8 !! also, @ random times unable allocate render buffer storage! errors appear. if don't comment it, it's instantaneous ( 0.7seconds ). seems related mapviews, other views/vcs rotate fine. under ios7 rotation fast in case line commented or not. why ? , why mapview affected ? edit: seems autoresizingmask wrong. if in view

Javascript regex: is there anyway to write a regex which gives true if backreference is NOT matched -

so here problem: i'm checking input of 2 years hyphen. like: 2001-2015 to test this, use simple regex /^([0-9]{4})-([0-9]{4})$/ i know groups aren't needed, , (19|20)[0-9]{2} , closer match basic year exp, bear me. now, if requirement match 2 years if same, have used backreference like: /^([0-9]{4})-\1$/ which matches 2000-2000 not 2000-2014 my actual requirement opposite. want match if years different not if they're same. is, 2000-2014 should match. 2000-2000 should not. and using negative of boolean find not option. need huuuge regex supposed match whole lot of different date formats. part of it. is there way achieve this? you can use negative lookahead achieve this: ^([0-9]{4})-(?!\1)[0-9]{4}$ demo this same pattern, except inserts condition check using backreference. (?!\1) fail if \1 matches @ position.

java - Trying to decipher a text file with an algorithm -

i have deciphering method should open test file encrypted text, read , decipher each line of text read in input file. text file called mystery.txt. can method work when inputting single characters can't work open .txt file , decipher line line. have tried calling readfile() before algorithm null pointer exception in (i = 0; < text.length(); i++) . have never done similar before , don't know how go doing it. the algorithm should read each line , decipher using crypt1 & crypt2 variables. using readfile() , writefile() methods, need cipherdecipherstring() method able write method opens file, reads each line contains 1 @ time, deciphers each line read in , writes resulting text screen , output file. dechiphering method: public static string cipherdecipherstring(string text) { // these global. put here space saving private static final string crypt1 = "cipherabdfgjk"; private static final string crypt2 = "lmnoqstuvwxyz"; // declare v

javascript - jQuery pre/append only within parent class name -

i have page lots of repeated items (a list of hotels) i'm using optimizely , i'm trying move elements around in each hotel. every time pre or append moves every element every hotel every element. so i'm trying pre/append class name class name if it's in parent of class name. the class name of each hotel .hotel: $('.rating').prependto(function(){ $(this).parents('.hotel').prependto('.price-tag'); }); this isn't working, appreciated i think want rating prepended price-tag element within current hotel , in case $('.rating').each(function () { $(this).closest('.hotel').find('.price-tag').prepend(this); });

inheritance - Should I inherit a nested class within a derived class in c++? -

could ( edit: should ) this? edit: i'll try asking example may better suited inheritence scheme. note isn't working class, concept. template<typename t> class tree { protected: class node { node* _parent; t _data }; }; template<typename t> class binarytree: public tree { private: class binarynode: public tree<t>::node { node *_left, *_right; }; }; this way of constructing parallel class hierarchies not uncommon. however, more common hide nested derived class implementation detail should encapsulated, i.e. biiterator in example in private: section. however, iterator not example because of object slicing: if biiterator remains public, seemingly innocent code incorrect: bidirectionallist bilist; // slice off biiterator's functionality iterator iter(bilist.get_iterator()); while (iter.has_next()) { ... } a better example if base class member function took reference or pointer object of nes

string - Matlab cells with Names -

note: please if can point solution without 'eval', great!!! if not, i'll thankful :-) well, have cell ( var_s ) has in first row strings , in second row matrices: clc clearvars fclose l=[11 22 33 44]; m=[1 2 3]; n=[101 102 103 104 105, 95 96 97 98 99]; var_s=cell(2,3); var_s(1,1:3)={'rn', 'le', 'o'}; %// strings different , not created in loop. var_s(2,1:3)={l, m, n}; %// no correlation possible. %//than delete variables because can work cell (var_s{2,:}) %//to execute computations clearvars l m n %//now want save values stored inside of cells in %//second line of var_s, var_s{2,:}, associating them names in first %//row of var_s, var_s{1,:}, in .mat file %//but let's imagine instead of having size(var_s{2,:})=3 have %//something 1000 (but lets keep simple having 3). %//consequently want use 'for' work! %//and @ point issue appears. how can use strings %//inside var_s{1,:} create variables , store them in .mat file

Selenium Tests not working on Jenkins with Chromedriver, Chromium and xvfb -

im trying bunch of selenium tests work on jenkins. ubuntu machine , installed chromedriver chromium , xvfb. after problems seems finding chromedriver , xfvb still cant tests run. work fine local on jenkins says : fehlermeldung timed out after 5 seconds waiting visibility of element located by.xpath: //*[@id='loginform-loginusernameinput'] build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54' system info: os.name: 'linux', os.arch: 'amd64', os.version: '3.13.0-39-generic', java.version: '1.7.0_67' driver info: driver.version: unknown stacktrace org.openqa.selenium.timeoutexception: timed out after 5 seconds waiting visibility of element located by.xpath: //*[@id='loginform-loginusernameinput'] build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:09:54' system info: os.name: 'linux', os.arch: 'amd64', os.version: '3.13.0-

php - Write permission for wpengine file -

i want set write permission .php file in wordpress file hosted on wpengine host. can please provide me permission required write file in this. wp engine pushes out default set of file permissions content uploaded via sftp. can reset default perms wpe plugin in wp-admin area. open plugin, scroll down , hit reset permissions .

ios - AdMob using in splash screen -

bview=[[adbannerview alloc]initwithframe:cgrectmake(0, 0,320, 100)]; [bview setbackgroundcolor:[uicolor redcolor]]; [self.view addsubview:bview]; the above code used displaying iads. is possible adding admob or iads or other advertisement portions can able adding / inserting of splash / launch screen using xcode 6.0. you can use splash screen rootview controller. add background image of splash screen on view controller.that means view controller act splash screen. here can add code admob.otherwise not possible. 1 more thing, if ad takes time display on splash screen, apple can reject app. reference apple document- "as possible, avoid displaying splash screen or other startup experience. it’s best when users can begin using app immediately."

javascript - Enable CORS, WEBAPP, -

i struggling following problem. created simple webapp sends via javascript „get“ operations other server. problem app hosted lets on www.webapp.com/webcontent , webapp itselfes consumes data services. odata services hosted on system www.sap.universityber.com/opu/… when want run app locally reverse proxy (apache) , disable security settings in chrome works fine. when want run normal browser without reverse proxy , chrome settings says „no data“, reason -> cors. can in forum tell me how such cors- enablement work maybe example code? please help. thanks enabling cors need done www.sap.universityber.com/opu/ , not in web app. if it's open api, may offer jsonp alternative (jsonp isn't subject same origin policy, end-run around it, also needs cooperation of server providing content).

xml - bash script for replace text from two file in one -

i have 2 file xml; en.xml , it.xml in default file language en.xml have structure <string key="city not set"> <tr lang="en"> city not set </tr> in file it.xml have: <string key="citt&agrave; non &egrave; impostato"> <tr lang="it"> </tr> in way can extract data it.xml , put in en.xml ? from en.xml need string key <string key="city not set"> in second file it.xml need change: <string key="citt&agrave; non &egrave; impostato"> in : <tr lang="it"> citt&agrave; non &egrave; impostato </tr> my goal obtain final result: <string key="city not set"> <tr lang="it"> citt&agrave; non &egrave; impostato </tr> i hope clear. i use parse xml: get_data () { local tag=$1 local xml=$2 # find tag in xml, convert tabs spaces, remove leading spaces, remov

Store os.system( 'curl -u "username:password" "https://<url>") in a python variable to stream data in another framework? -

i lookup on internet using curl. automated using python script take ip argument , further run curl using that. i tried following: maxm = os.system('curl -u "username : password " %s' %url) but still output gets displayed on terminal , not value variable maxm . i tried subprocess.popen . dint work though. seeking resolve this. regards richa you use subprocess.pipe , easiest way use subprocess.check_output import subprocess maxm = subprocess.check_output('curl -u "username : password " %s' % url)

ios - Weird erros "Sanbox deny iokit-get-properties" in IOS8 -

i have strange behaviour when debug ipads on app i'm programming, , i'm pretty sure appeared after updating of production ones ios8. i using multipeer connectivity, , tried debugging random disconnections, ended seeing device's console long. noticed there bunch of them before or after disconnection (by bunch mean 2 dozen hundreds of lines). also, app uses background services, don't know if it's related, required me edit app's configuration (in xcode) enable updating certificate. so, why these "sandbox deny iokit-get-properties" messages appearing? thank you. an excerpt of long messages: [date] [ipad name] kernel[0] <notice>: sandbox: [my app name]([process number]) deny iokit-get-properties iomacaddress [date] [ipad name] kernel[0] <notice>: sandbox: [my app name]([process number]) deny iokit-get-properties iomacaddress [date] [ipad name] kernel[0] <notice>: sandbox: [my app name]([process number]) deny iokit-get-prope

Batch file to copy and rename the copied file -

i create batch file copy *.ext files destination folder appended date , time file name , copy upto maximum 30 files. after 30 files copied, should delete oldest file. (while copy 31st file, 1st file should deleted, , on). thanks support. have great day!

angularjs - Retrieving a value from a function in ngStyle -

i beginner in angularjs , sure there must easy solution can't pin it. trying style element through function, unsucessfully. here code: script.js: (function(angular) { 'use strict'; angular.module('docsbindexample', []) .controller('controller', ['$scope', function($scope) { $scope.color = "{'background-color':'red'}"; $scope.fetchstyle = function(){ return {'background-color':'red'}; }; $scope.name = 'max karl ernst ludwig planck (april 23, 1858 – october 4, 1947)'; }]); })(window.angular); index.html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>example - example-example9-production</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script> <script src="script.js"></script> </head> <bod

wordpress - WP - conflict with theme files -

i'm developing theme , using 2 post types. default posts blog , news posts (custom type) news. when open news - uses proper theme file, marks nav bar menu item of blog. blog using home.php (default general posts). news using 'category-news.php'. ideas why clashing? update wp_query object ( [query_vars] => array ( [page] => 0 [news] => blog-2 [post_type] => news [name] => blog-2 [error] => [m] => [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0

node.js - Getting error when trying to install pm2 -

i trying install pm2 on mac os version 10.8.5. when intstalling it. i have installed xcode 5.1.1 on mac. after doing getting gyp err! stack error: not found: make".is not gnu make comes xcode , supposed work ideally. please see below whole error when trying install it. rajeshs-macbook-pro:~ rajesh$ npm install pm2 > fsevents@0.3.1 install /users/rajesh/node_modules/pm2/node_modules/chokidar/node_modules/fsevents > node-gyp rebuild child_process: customfds option deprecated, use stdio instead. - agreeing xcode/ios license requires admin privileges, please re-run root via sudo. gyp err! build error gyp err! stack error: not found: make gyp err! stack @ f (/users/rajesh/.nvm/v0.11.14/lib/node_modules/npm/node_modules/which/which.js:43:28) gyp err! stack @ e (/users/rajesh/.nvm/v0.11.14/lib/node_modules/npm/node_modules/which/which.js:46:29) gyp err! stack @ /users/rajesh/.nvm/v0.11.14/lib/node_modules/npm/node_modules/which/which.js:57:16 gyp err!

javascript - RegeX to validate Email OR Phone No. OR URL -

hi ask if possible create regex var regex = (valid email)|(any number 1 15 digits)|(url protool(https|https) , without (www.google.com))) valid http://www.google.com www.google.com sample.s.sample@gmail.com sample.s@gmail.com 1 12 .. 15 invalid testemailinvalid.test.yahoo2 aaaaa aaaaaaaa sasasa i have regex expression regarding when put number validation in middle number not accepted.and when put last email input not accepted var re = (/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))+(-(^[0][1-9]+)|([1-9]\d*))|(((?:https?\:\/\/|www\.)(?:[-a-z0-9]+\.)*[-a-z0-9]+.*))$/); i recode of regex , working did add + sign in end of second chunk of expression var re = (/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-

Install Matrox MGA g200e drivers on Linux Ubuntu 14.04 -

i trying install matrox mga driver (driver on page ) on ubuntu 14.04 installation process ask me x11r6 path . have xorg installed on computer can't locate path need. fond on internet commonly folder in /etc/x11 or in /usr/etc not there, folder have new position in ubuntu 14.04 can hel me locate or suggest me installation guide ubuntu version?! i found answer question, matrox mga drivers unclaimed in ubuntu 14.04 because of update of xorg. solved installing ubuntu 12.04 seems problem can solved overriding new xorg files old xorg version. can find information argument in this forum

multiple inheritance cast in c++ -

i have issue concerning multiple inheritance cast. have 3 base classes class readfile; class writefile class sharedobject; // class mutex based on class build: class readwritefile : public readfile, public writefile { ... }; class readwritesharedfile : public readwritefile , public sharedobject { ... }; class readfileshared : public readfile, public sharedobject { ... }; at point of code, have readwritesharedfile pointer cast pointer readfileshared readfileshared * l_data = dynamic_cast<readfileshared * >(m_data); // m_data readwritesharedfile it compiles @ execution, cast "fails" , l_data null however, want achieve sounds legit me. it? doing wrong. thanks readfileshared , readwritesharedfile unrelated classes, although inherit same base classes. therefore, cannot cast reference/pointer 1 another. your functions should use interfaces readfile , writefile , rather require particular implementation of them. main idea behind interfaces. s

How to set 1min interval time logic in java -

i stuck on 1 problem: want send useraccountname , password via mail, 1 minute interval between. is, useraccountname should go sent first via mail, , after 1 minute interval should sent too. how implement logic 1 minute interval in java? you can use scheduledexecutorservice . allows queue tasks given time intervals. example you create runnable .. runnable runnable = new runnable() { public void run() { system.out.println("do something!"); } } scheduledexecutorservice scheduler = executors.newscheduledthreadpool(1); scheduler.scheduleatfixedrate() // won't tell how this!

c# - OpenGL texture+lightning+blending trouble -

i'm using opentk , there difficulty me understand concept of opengl enabling functions. perspective matrix in onresize function. i trying show texture. my render function: gl.clearcolor(0.5f, 0.5f, 0.5f, 1.0f); gl.clear(clearbuffermask.colorbufferbit | clearbuffermask.depthbufferbit); gl.matrixmode(matrixmode.modelview); gl.loadidentity(); gl.enable(enablecap.texture2d); gl.enable(enablecap.depthtest); ground.draw(); my ground.draw() function(sizexz.z, sizexz.y constants): gl.pushmatrix(); gl.translate(new vector3(-sizexz.x / 2, -1, sizexz.y / 2)); gl.bindtexture(texturetarget.texture2d, textures.gettextureid(texturename)); gl.begin(primitivetype.quads); gl.color3(1,1,1); gl.normal3(0, 1, 0); gl.texcoord2(1f, 1f); gl.vertex3(0, 0, 0); gl.texcoord2(1f, 0f); gl.vertex3(sizexz.x, 0, 0); gl.texcoord2(0f, 0f); gl.vertex3(sizexz.x, 0, -sizexz.y);

javascript - Add links to images in array -

i'm trying add links images in js array that, when clicked, direct info page. i tried use following code images won't show. var workarray = new array(['work/01.png',"http://www.stackoverflow.com"], ['work/02.png',"http://www.stackoverflow.com"], ['work/03.png',"http://www.stackoverflow.com"], ['work/04.png',"http://www.stackoverflow.com"]); if remove links images show. i'm using variation of code: http://bouncingdvdlogo.com/ here full code: var width = 400; var height = 400; var swoosh = 4; var stopafter=0; //set time in seconds before image disappears. use 0 never var maxswoosh = 50; var xmax; var ymax; var xpos = 0; var ypos = 0; var xdir = 'right'; var ydir = 'down'; var screensavouring = true; var tempswoosh; var newxdir; var newydir; function setupshit() { if (document.all) { xma

JavaScript: Storing dates in array in for loop -

i'm trying loop through check if first date less second date. if is, want store value in array, add 1 day first date, go through process. think that's i've written, i'm not sure why it's not working. when console out any of array values, it's last date appears , can't of other values store. after stepping through firebug, looks being overwritten. i'm using moment.js dates. var counter = 1; var arr = []; var = firstdate.todate(); for(counter; firstdate < seconddate; counter++){ arr[i]=firstdate.todate(); firstdate.add(1, "day"); } console.log(arr[2]); any appreciated! the variable i never changes once set, you're writing same index. also, counter variable never used. consider using counter variable index unique each iteration. alternatively, if want continue using date index, add line i = firstdate.todate(); top of loop. for latter, loop should this: var counter = 1; var arr = []; var = fi

netty - how to write response when it is not the lastchunk -

i running netty http upload example , have 1 additional requirement authentication before upload files; understand upload big files using multipart mode upload, , server side read post request multiple times. so idea set token in request body first parameter, , when reading chunks can firstly verify token ,if not match cancel whole request , return status code client side. the point how can cancel request , send status code appropriately, had tried below, when channel have closed, client did not finished sending request, , throw "connection reset" exception: channelfuture future = channel.writeandflush(response); future.addlistener(channelfuturelistener.close); how send response client during manually reading chunked post msg. in case send response , close channel when chunk not last chunk ,client side not response. i think way you're doing correct, note that, according following item found on answering before full request received possible not suppor

dictionary - creating nested dictionaries in python from database query -

i have information i'm retrieving database: with fields like |portfolio| date | sector| industry | ticker | price | postion| and data like ("us", "2013-01", "consumer","retail","pm",10,1000) ("us", "2013-01", "consumer", "retail", "jcp", 15, 1500) ... how can turn dictionary looks like: {us:{"2013-01":{"consumer":{"retail":{"pm":{"price":10,"position":1000},"jcp":{"price":15, "position":1500}}}}}} in time , resource effective way? something a[date][sector][industry][ticker].update("pm2" = dict(close=10, position = 1000)) gives me error. thanks you havent specified error. anyways, can done iterating each row , using setdefault method dict, can check item , see if present in dict. so, example - a = {} a.setdefault('us', {}) .... .... # if

java - Service losing bind (mBoundService = null) -

i've got working version fragment pasing json string main activity has tcp socket service bound it: main_activity: ... private serviceconnection mconnection = new serviceconnection() { @override public void onserviceconnected(componentname name, ibinder service) { mboundservice = ((socket_service.localbinder) service).getservice(); } @override public void onservicedisconnected(componentname name) { mboundservice = null; log.d("tcp client: main_activity", "onservicedisconnected called!"); } }; ... public void writebyte(string jsonobject) { if (mboundservice != null) { mboundservice.sendmessage(jsonobject); } } ... fragment: ... main_activity activity = (main_activity) getactivity(); activity.writebyte(jsonobject.tostring()); ... -----------------------------------------------------------

File transfer between PC and FPGA -

i new 1 fpga , first time trying transfer files between fpga board , pc. have digilent atlys spartan 6 xc6slx45 board. i have tried lot of google wasn't able find value-able information. information contained ambiguous things. i able find manual communication of vertix 5 board. http://www.fpgadeveloper.com/2008/10/tri-mode-ethernet-mac.html can provide me link or information, can more work on this. right now, trying write file , read stored data in fpga board. ok device communication usb or hdmi or usb or serial port. thanks! your digilent board comes software (adept) provides simple (remote) i/o , file transfer function => adept screenshot atlys . alternatively can add uart system. example uart6 macros xilinx developed ken chapman => picoblaze example design incl. uart macros these macros scale circa 1,25 mbyte/s. atlys board's usb-uart bridge supports 12 mbit/s. terminal software limited 921 or 115,2 kbit/s. if need more bandwidth, can use gi

css - Render HTML text the same across all browsers? -

Image
i've been tasked making editorial page, similar newspaper article. i've fiddled here: http://jsfiddle.net/dp3tn9sx/ my issue looks great on chrome, on firefox have few stray words unforunately ruin , feel of page here screenshots: chrome: firefox: is there can in markup make how expect (chrome) across browsers? mostly, position absolute , justified text #container p {position: absolute; margin: 0px; text-align: justify; font-family: 'open sans', sans-serif; font-size: 14px;} .textblock1 {left: 110px; top: 48px; width: 420px} or there solutions achieve sort of using method?!

java - maven copy a particular dependency jar to a specific directory in the .war file -

i trying out simple java web start project based on oracle tutorial. using maven package webapp , deploy application server. full source code available here https://github.com/kiranmohan/dynamic-tree-javaws-sample-project the maven project structure like parent |--lib |--webapp the webapp module maven war module. required package lib.jar @ root of webapp.war. not under web-inf/lib. how achieve in maven? i found right way use maven-dependency-plugin. since "lib.jar" not used in compile phase of "webapp" module, package time dependency. using maven-dependency-plugin, can copy lib.jar required directory during prepare-package phase. maven-war package include lib.jar in .war package. <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-dependency-plugin</artifactid> <executions> <execution> <id>copy</id> <phase>prepare-pac

jquery - Update Shopify cart product list using AJAX -

i have 'ajaxified' cart on shopify, when click 'add cart' button on product page, price updates in top right hand corner of screen , product added cart without page refresh. when click price in top right hand corner, reveals dropdown showing products in basket (it shows product - image, url, price & quantity). however, when click 'add cart' list of products not update until refresh page. how list refresh (or how add product list in ajax request)?? i have tried adding ajaxify cart module ( https://raw.githubusercontent.com/carolineschnapp/ajaxify-cart/master/ajaxify-cart.liquid ): $.getjson(_config.shopifyajaxcarturl, function(cart) { $("#dropdown-cart").append('<tr><td><a href="'+product.url+'" class="dropdown-product-image"><img src="'+product.image+'" alt="'+product.description+'" /></a></td><td class="restrain-width&

Meta Generic in Java -

i'm 99% impossible, thought it's worth try: possible create class implements template? motivation: want create generic composite class. example: public class genericcomposite<t> implements t { list<t> m_items; void add(t item) { m_items.add(item); } @override void f() { (t item : m_items) { item.f(); } } } where f method defined in interface t. of course don't know it's gonna f() when call nor implement it. there meta-meta-magic i'm not aware of makes possible? if not, there other language out there supports this? you correct, not possible in java: compiler cannot sure t interface (as opposed class ), cannot let implement t . c++ offers possibility through templates, not implement "generic composite". problem f() method (or methods in actual class stands). wanted write this: // not going work! syntax not real. public class genericcomposite<t> impleme

ember.js - Ember and immediately-invoked functions -

i joined team has been building ember app. they're in stages of development, what's caught eye of objects wrapped in closures: (function () { 'use strict'; app.document = ds.model.extend({ uri: ds.attr('string'), name: ds.attr('string'), }); }()); i know 'use strict' you'd wrap object. otherwise, necessary? previous ember apps build using coffeescript, , believe automatically when transpiled. also, wonder if there's way in 1 place, manifest file, , not have in each , every file in app. this typically done isolate modules 1 another, since javascript variables scoped @ function level. if team able, should switch app on ember cli , takes care of kind of stuff (plus, whole lot more).

change the way mysql returns columns to php zf 2 sql -

im getting using zend\db\sql. the 2 tables share similar columns names, {id,name,...} when access result set, column names overwritten because of this. is there way mysql or zf2 return like: 'table1.id', 'table1.name', 'table2.id', table2.name' so can filter there without having in query: select 'table1.id table1_id', 'table1.name tablel1_name', 'table2.id table2_id', table2.name table2_name' thanks!

html - input:invalid css rule is applied on page load -

check out these 2 fiddles in firefox or chrome. in this one, i've got simple form required attribute , submit button. pressing "submit" when box empty causes styled invalid (in firefox, it's red outline). waits until press submit show it's invalid. now try this one. it's identical, except there's css: input:invalid{ border-color:orange } except time orange border color applied before submit pressed. if , if manually set invalid style form, browser applies before, not intuitive behavior. of course required field invalid before enter anything. is there way fix this? here's you're looking for: http://jsfiddle.net/caseyrule/16fuhf6r/2/ style this: form.submitted input:invalid{ border-color:orange } and add js: $('input[type="submit"]').click( function(){ $('form').addclass('submitted'); }); i don't believe there way achieve yet without javascript.

Node.js Express 4 intercept failed static route -

i'm building web site requiring secure zone protected username/password (form authentication). here structure : - project folder |- lib |- file , sub folders |- public |- fonts |- file , sub folders |- images |- file , sub folders |- javascript |- file , sub folders |- stylesheets |- file , sub folders |- file @ root of public folder |- routes |- login.js |- home.js |- others files... |- views |- layout |- file , sub folders |- file @ root of views folder now don't want protect file in public folder, of thoses static file, can serve directly. i want protect secure zone, routes views except 1 going login controller. here i've done far : // ... var express = require('express'); var expressapp = express(); expressapp.set('port', httpport); expressapp.set(

java - When generating beans from dtd with xjc default values are in getter methods -

i use xjc create objects dtd. xjc -dtd mydtd.dtd -d src but confused default values... in dtd file have element below: <!element imageorder (target, format, source, output, rules?, volumename?, pvdinfo?, controls?, customize?)> <!attlist imageorder orderid cdata #required clientid cdata #required priority (low | normal | high) "normal" streamerexternal (true | false) "false" streamerlogonid cdata #implied> and xjc creates object below: @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { "target", "format", "source", "output", "rules", "volumename", "pvdinfo", "controls", "customize" }) @xmlrootelement(name = "imageorder") public class imageorder { @xmlattribute(name = "orderid", required = true) @xmljavatypeadapter(normalizedstringadapte

python - why is are my dictionary's values a list of a list -

the procedure below takes list of 'parties' input , calls twitter api followers. result looks like: { party1 : [[1,2,3]] party2 : [[e,f,g]] } but want values simple lists (i.e. [1,2,3], not [[1,2,3]]). guess 'page' pages comes in list, cannot figure out how simpler. have tried .append instead of + below. edit: noted in comments - page list. code posted below works - wasn't running right version of code. still interested in why .append causes [[.]] appear. i'm okay closing question too. here code: def get_party_followers(parties): ids = {} in parties: l=[] page in tweepy.cursor(api.followers_ids, screen_name=i).pages(): l=l+page print "resting" time.sleep(60) ids[i]=l print + " complete" return ids`

c# - Not getting a result with single sign on to Goodreads on Windows 8.1 -

i trying sign in goodreads. calling webauthenticationbroker, opens overlay log in. works far, can't overlay close after login. not getting success result. when using backarrow "usercanceled" result. here i've got far: string goodreadsurl = "https://www.goodreads.com/oauth/authorize?oauth_token=" + properties.oauth_token; uri sid = webauthenticationbroker.getcurrentapplicationcallbackuri(); string callbackurl = sid.tostring(); var starturi = new uri(goodreadsurl); webauthenticationresult result = await webauthenticationbroker.authenticateasync(webauthenticationoptions.none, starturi, new uri(callbackurl)); if (result.responsestatus == webauthenticationstatus.success && !result.responsedata.contains("&error=")) { [...] } i found similar question cannot facebook single signon windows 8.1 work , suggested answer not working case. any ideas? i think might indicate oauth callback url wasn't being navigated , c