Posts

Showing posts from April, 2010

jquery - Woocommerce: Go to order-pay page via ajax -

i'm developing online store woocommerce right i'm struggling following thing: can go cart , checkout page using shortcodes order-pay page has no shortcode. has idea how achieve this? this how work shortcodes: jquery: $.ajax({ type: "post", url: myajax.ajaxurl, data: { action: 'getshortcode', shortcode: 'cart' }, success: function( response ){ // replace content } }); functions.php add_action("wp_ajax_getshortcode", "getshortcode"); add_action("wp_ajax_nopriv_getshortcode", "getshortcode"); function getshortcode(){ echo '<div class="wrapper">'; echo do_shortcode( '['. $_post['shortcode'] .']' ); echo '</div>'; }

bigcommerce - npm and jspm with css dependency -

i'm working library lists css dependencies in it's package.json file. here's contents of file: { "name": "bigcommerce-storefront", "description": "the new bigcommerce storefront", "version": "0.0.1", "private": true, "dependencies": { "jspm": "^0.15.1" }, "jspm": { "directories": { "baseurl": "assets" }, "dependencies": { "asyncly/eventemitter2": "github:asyncly/eventemitter2@^0.4.14", "bigcommerce-stencil/citadel": "github:bigcommerce-stencil/citadel@2.4.3", "bigcommerce-stencil/stencil-utils": "github:bigcommerce-stencil/stencil-utils@0.3.4", "browserstate/history.js": "github:browserstate/history.js@^1.8.0", "caolan/async": "github:caolan/async@^0.9.2", ...

Undefined index Opencart in home.php -

opencart version 1.5.5.1 i add code: in home.php display in home.tpl controller : <?php class controllercommonhome extends controller { public function index() { $this->document->settitle($this->config->get('config_title')); $this->document->setdescription($this->config->get('config_meta_description')); $this->data['heading_title'] = $this->config->get('config_title'); $this->dell(); // custom if (file_exists(dir_template . $this->config->get('config_template') . '/template/common/home.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/home.tpl'; } else { $this->template = 'default/template/common/home.tpl'; } $this->children = array( 'common/column_left', 'common/column_right', 'common/content_top', ...

javascript - node js not working with SyntaxError: Unexpected identifier -

so, started learning node.js , tried basic thing in world: "hello world" server. the code following (copied actual book): var http = require("http"); http.createserver(function(request, response) { response.writehead(200, {"content-type": "text/plain"}); response.write("hello world"); response.end(); }).listen(8888); i hit node.js executable, type node server.js , gives famous syntaxerror: unexpected identifier . tried looking similar questions couldn't find something simple i'm trying accomplish. the node repl aka node shell, repl provides way interactively run javascript , see results. can used debugging, testing, or trying things out. here 1 how-to-use-nodejs-repl whereas, command line used run node command node server.js . you run node server.js in command line.

node.js - Node progress bar -

i working on example presented in https://github.com/tj/node-progress i have followed example word word, can't seem functionality of bar.tick() working var req = http.request({ host: 'download.github.com', port: 443, path: '/visionmedia-node-jscoverage-0d4608a.zip' }); req.on('response', function (res) { //var body = ""; var len = parseint(res.headers['content-length'], 10); console.log(); var bar = new progressbar(' downloading :bar :percent :etas', { complete: '=', incomplete: ' ', width: 20, total: len }); res.on('data', function (chunk) { //body += chunk; bar.tick(chunk.length); }); res.on('end', function () { console.log('\nfinished loading\n'); }); }); req.end(); the final output looks following downloading ==================== 100% 0.0s but instead should show p...

amazon web services - Connecting AWS with Ruby on Rails Application -

i have gone through number of questions trying resolve issues, every time solve 1 pops up. a lot of answers seem outdated. can give me simple break down on how connect ror application aws allow users download files bucket? i feel majority of errors have stemmed poor configuration on part. aws documentation hasnt been help. try aws sdk ruby - version 1 require 'aws-sdk' access_key_id = access_key_id secret_access_key = secret_access_key aws3 = aws::s3.new(access_key_id: access_key_id, secret_access_key: secret_access_key) bucket = aws3.buckets['bucket_name'] # data thru iteration bucket.objects.each |object| puts object.key puts object.read end

debugging - Python : Automatic debug logs when control goes inside/outside function -

i trying 1 project, has many functions. using standard logging module requirement log debug logs says <timestamp> debug entered foo() <timestamp> debug exited foo() <timestamp> debug entered bar() <timestamp> debug exited bar() but dont want write debug logs inside every function. there way in python takes care of automatic log containing entry , exit of functions? dont want use decorator functions, unless solution in python. thanks in advance any reason don't want use decorator? it's pretty simple: from functools import wraps import logging logging.basicconfig(filename='some_logfile.log', level=logging.debug) def tracelog(func): @wraps(func) # preserve docstring def inner(*args, **kwargs): logging.debug('entered {0}, called args={1}, kwargs={2}'.format(func.func_name, *args, **kwargs)) func(*args, **kwargs) logging.debug('exited {0}'.format(func.func_name)) return...

java - Why use "s = --size" instead of "s = size"? -

code priorityqueue: private e removeat(int i) { assert >= 0 && < size; modcount++; int s = --size; // <- why??? if (s == i) // removed last element queue[i] = null; else { e moved = (e) queue[s]; queue[s] = null; siftdown(i, moved); if (queue[i] == moved) { siftup(i, moved); if (queue[i] != moved) return moved; } } return null; } what's differences between s = --size , s = size ? help? in advance. int s = --size; pre -decrement operator , , not equivalent int s = size; . equivalent to int s = (size = (size - 1)); or size = size - 1; int s = size; but shorter both of those.

regex - Viewstate Replacing error. [ViewStateException: Invalid viewstate. ] -

Image
tried jmeter: how know why regular expression extractor in jmeter not extracting data still not able replace view-state, throwing [viewstateexception: invalid viewstate. ] error . please check attachment , script has not _eventvalidation . enter image description here viewstate viwstate2 as observing attached image you need pass same `reference name` value of __viewstate in next request

android - Titanium Alloy Push Notification Subscribed But Listener Not firing Up -

i need make push notification listener, code below , runs perfect till subscription , dashboard confirms subscribed successfully, problem occurs receiver. alloy.globals.serviceaddress = "my service address"; ti.api.info("1"); var cloudpush = require('ti.cloudpush'); var cloud = require("ti.cloud"); var devicetoken = null; loginuser(); // flow starts here function loginuser() { cloud.users.login({ login: 'user', password: 'password' }, function(e) { if (e.success) { var user = e.users[0]; // alert("loggin successfully"); getdevicetoken(); } else { alert("error2*** :" + e.message); //ti.api.info('error ') } }); } function getdevicetoken() { if (ti.platform.android) { cloudpush.debug = true; cloudpush.focusapponpush = false; cloudpush.enabled = true; cloudpush.showappontrayclick = true; cloudpush.showtraynotification ...

Bundler::GemRequireError when trying to run a rails app -

while trying run rails app, getting following error rails s -p 5000 /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: initialized constant net::smtpsession /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/smtp.rb:806: warning: previous definition of smtpsession here /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: initialized constant net::pop /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:687: warning: previous definition of pop here /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: initialized constant net::popsession /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:688: warning: previous definition of popsession here /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning: initialized constant net::pop3session /home/user/.rvm/gems/ruby-2.1.6/gems/tlsmail-0.0.1/lib/net/pop.rb:689: warning...

json - CoreData to store the server content -

i have specific question. have requirements read data server (json format), store in core data , update ui (tables) reading data core data. reason need store data in core data because have requirement show data offline (when there no network). so doing this: read json server, create managed object entities , store in core data. upon success of save of core data, send event view controller read data core data. the question is: can/should view controller use managed object entity directly returned core data or should create custom entities consumed uiviewcontroller? what should strategy if entity not found in core data need go server again , store in core data. in general common scenario , seeking experts advise how go designing it? thanks in advance!

javascript - Is it possible to block the Windows Key from a web browser? -

i have sophisticated single page application, nice little menu system (similar windows 8 start menu). i'd users hit windows key open menu when within application. have functioning, brings microsoft windows start menu. is there way (from web browser) can "block" microsoft windows start menu appearing when hit windows key within web app? i'm using latest jquery, knockoutjs, , necessary javascript plugin accomplish task. write custom binding handler button action - ko.bindinghandlers.windowskey = { init: function (element, valueaccessor, allbindingsaccessor, viewmodel) { var value = ko.utils.unwrapobservable(valueaccessor()); $(element).keydown(function (e) { if (e.which === 91 || e.which == 93) { value(viewmodel); } }); } }; as per question of whether can disable button in windows browser, see answer daniel white posted no, cannot done.

javascript - Determine which element is first and do this -

i need set focus on first form element or class of ".focus"; whichever visible or first. this not seem sort through each determine comes first? http://jsfiddle.net/infatti/tdvhj/1/ $('.focus:visible:first, body:not(:has(.focus:visible)) input:visible:first, body:not(:has(.focus:visible)) textarea:visible:first').focus(); this locate visible input elements, textarea elements , .focus elements: $('input:visible, .focus:visible, textarea:visible') it have them ordered according order in dom, first of elements in document first in jquery object. access first: $('input:visible, .focus:visible, textarea:visible').eq(0); and focus on it: $('input:visible, .focus:visible, textarea:visible').eq(0).focus(); note that, found out, jquery considers elements 'visible' if take space in document. elements visibility:hidden or opacity:0 still considered visible: http://api.jquery.com/visible-selector/

json - Tumblr API - exclude results by tag -

i'm making site feed runs off of tumblr. there's 1 section general posts , section "featured" posts, specified tag (ie #featured ). i'm trying prevent same post showing in 2 different spots on same page, general feed section, there way have exclude posts #featured ? when post object processing can check if(!in_array($tag_to_exclude, $post->tags)) { // post not contain tag - display ... } i'm guessing grab $apidata->response->posts , run foreach loop? otherwise feel free ask more info

c# - Assigning a Readonly Field via Virtual Member in Abstract Class's Constructor -

i know there similar questions asked here on so, question deals scenarios involving setting readonly field calling virtual member in abstract class's constructor. consider following abstract class: public abstract class foobase { private readonly idictionary<string,object> _readonlycache; protected abstract idictionary<string,object> setcache(); protected foobase() { _readonlycache = setcache(); } } questions: 1) flat-out bad design? 2) there better design? i'm aware declare implementers of foobase sealed , insure correct implementation of setcache() called. don't there no way enforce implementers must marked sealed . suggestions welcome. it's avoided if possible - calling virtual methods within constructor bit smelly, you'll executing code before subclass gets perform initialization - constructor body won't have executed. true regardless of whether subclass sealed or not; you're in fund...

java - How to call Struts2 action from no submit button -

i need know how call struts2 action button not submit form. when click on button should call struts2 action make web service call ssrs server (sql server reporting services). server sends report stream put in response. displays popup download pdf file. jsf it's easy, commandbutton provides "action" attribute. i'd equivalent of this: <h:commandbutton id="editbutton" value="edit" action="#{mybean.edit}" /> public class mybean { public string edit() call web service, put stream on response return "ok"}} how in struts2? ajaxa? jquery? dojo? new struts2 , ajax, lot of jsf. thank you without submitting form, need ajax . but since need download pdf, perform call action returns stream result (and won't change current page). read more here specifying contentdisposition: attachment , ask user download file (or application use open it), while contentdisposition: inline open inside browser, changing pa...

javascript - Discrete Bar Chart using nvd3 library -

i implementing discrete bar chart using nvd3 library on click of button calling generatebarchart method here code : generatebarchart = function(data, options) { if (!$.isarray(data)) { if (!$.isplainobject(data)) { data = $.makearray(data); } else { try { data = $.parsejson(data); } catch(err) { console.error(data, "generatebarchart error", err.message, err.stack); data = []; } } } var chart1; if (!$.isplainobject(options)) { options = {}; } options = $.extend(true, { container : "#svgchart", title : "", titlestyle : { x : 500, y : 200, fontfamily : "sans-serif", fontsize : "20px", fill : "black" } }, options); nv.addgraph(function() { chart1 = nv.models.discrete...

php - What are colons for in a preg_match pattern? -

in following php code (not mine): $has_trailing_slash = preg_match(':/$:', $string); what purpose of colons? if remove them, preg_match call complains if there isn't trailing slash in string. colons, preg_match doesn't complain if there isn't trailing slash. apparently colons kind of conditional or optional indicator, documented anywhere? can't find 1 word of documentation using colons way preg_match, or regex in general. the colons here used delimiters. you need use delimiters regex in php regex engine can know regex starts , regex ends, , excluding quotes use in function. this particularly important regex engine can distinguish between actual regular expression , flags (if any) used (e.g. i (for case insensitive matching), s (to make dot match newlines), u (to allow unicode character matching), etc) you can use variety of delimiters , can use 'suitable' 1 depending on situation. instance, common delimiter use forward slash...

java - TPM 32-bit key handles -

i've been exploring tpm world , have tried out few different libraries (i.e. trousers, jtss, jsr321, , tpm/j). based on number of requirements tpm/j fits bill , i'm able accomplish majority of operations necessary binding/unbinding, signing/verifying, etc. however 1 issue have come across key handle. according specs issued trusted computing group, 1.2 , 2.0 , both declare key handles 32-bit values. when run tpm/j , load key tpm issues key outside of 32-bit space. for example if run following command: sudo java edu.mit.csail.tpmj.tools.tpmloadkey testkey.key srk "" i receive following output: parsing command-line arguments ... using srk parent. parentpwd = null, encoded (null [no authorization]) = null read testkey.key ... loading key tpm ... keyhandle = 0xc5e94bf9 if calculations (and online conversion tools found) correct key handle above computes 3,320,400,889 outside 32-bits. believe 32-bit signed values limited around 2 billion . this be...

AngularJS: custom $resource actions don't work -

i'm trying define custom getusers action $resource, error object has no getusers method. angular.module('myapp') .factory('customer', ['$resource', 'apiurl', function ($resource, apiurl) { return $resource(apiurl + '/customers/:id', { query: {method: 'get', isarray: true}, get: {method: 'get'}, getusers: {method: 'get', url: apiurl + '/customers/:id/users', isarray: true} }); }]); using customer.getusers({id: 'id'}) i'm using 1.2.0-rc2. missing here? angular.module('myapp') .factory('customer', ['$resource', 'apiurl', function ($resource, apiurl) { return $resource(apiurl + '/customers/:id', { query: {method: 'get', isarray: true}, get: {method: 'get'}, getusers: {method: 'get', url: apiurl + '/customers/:id/users', isar...

ios - Facebook API response Xcode Parse -

this question has answer here: best json library use when developing iphone application? [closed] 14 answers ios json nsstring parse 2 answers i working on project parse facebook graph api response in xcode. got success in getting response newbee parse facebook api response via xcode. { "data": [ { "category": "sports", "name": "tennisclubbers", "access_token": "caacedeose0cbacqzcqkbeqjw4npjxthu6hdr4verehvaqhalragjunkoa76txn9kesfggrw2yxeape6lznwkoen9yffx02g7qvhdbmufeycfh2oejahrdgmxyel9nwvth7r5b3lkvilhfzcplulg6vjlcybsnmoxkkohfvqusjtbldzv7zozajc2gkemdxs1r65f9mevwzdzd", "perms": [ "administer", "edit_profile", "create...

c - Why this code does what it does? -

there's recent question posted. here's link: output sorted in weird way i know how it's wrong, i'm trying figure out is, why produces it's output way is? after changing getch() getchar() compiled , run few times. changes first 4 letters . can't see where change actuallly takes place in code. appreciated. this happens in swap function: //swapping function void swap(char **first, char **second) ... the op assumed 'char *' integral type, , moving around move the string around. second part swap function should accept pointers data, not actual data. swaps addresses of data , not touch data itself. however, when called char * * , goes wrong. swaps data @ address of 'a pointer to'. input not "pointer to-pointer to". 'pointer to' has sizeof int on systems (where 'most' subjective assessment -- search "sizeof pointer" discussions , opinions). routine swaps not string or pointer-to-stri...

node.js - Is it possible to decode an AES encrypted video with node-webkit file on the fly? -

with file-encryptor , node-webkit simple encrypt local videofile (webm) local encrypted file myvideo.dat . but there way decrypt , view video? without temp file? the file-encryptor encrypts webm container, should encrypt video stream webm encryption rfc . use webm_crypt tool repository https://chromium.googlesource.com/webm/webm-tools/ . for example: $ webm_crypt -i video.webm -o encrypted_video.webm this generate key file named vid_base_secret.key $ webm_crypt -i video.webm -o encrypted_video.webm -video_options base_file=vid_base_secret.key in wiki of webm project can find more information although relatively new.

foreach - php array : how to access the "$key-1" in an associative array? -

i got existing foreach set of conditions , i'd keep , add end date beginning date of line before + 1 day how access "$line-1" do: foreach($tab $line){ if line before $line[beginning_date] exists $line[end_date]= line before $line[beginning_date] value +1 } good enough? $thelinebefore = null; foreach($tab $line){ if line before $line[beginning_date] exists $line[end_date]= line before $line[beginning_date] value +1 $thelinebefore = $line; }

Changing the leaflet map language? -

please possible ** change language of leaflet map ** tiles in specific area? changing arabic language if use plugin leaflet gives google map tiles , based on browser settings according google's api concepts page . you can open street map labels in various languages adding language identifer tile server link. this: http://{s}.www.toolserver.org/tiles/osm-labels-ar/{z}/{x}/{y}.png still need background tiles well. here's working jsfiddle arabic . the list of languages can found @ toolserver.org . for other tile servers, don't imagine there in other languages, specific each company generates them.

whitespace - White Space between inline block elements -

what actual value of space between inline block elements relative container's font-size? seems 0.3ems. does know if correct? revising origin question more specific. is there standard cross browser width of u+0020 character relative font size if it? white space between inline block elements (or inline elements) has same effect single space u+0020 character, html specifications. (ref.: section text in html 4.01 spec.) text justification affect this, however, presumably not relevant here. the width of space depends on font, i.e. set font designer. according microsoft’s character design standards space characters, minimum width of space should 1/5 em; “average” value 1/4 em; , “wide” font, 1/3 em; maximum 1/2 em.

haskell - How to use replicateM? -

i started learning code haskell apologies if stupid question. trying redo 8 queen problem making use of [] monad. here code, import control.monad addqueen :: [int] -> [[int]] addqueen xs = [x:xs|x<-[1,2..8], not $ x `elem` xs || (any (\(index,q) -> abs (x-q) ==index) $ zip [1..] xs)] when try to [[]]>>= replicatem 8 addqueen it not work yields following error: couldn't match expected type `t0 -> t1' actual type `[[a0]]' first argument of ($) takes 1 argument, type `[[a0]]' has none in expression: [[]] >>= replicatem 8 $ addqueen in equation `it': = [[]] >>= replicatem 8 $ addqueen so how achieve want here? replicatem wrong choice here: prelude control.monad> :t replicatem replicatem :: (monad m) => int -> m -> m [a] prelude> let addqueen :: [int] -> [[int]]; addqueen [] = undefined this means in expression replicatem 8 addqueen , m ~ ([int] -> [[int]]) i.e. m ~ ((->) [int]) , ...

android - i have no errors so why is my app force closing? -

hi rank amateur @ coding in android yet i've managed far have come problem relatively simple, first screen plug in text printed next screen there few buttons, have yet defined intent 1 of those, used display second activity , force close when clicked button on second activity, cannot secondactivity. want first activity display next activity buttons open seperate activities can tell me i've gone wrong? bathactviity.java package com.example.myapplication; import android.os.bundle; import android.app.activity; import android.widget.button; public class bathactivity extends activity { button button; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_bath); button = (button)findviewbyid(r.id.nextbutton); } } activity_bath.xml <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent...

python - os x mountain lion with homebrew and EPD 7.3-2 (64-bit) not playing nice -

os x mountain lion homebrew package manager , python 2.7.3 -- epd 7.3-2 (64-bit) not playing nice together. please see details shown below. appreciated. in advance. regards, cachapa last login: tue sep 24 05:28:30 on ttys004 ~ ❯❯❯ echo $path /users/mlb/.rbenv/shims:/usr/local/bin:/usr/local/sbin: /library/frameworks/epd64.framework/versions/current/bin: /usr/bin:/bin:/usr/sbin:/sbin ~ ❯❯❯ python /library/frameworks/epd64.framework/versions/current/bin/python ~ ❯❯❯ python --version python 2.7.3 -- epd 7.3-2 (64-bit) ~ ❯❯❯ brew doctor warning: "config" scripts exist outside system or homebrew directories. `./configure` scripts *-config scripts determine if software packages installed, , additional flags use when compiling , linking. having additional scripts in path can confuse software installed via homebrew if config script overrides system or homebrew provided script of same name. fo...

c# - Using Service Bus 1.0 with Saml -

i'm building cross domain messaging service uses claims communicate services inside domain. in messaging service have: this.messagefactory = messagingfactory.create(); this.namespacemanager = namespacemanager.create(); tokenprovider tokenprovider = tokenprovider.createsamltokenprovider(saml, new uri("https://<messaging service>:9355/<application namespace>/")); this.messagefactory.getsettings().tokenprovider = tokenprovider; this.namespacemanager.settings.tokenprovider = tokenprovider; where saml variable string of xml representing saml token. later on call if (this.namespacemanager.topicexists(topicname) == false) { this.namespacemanager.createtopic(topicname); } when if statement called error: the token provider service not avaliable when obtaining token 'https://<messaging service>:9355/<application namespace>/wrapv0.9/'. with inne...

java - Android Heart beat recording apps -

i doing android app analyze our heart beat rate recording sound. while apps recorded user heart beat sound in audio file, have no idea how algorithm analyze heart rate, can in fft?? what audio file contain? did record heart beat holding smartphone on heart? you should implement noise reduction , try main beat repeating loudest peak point in recording. fft give frequency of signal energy (loudest) counting peaks should bring same solution. but before start implementing anything. listen recording , ask yourself, if can hear heartbeats. ears 1 of best noise reduction systems in world. if cant hear it, neither fft nor other algorithm it.

Plugin content always on top of post Wordpress, PHP -

im trying make wordpress plugin. done , working, except 1 thing. i have added shortcode plugin. no matter in content call shortcode , contents gets on top of post, instead of placed tag. the code outputs something: public static function showincomingsearches(){ global $id; $arsearches = self::getarobj(array('wp_post_id' => $id)); ob_start(); if(!empty($arsearches)){ $str = '<ul>' . php_eol; foreach($arsearches $osearch){ $str .= '<li>'.htmlspecialchars($osearch->searchterm).'</li>' . php_eol; } $str .= '</ul>'; if(!empty($arsearches)) echo $str; } else { echo ' '; } return ob_get_clean(); } and shortcode functionality: add_shortcode('show_incoming_searches', 'checkreferrer'); function checkreferrer(){ incomingsearches::checkreferrer(); echo incomingsearches::showincomingsearches(); } could explain me why it's on top of conte...

javascript - Why is my canvas blank except for in a corner? -

i'm in process of learning javascript playing canvas, i've managed make grid of squares randomly generated color. i decided make each squares color increase , decrease in intensity result small corner of grid being drawn, , color doesn't change. doing wrong? online code here , paste bin here . var canvas = document.getelementbyid('mycanvas'); var ctx = canvas.getcontext("2d"); ctx.clearrect(0, 0, canvas.width, canvas.height); function square(x, y) { this.x = x; this.y = y; this.sizex = 10; this.sizey = 10; this.colo = colo; function colo() { var r = math.floor(math.random() * (255 - 1) + 1); var g = math.floor(math.random() * (255 - 1) + 1); var b = math.floor(math.random() * (255 - 1) + 1); var run = true; var rup, gup, bup = true; while (run) { if (rup) { if (r == 255) { rup = false; } else if (r == 0) { ...

javascript - Array attribute of scope in directive is emptied upon reference -

my directive looks this: angular.module('app') .directive('chart', function () { return { template: '<div class="chart"></div>', restrict: 'e', replace: 'true', scope: { data: '=' }, link: function (scope, element, attrs) { console.log(scope); console.log(scope.data); } };}); and gets passed array controller in view. <chart data="array"></chart> the console output looks follows: scope {...} $id: "006" $parent: child $root: scope ... data: array[1] 0: 10300 length: 1 __proto__: array[0] this: scope __proto__: object and [] when scope object displayed in console has 'data' attribute length 1 , entry '10300', when scope.data printed empty array '[]'. why? confused :) the problem array initialized in...

java - Save drop-down list value to database in Struts 2 with Hibernate -

i want save selected value of drop-down list database. first index.jsp loaded. index.jsp , can go register.jsp when click register url of index.jsp . struts.xml : <action name="registeraction" class="action.registeraction" method="populateselect"> <result name="success" >register.jsp</result> </action> <action name="register" class="action.registeraction" method="execute"> <result name="success" >login.jsp</result> </action> index.jsp : <s:url id="url" action="registeraction"> </s:url> <s:a href="%{url}">register</s:a> register.jsp : <s:form action="registeraction" method="execute"> <s:select label="select date of month" key="month list" name="months" headerkey="0" headervalue=...

coffeescript - out of three libraries, require.js is failing to load one; how can I find out why? -

i've got 3 libraries loading require.js: require(['lib/alpha', "lib/delta", "lib/gamma"], (alpha, delta, gamma) -> # initialize objects libraries etc. they pretty similar: # names changed ip protection, code may funny define(-> class alpha constructor: ({@type, @user, @data}) -> @time = new date() ) define(-> class delta constructor: ({@logger, @config, @socket, @util}) -> #@logger.debug arguments @room = null (@util ?= {}).inspect ?= json.stringify # more functions ... ) define(-> class gamma alphas = null constructor: ({@logger, @config, @alphautility, @newid}) -> throw 'alpha utility not defined' unless @alphautility? # more functions ... ) however, , no reason can discern, delta not loading via require . it's undefined in callback. relevant details: i haven't touched code in delta in weeks rolling code last week has no effec...

spring security core grails not logging in -

installed spring security core plugin did quickstart here user domain class package auth class user { def springsecurityservice string username string password boolean enabled boolean accountexpired boolean accountlocked boolean passwordexpired static mapping = { // password keyword in sql dialects, quote backticks // password stored 44-char base64 hashed value password column: '`password`', length: 64 } static constraints = { username blank: false, size: 1..50, unique: true password blank: false, size: 8..100 } set getauthorities() { userrole.findallbyuser(this).collect { it.role } set } def beforeinsert() { encodepassword() } def beforeupdate() { if (isdirty('password')) { encodepassword() } } protected encodepassword() { password = springsecurityservice.encodepassword(password, username) } } and boostrap.groovy is c...

javascript - Return function multiple times instead of one time using .fadeOut(); -

i don't know if suppoused this, guess is... i thought @ first may wrong whole script , managed make new file on localhost , test fadeout(); function. apparently returned function twice again went jsfiddle check happen there. , same thing happened. in case console.log(); returned twice. what did , trying ? well want return specified function, or in fiddle sample, specified console.log(); once. fadingout multiple elements (two, exact). is there way that, instead of duplicating each element fadeout @ same time ? sample return console.log(); twice. settimeout(function () { $( ".one, .two" ).fadeout(300, function () { console.log("return function!"); }); }, 2000); sample return console.log(); once. settimeout(function () { $( ".one" ).fadeout(300); $( ".two" ).fadeout(300, function () { console.log("return function!"); }); }, 2000); fiddle preview: fiddle redirect ...

Magento product upload images are not appearing -

i'm uploading products magento store products not being displayed. i can upload image using admin area , when managing products can see images there, once go front end magento logo product image should appear. this has been happening since server migration i'm not sure if related or not. there many things causing issue, here's few things into: on product information page in admin backend, under 'images', make sure radio buttons have image selected 'base image', 'small image', 'thumbnail', , aren't 'excluded' make sure product images exist under /media/catalog/product/ (relative document root) make sure /media directory in apache web server's group (usually 'www-data' or 'httpd'). magento needs able write directory, can run command set permissions: sudo chmod -r 775 /path/to/magento/media in system->configuration->general->web, make sure "base media url" correct under ...

aptana3 - Aptana version 3.4.2.201308081805 crash -

i have aptana version 3.4.2.201308081805 on linux mint 15 64bit open once , anytime when want start aptana crash here 1 few crash log: # # fatal error has been detected java runtime environment: # # sigbus (0x7) @ pc=0x00007fab6e08a938, pid=4403, tid=140373276522240 # # jre version: 7.0_25-b30 # java vm: openjdk 64-bit server vm (23.7-b01 mixed mode linux-amd64 compressed oops) # problematic frame: # c [libzip.so+0x4938] java_java_util_zip_zipfile_getzipmessage+0x8d8 # # failed write core dump. core dumps have been disabled. enable core dumping, try "ulimit -c unlimited" before starting java again # # if submit bug report, please include # instructions on how reproduce bug , visit: # https://bugs.launchpad.net/ubuntu/+source/openjdk-7/ # crash happened outside java virtual machine in native code. # see problematic frame report bug. # don't use openjdk use java 7 wbupd8 repository sudo apt-add-repository ppa:webupd8team/java prerequirements ...

LLVM backend module pass -

i write pass @ backend goes on machinebasicblock in graph order , check if each 3 consecutive machinebasicblock property achieved. any idea how write pass? this blog post explains how walk basic blocks in various graph orders (focusing on topological, providing pointers others well). same can applied machinebasicblock , using same mechanisms.

function - Excel - Return the first negative number of a column -

i'm using excel 2010 , i'm looking way return first negative number of column. instance, have following numbers distributed in column: 1 4 6 -3 4 -1 -10 8 function use return -3? thanks! this interpreted 2 ways... if numbers in single cell (one column) string, mid function can used. if numbers in a1, formula work this: =value(mid(a1,search("-",a1),search(" ",a1,search("-",a1))-search("-",a1))) if numbers each in own columns (in example, a3:h3), different technique must used: {=index(a3:h3,1,match(true,a3:h3<0,0))} don't type { } - enter equation using ctrl + shift + enter . in each case, formula return number -3, first negative number in series.

jquery - find input field where type=text in the table row -

i have delete image that triggered 'click' handler. i'm passing element parameter function triggered event, delete image. is there way can find input type="text" table row of delete image clicked? here code i'm working with: a4j.ajax.addlistener({ onafterajax: function(req,evt,data) { j$('[id$=deleteimage]').on('click', function(elem) { console.log('the delete button clicked'); console.log('************** before ' + localstorage.activebuttons); var activearray = localstorage.activebuttons.split(','); var idx = activearray.indexof('account'); if (idx > -1) activearray.splice(idx, 1); localstorage.activebuttons = activearray.join(','); console.log('************** after ' + localstorage.activebuttons); ...

c# - Index Of Row To Copy Is Out Of Range -

ill start off code , explain problem. var customeraddresses = new custdeliveryaddresses(); // select columns customeraddresses.query.columns.add(new column(custdeliveryaddress.field_description)); customeraddresses.query.columns.add(new column(custdeliveryaddress.field_postcode)); // filter customer. customeraddresses.query.filters.add(new filter(custdeliveryaddress.field_customerdbkey, customerlookup.customer.slcustomeraccount)); // find customeraddresses.find(); var addresses = custdeliveryaddress address in customeraddresses select new { address.description, address.postcode }; //customerdeliveryaddesses.autogeneratecolumns = false; customerdeliveryaddesses.datasource = addresses.tolist(); so, when addresses.tolist() assigned datasource property of datagridview (c...

regex - Replace line in text file using PHP -

i have text file following data: 1_fjd 2_skd 3_fks i want replace part in text file using php. example want this: find line starts " 2_ " , replace " 2_word ", after '2_' being replaced by:'word'. how can in php? you don't need regex this. try following: load file array using file() , loop through lines check if string starts 2_ if does, replace input $word , concatenate $result string if if doesn't, concatenate $result string use file_get_contents() , write result file code: $lines = file('file.txt'); $word = 'word'; $result = ''; foreach($lines $line) { if(substr($line, 0, 2) == '2_') { $result .= '2_'.$word."\n"; } else { $result .= $line; } } file_put_contents('file.txt', $result); now, if replace took place, file.txt contain like: 1_fjd 2_word 3_fks

php - Why have a different salt for every password? -

this question has answer here: salting password: best practices? 8 answers secure hash , salt php passwords 14 answers adding long salt prevents attacker use rainbow table attack. add, example, fve4qrwgfagvwrvfedsgfgbvseasionvwegsf32 passwords before hashing, he's not going have rainbow table these words. so, why use different salt every password? reason see attacker create rainbow table once default salt, , use rainbow table then. it?

jquery - Trigger event on dialog box open -

my dialog box defined under div #dialogbox when dialog box opens want trigger event such alerts open. code im using is: $("#dialogbox").dialog({open: function(){ alert("open"); } }); but doesnt seem trigger when dialog box opened please help you can use : $( ".selector" ).dialog({ open: function( event, ui ) {} }); or event listener .on $( ".selector" ).on( "dialogopen", function( event, ui ) {} ); more information in page : http://api.jqueryui.com/dialog/#event-open

ios - Are view.superview.layer and view.layer.superlayer the same? -

for uiview view, view.superview.layer same view.layer.superlayer ? in case not same? they should same. there way weird things, swizzle superlayer getter, or override layer getter, or whatever, if you're 1 controlling uiviews, shouldn't have worry strange cases. can nsassert() case if you're paranoid.