Posts

Showing posts from September, 2015

magento - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'SUM((IFNULL(main_table.base_total_invoiced, 0) -

i on magento 1.9.1 , worked fine. wanted uppgrade zend framework 1.12.7 1.12.13. after uppdating got error message when logging in backend. -- sqlstate[42s22]: column not found: 1054 unknown column 'sum((ifnull(main_table.base_total_invoiced, 0) - ifnull(main_table.base_tax_invoiced, 0) - ifnull(main_table.base_shipping_invoiced, 0) - (ifnull(main_table.base_total_refunded, 0) - ifnull(ma' in 'field list', query was: select `sum((ifnull(main_table.base_total_invoiced, 0) - ifnull(main_table.base_tax_invoiced, 0) - ifnull(main_table.base_shipping_invoiced, 0) - (ifnull(main_table.base_total_refunded, 0) - ifnull(main_table.base_tax_refunded, 0) - ifnull(main_table.base_shipping_refunded, 0))) * main_table`.`base_to_global_rate)` `lifetime`, `avg((ifnull(main_table.base_total_invoiced, 0) - ifnull(main_table.base_tax_invoiced, 0) - ifnull(main_table.base_shipping_invoiced, 0) - (ifnull(main_table.base_total_refunded, 0) - ifnull(main_table.base_tax_refunded, 0) ...

ajax - Javascript trim whitespace on click -

i have email form field. on click, executes javascript ... $(document).on('click', '#add_delegate', function() { registrationhelper.added_delegate = true; // var button = $(event.target); var button = $(this); var uri = button.data('url'); if (typeof uri === 'undefined') { return false; } var input = $('#email_search'); var data = {email:input.val()}; data.text().replace(/ /g,''); var spinner = $('#delegate_add_spinner'); spinner.css({display:'inline-block'}); $.ajax({type:'post', url: uri, data:data}).success(function(card) { var html = $(card); var data_id = html.attr('data-id'); var existing_elem = $('.mini_addresscard[data-id=' + data_id + ']'); if (existing_elem.length < 1) { input.popover('hide'); // in seperate timeout because ie8 damn stupid; crashes if run directly settimeout(function () { $(...

Font missing with Crystal Reports generated PDF -

Image
i have crystal report 8.5 file, need export pdf. that report contains field need represent bar code. achieve use truetype font. if open generated pdf file on machine see bar code. but if open machine doesn't have font installed, see numbers. how can assure codebar visible on pdf if computer doesn't have font installed? if not want include font, can generate image , call via http. the barcode below generated using online barcode generator courtesy of wasp: http://www.waspbarcode.com/services/waspbarcode/barcodegen.ashx?symbology=code128&code=font_missing_31301980 steps report: create blank jpg using ms paint. resize without aspect ratio checked on. insert image placer holder such 50x323 png crystal report right-click on graphic , select format graphic... click on picture tab, click on formula, enter formula create formula url above. want retrieve barcode data database , concatenate prefix , barcode field together: "http://...

python - Flask and Jinja for loop skip if file contains errors -

i'm having issue trying display thumbs. problem when run jinja2 variable displays alt text, rather have skip or pass if thumb contains errors instead of displaying alt text. here code {% block content %} {% if games %} {% g in games if g.game_thumb %} <img src="static{{ g.game_thumb }}" class="img-rounded" alt="{{ g.game_name }}" width="150" height="150"> {%endfor%} {% endif %} {% endblock %} i ended solving via flask route via. from pil import image try: image.open(thumb).verify() print "image" except: print "failed" continue

Using PHP to Create XML; Accessing via Flash -

i working on project need continuously create , update xml file. feasible way php; can't use filereference in flash because save as; cannot use filestream because i'm using flash player, not air; don't want use sharedobject because need user able access data in xml multiple computers. basically, whenever user clicks on something, flash grabs color of object. need put color, each time clicked, xml file (there 1 file; stores of colors, , continuously updated). reason needs continuously updated because there no save button; once user exits page, they're done. need progress saved. is there way generate xml using php/flash? understand how generate xml file in php, i'm unsure on how update using flash (which uses php). the main idea have right use loader in as3 php file, grab php file's data, xml file. once load php file in flash, can modify xml file using flash? if not, how modify using flash php? sorry if confusing; spent hours creating couple different ...

module - How can I use import, from import and sys.append together in Python -

i have directory add sys.path import custom modules. correct/best way use import, import , sys.path together? mean if acceptable use sys.path.append in between "imports". for example: #!c:/python27 import sys sys.path.append('c:\\users\\user\\mypythonmodules') import writedata wd import os import csv collections import defaultdict edit: i should have mentioned writedata custom module want import wd . module writedata located in c:\\users\\user\\mypythonmodules yes, is. there no syntax or semantic rule in language prevents that. i not aware of "style" rule may breaking, in case, option providing pythonpath python interpreter.

asp.net mvc - Cannot display error message on Editor or EditorFor -

in mvc application, can display error messages inputs i.e. textboxfor , dropdownlist , etc. however, using same approach, cannot show validation error kendo().editor() or kendo().editorfor() . tried validationmessage beside validationmessagefor , not make sense. might problem be? view: <script type="text/javascript"> $(function () { //for using kendo validation: $("form").kendovalidator(); }); </script> //validation works textboxfor, dropdownlist, etc.: @html.labelfor(m => m.summary) @html.textboxfor(m => m.summary, new { maxlength = 50, @class = "k-textbox"}) @html.validationmessagefor(m => m.summary) //validation not work editor or editorfor: @html.labelfor(m => m.description, new { maxlength = 1000, @class = "editor-label" }) @(html.kendo().editor() //@(html.kendo().editorfor(m=>m.description) //also tried .name("description") .htmlattributes(new { @class...

c# - How to make TableLayoutPanel with resizable cells like using Splitter -

got tablelayoutpanel 1 column , n rows needed cells resizable somthing splitter component between cells. without using splitcontainer. may other idea without tablelayoutpanel? it depends on want it: datagridview brings interactivity, cells neither controls nor containers.. you can try if tablelayoutpanel subclass want: public partial class splittablepanel : tablelayoutpanel { public int splittersize { get; set; } int sizingrow = -1; int currentrow = -1; point mdown = point.empty; int oldheight = -1; bool isnormal = false; list<rectanglef> tlprows = new list<rectanglef>(); int[] rowheights = new int[0]; public splittablepanel() { initializecomponent(); this.mousedown += splittablepanel_mousedown; this.mousemove += splittablepanel_mousemove; this.mouseup += splittablepanel_mouseup; this.mouseleave += splittablepanel_mouseleave; splittersize = 6; } void spli...

How do I change CSS submenu width so it doesn't used the same width as the main menu? -

i'm using css submenus working ul > li > ul > lu. current css code using: #nav li:hover ul.sub {left:1px; top:38px; background: #bbd37e; padding:3px; border:1px solid #5c731e; width:100%; height:auto;} the width find top menu, within sub menu, uses original width value top menu. if change width 325%, submenu wide enough top menu wide. i've been messing css format, can't seem submenu hold own 100% width value separate top menu. does have solution on how use 100% width match contents, , not value of top menu? if wants peak see mean, can have here: http:// i have set 100% width show results of submenu. due way have css written, want change following rule in css file: #nav li:hover li:hover ul, #nav li:hover li:hover li:hover ul, #nav li:hover li:hover li:hover li:hover ul, #nav li:hover li:hover li:hover li:hover li:hover ul { left: 100%; /* may want use "left:calc(100% + 3px);" account padding */ width: auto; }

javascript - Web API call to controller not working, breakpoints not hit, prior versions of code no longer work (UPDATED WITH ANSWER) -

a view in intranet asp.net mvc website uses web api render image thumbnails when user hovers on documents (normally, graphic appears looks first page of document). i'm stuck because code working before; i'm not sure if outside code modification third party (or bad code on part) broke it, don't see image thumbnails. i'm having difficulty determining happened. here's i've done far: modified code directly this 1 of first things do: presume mistake due kind of error (or forgot do). problem area focused on javascript/jquery snippet, inside <script> area of code on view: $(".tile2").each(function () { $(this).tooltip({ content: "<img src='/jportal/api/portaldocument/thumbnail?u=" + this.id + "' />" }); }); the .tile2 class reference each individual document rendered on page. $(this).tooltip *has code thumbnail functionality. * this.id is reference unique id each file (which looks long ...

c# - POST to my localhost on port 5587 -

Image
i want able write code interacts app running on computer listening on port 5587. static void main(string[] args) { httppost("http://localhost:5587", "/send/?username=testingname&password=testingpw"); } public static string httppost(string uri, string parameters) { system.net.webrequest req = system.net.webrequest.create(uri); req.proxy = webrequest.defaultwebproxy; //add these, we're doing post req.contenttype = "application/x-www-form-urlencoded"; req.method = "post"; //we need count how many bytes we're sending. params should name=value& byte[] bytes = system.text.encoding.ascii.getbytes(parameters); req.contentlength = bytes.length; system.io.stream os = req.getrequeststream(); os.write(bytes, 0, bytes.length); //push out there os.close(); system.net.webresponse resp = req.getresponse(); if (resp == null) return null; system.io.streamreader sr = new system.io.st...

assembly - Converting binary word microinstruction to mnemonic -

Image
the binary words i'm referring image: i have found believe correct answers. want double check , sure. line1: r[33] <- sext13(r[37]); line2: r[33] <- add(r[rs1], r[33]); goto 1793; line3: r[33] <- add(r[rs1], r[rs2]); if r[ir[13]] goto 1810; i appreciate can give me yes right at least if r[ir[13]] means bit 13 of %ir , not register number ir[13] possibly r0 or r1 ir[13] bit. a more detailed analysis: line 1 amux b bmux c cmux wr rd alu binary 100101 0 000000 0 100001 0 0 0 1100 meaning 37 mir 0 mir 33 mir no wr. no rd. sext13(a) cond jump addr binary 000 00000000000 meaning use next address 0 encodes: r33 = sext13(r37) , move next microcode location . line 2 amux b bmux c cmux wr rd alu binary 000...

ASP.net what is MasterPageFile attribute? -

<%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<modelcentral.abmodel>" %> asp.net means masterpagefile attribute? each .aspx page can reference master page. master page can define general layout specific page (obviously can use masterpage multiple pages). imagine have standard website main menu, content area , footer. master page include main menu , footer since don't change. master page contains <asp:contentplaceholder> later populated content of .aspx-page. a master page can contain multiple <asp:contentplaceholder> . in .aspx-page can use <asp:content> control populate <asp:contentplaceholder> content. note have match contentplaceholderid of <asp:content> correct id of `. read this article more information on subject.

node.js - Tailable cursor closing when reaching end of collection -

i attempting stream data mongodb capped collection follows: var query = {}; var options = {tailable: true, awaitdata: true, numberofretries: number.max_value}; var stream = mycoll.find(query, options).stream(); stream.on('data', function(doc){ console.log(doc); }).on('error', function (error){ console.log(error); }).on('close', function () { console.log('closed'); }); this prints documents expected upon reaching end of collection stream closes. possible prevent happening? looking have program print data arrives in collection, waiting @ end of collection indefinitely more data. solved problem. turns out issue wasn't formatting options correctly. mycoll.find().tailable(true, { awaitdata: true ,numberofretries: number.max_value}).stream(); is correct , works expected.

zend framework2 - How can I use > and < operation in zf2 doctrine custom repository -

i want run $qry = $qb2->where("n2.userfk!=0 , n2.id >1 <20") in doctrine repository not working. giving error > , < operators. use expressions : $expr = $qb2->expr(); $qry = $qb2->andwhere( $expr->neq('n2.userfk', 0) $expr->andx( $expr->gt('n2.id', 1), $expr->lt('n2.id', 20) ) );

objective c - iOS Customize UItableView header -

Image
i new ios development. pretty familiar android , android studio struggling ios , xcode. basically want add title header, under title provided through creating uitableview. there way through storyboard, or code better option? if so, how should attempt this. have not been able find google searching , information have found isn't incredibly applicable. this first question can't add picture. looks , want add second title display date , location under event name: event name ------------- from storyboard can drag uiview uitableview, above cells in table, become headerview. there can drag whatever want view.

docker - How to make Secure Gateway Client to resolve the hostname of the destination's host -

i use hostname instead of ip address destination's host in bluemix secure gateway. use docker secure gateway client. tried realize editing /etc/hosts of host os in docker secure gateway client installed , running sg client --net=“host” or --add-host=hosname:ip address. secure gateway service seems not use dns regarding following q&a's answer, tried use /etc/hosts. how resolve sg client's enotfound error but couldn't succeed, sg client got enotfound. teach me how make secure gateway client resolve hostname of destination's host. [results of --net=“host“] i confirmed host os resolved hostname. #ping httpserver1 ping httpserver1 (192.168.56.1) 56(84) bytes of data. 64 bytes httpserver1 (192.168.56.1): icmp_seq=1 ttl=128 time=7.10 ms 64 bytes httpserver1 (192.168.56.1): icmp_seq=2 ttl=128 time=6.89 ms i ran sgclient --net=“host“ # docker run -it ibmcom/secure-gateway-client xxxxxxxxxx --net=“host“ ibm bluemix secure gateway client ver...

javascript - Showing wrong date conversion in angular v1.1 -

i having time="2015-06-26t18:50:07.000z" using angularv1.1 ,i can not use utc , dont have milliseconds well, have time string in html <div ng-app='myapp' ng-controller="myctrl"> {{date | date:"mm/dd/yyyy" }} </div> in controller var x="2015-06-26t18:50:07.000z" var app=angular.module('myapp',[]); app.controller('myctrl',function($scope){ $scope.date=x; }); where want output 06/26/2015 , showing 06/27/2015 may problem of gmt or utc whatever . please suggest me ,what can show 06/26/2015 fiddle: http://jsfiddle.net/obv10wd9/2/ please check one. you can this. var x="2015-06-26t18:50:07.000z" var app=angular.module('myapp',[]); app.controller('myctrl',function($scope){ var date=new date(x); $scope.date = new date(date.gettime() +(date.gettimezoneoffset()*60000)); console.log(typeof $scope.date) }); here updated fiddle

r - Error: term has fewer unique covariate combinations than specified maximum degrees of freedom -

i'm trying smooth mortality data, error when try call smooth.demogdata(...) . don't have lot of years work (just 2004-2014), , ages 1-11. need have smoothed mortality data able run lee-carter models. > us.demog.age = demogdata(us_rates.age, us_counts.age, ages = 1:11, years = 2004:2014, type="mortality", name="total", label="us") > smooth.age = smooth.demogdata(us.demog.age) error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) : term has fewer unique covariate combinations specified maximum degrees of freedom the matrix data have demography data call follows: > us_counts.age 135618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 150988, 125213, 0, 0, 0, 0, 0, 0, 0, 0, 0 144797, 144686, 117643, 0, 0, 0, 0, 0, 0, 0, 0 145921, 138953, 136791, 110374, 0, 0, 0, 0, 0, 0, 0 146350, 139452, 131145, 128469, 103897, 0, 0, 0, 0, 0, 0 159301, 139080, 130705, 122500, 120655, 97922, 0, 0, 0, 0, 0 169750, 151355, 130195, ...

c# - Microsoft Access OledbDataReader read values error -

i connecting ms access file jet engine x64,but worked x86 platform. getting error while trying read data long sizecounter = 0, rowindex = 0; var secondvalues = new object[batchsize][]; (var secondindex = 0; secondindex < secondvalues.length; secondindex++) secondvalues[secondindex] = new object[reader.fieldcount]; while (reader.read()) { //todo:error here... reader.getvalues(secondvalues[sizecounter]); sizecounter++; if (notifyafter > 0 && (rowindex % notifyafter == 0 && rowindex > 0 && rowscopied != null)) { rowscopied(this, new rowscopiedeventargs(rowindex)); } if (sizecounter == batchsize) { runbulkcopy(secondvalues); sizecounter = 0; } rowindex++;...

angularjs - AgularJS: How to close active $modal on session timeout -

i'm developing spa, on session timeout redirect user login page. here implementation .run(['$rootscope', '$state', '$location', function ($rootscope, $state, $location) { $rootscope.$watch(function detectidle() { var = new date(); if (now - lastdigestrun > 20 * 60 * 1000) { $location.path('/login'); settimeout(function () { alert("your session has expired. please log in again"); }, 1000); } }); }]) problem: if application timeouts when $modal open, page redirect login page $modal not close. please me solve problem thanks update: sorry answering own question, working solution given below: .run(['$rootscope', '$state', '$location', function ($rootscope, $state, $location) { var issessiontimeout = false; $rootscope.$watch(function detectidle() { var = new date(); if (now - lastdigestrun > 20 * 60 * 1000) { ...

masstransit - Mass Transit store and forward -

i looking @ mass transit documentation exemples find not beginner friendly, @ least me. can implement store , forward reliable messaging mt? should use msmq or rabbit mq then? example appriciated. if looking great series of blob posts started, at http://looselycoupledlabs.com/2014/06/masstransit-publish-subscribe-example/ there subsequent posts detail how various other messaging patterns using rabbitmq well.

Find Variable Declaration in Mathcad -

is there way find variable defined/declared in mathcad. i'm working in rather large mathcad (150 pages printed). i'll see equation using variables declared in earlier sections can't use edit->find since variable uses subscripting. resort eye scanning variable declaration. in eclipse can control click on variable , take variables declaration. there similar in mathcad? unfortunately, there isn't 'search definition' feature. believe there have been number of requests on years ... why can't edit/find, though? kind of subscripting referring to: index or name? version of mathcad using? search array name shouldn't problem, index won't form part of name. if want subscripted name , using mathcad 15 (or lower), type name enter it; eg if variable x sub type x.sub in find box.

python slow in socket operations -

i have server written in java , client written in python. when run client script(it creates 10k clients sending data infinitely),majority of time spent in socket creation , connection. have server running on system connected through lan. when run java client program, time taken 3-6 times less python. problem of python? or there problem in code? here program reference. import array import os import sys import encodings import subprocess import datetime import binascii import string import random import time import threading import socket p=input("enter no of client...") host=raw_input("enter host name") host=socket.gethostbyname(host) port=input("enter port no......") f1=open("xys.txt","a") f2=open("string.txt","a") def id_generator(length,a,b): # generates unique random values between given range random.seed() while(1): x=''.join(random.choice(a+b) _ in range(length)) if...

json - FlexJson ClassNotFound Exception on Android 4.4.4 -

i´ve got multidex project android devices. use flexjson. i´ve tested flexjson 3.3 , 2.x. it works android 5.x crashes in android 4.4.4. it looks dex support library not working propperly older android versions cannot tell. here´s stacktrace: 06-29 03:50:44.763 11884-11884/com.pigdroid.gameboard e/androidruntime﹕ fatal exception: main process: com.pigdroid.gameboard, pid: 11884 flexjson.jsonexception: [ layers.values ]: not load com.pigdroid.game.board.tile.model.inttilelayer @ flexjson.objectbinder.findclassinmap(objectbinder.java:250) @ flexjson.objectbinder.findclassname(objectbinder.java:213) @ flexjson.objectbinder.bind(objectbinder.java:92) @ flexjson.objectbinder.bindintocollection(objectbinder.java:110) @ flexjson.factories.listobjectfactory.instantiate(listobjectfactory.java:13) @ flexjson.objectbinder.bind(objectbinder.java:95) @ flexjson.objectbinder.bindintoobject(objec...

php - Laravel: Complicated Eloquent Relationship - hasManyThrough or belongsToMany approach? -

i have 3 models (organization, user, visit) , 4 tables (organizations, users, organization_user, visits). i'm trying accumulative total of user visits organization. organization ------------ id, name user --------- id, name organization_user ---------------- id, organization_id, user_id visit -------------- id, user_id views just clarify, there no organization_user model, pivot table used user , organization: $organization->belongstomany('user'); $user->belongstomany('organization'); i query user_ids pivot table group_id, , visits each user_id, what's more eloquent approach? a user hasmany visits , visit belongsto user. visit doesn't belong organization. solved using wherein(). no change current relationship setup...to accumulative views did this: $org = organization::find($org_id); return db::table('visits')->wherein('user_id', $org->users->modelkeys())->sum("views"); the modelkeys()...

javascript - Issues with canvas.getContext("2d").getImageData(x,y,1,1).data in chrome and firefox -

recently have been programming , have run across inconsistencies between browsers document.getelementbyid(canvasid).getcontext("2d").getimagedata(x, y, 1, 1).data; command. have image , section of image colored rgb(246,247,247) (i set color in photoshop). calling getimagedata method image data @ clicked point, @ color , if color inside range (which have defined in array) plot point on area. run in ie , works expected, color comes out @ rgb(246,247,247). problem comes in when run exact same code exact same image in chrome or firefox, browser says color rgb(246,247,246) , rgb(246,247,246), respectively. why browser saying colors different are? there way color of pixel in canvas reliably? in advance! for record, web browsers render colors differently. best way ensure colors same use web safe colors, , export images png-8 no gamma channel.

c# - Migrating asp.net from 32 bit to 64 bit webform application -

i have asp webform application build in 3.5 , runs on 32bit server. have migrated 4.5.1 working fine have got new server 64bit , want update application run on 64bit because got oom exception last days. when build configuration set 64 cpu, system.badimageformatexception. under additional information, says not load file or assembly dll_name,..... attempt made load program incorrect format. i too: signtool error no certificates found met given criteria but have valid certicate 2018. i guess problem use external library (due badimageformatexception exception), isn't platform-independent. 1 have experience oracle.dataaccess . comes in 2 flavors: 32-bit , 64-bit version of library. make sure application doesn't use external libraries require run on 32-bits , replace them 64-bit counterparts.

Python Numpy Poisson regression producing bad numbers -

i use poisson regression model football matches. trying fit attack , defence ratings each team based on past results. have set of results this: a v b 2 0 b v 2 1 v b 1 1 the number of goals each team scores goes vector this: y = numpy.array([2,0.001,2,1,1,1]) #0.001 become clear i'm trying fit home , away defence ratings in vector b such y = exp(x*b) x matrix representing results of games. the vector b in form: b = [a_home_attack, a_home_defence, b_home_attack, b_home_defence, a_away_attack, a_away_defence, b_away_attack, b_away_defence] from above table of results matrix x must this: [1,0,0,0,0,0,0,-1] [0,-1,0,0,0,0,1,0] [0,0,1,0,0,-1,0,0] [0,0,0,-1,1,0,0,0] [1,0,0,0,0,0,0,-1] [0,-1,0,0,0,0,1,0] now since left-hand-side of model equation above in terms of e^x take logarithms of vector y (hence entering 0 0.001, log(0) not defined). here python implementation of algorithm stated above: import numpy y = numpy.array([2,0.001, 2,1,1,1]) x = numpy...

passport.js - how to declare typescript interface extension to node request session object? -

in following, returnto added session object passport methods. how declare interface in typescript? import express = require('express'); import expresssession = require('express-session'); // how declare presence of returnto, not in underlying type? export function createsession(req: express.request, res: express.response, next: function) { passport.authenticate('local', (err: any, user: userinstance, info: any) => { //. . . req.login(user, (err) => { //. . . res.redirect(req.session.returnto || '/'); }); })(req, res, next); }; there's type declaration express-session on definitelytyped: https://github.com/borisyankov/definitelytyped/blob/master/express-session/express-session.d.ts following pattern in file, can create new d.ts (call whatever want) containing: declare module express { export interface session { returnto: string; } } typescript "merge" property existing d...

java - How to get the MIME Type of a .MSG file? -

i have tried these ways of finding mime type of file... path source = paths .get("c://users/akash/desktop/fw internal release of mstclient-server5.02.04_24.msg"); system.out.println(files.probecontenttype(source)); the above code returns null ... , if use tika api apache mime type gives text/plain... but want result application/vnd.ms-outlook update i used mime-util.jar follows code... mimeutil2 mimeutil = new mimeutil2(); mimeutil.registermimedetector("eu.medsea.mimeutil.detector.magicmimemimedetector"); randomaccessfile file1 = new randomaccessfile( "c://users/akash/desktop/fw internal release of mstclient-server5.02.04_24.msg", "r"); system.out.println(file1.length()); byte[] file = new byte[624128]; file1.read(file, 0, 624128); string mimetype = mimeutil2.getmostspecificmimetype(mimeutil.getmimetypes(file)).tostring(); ...

opencart - Show modules inside the content section -

i'm using opencart 2.0.3.1 , journal v 2.4.8. issue is: when add module (slider, side categories menu etc.) , place in content section (content top, content bottom, columns etc.) doesn't appear on webpage. when tried place slider on "top" or "bottom" position, worked (slider appeared above/under content section). guess doesn't work correctly adding modules inside content section. can give me ideas?

php - Why I can't format my JSON object? -

i'm trying construct json object containing inner objects. i'm trying following code - $ids array containing ids: $result = array(); foreach ($ids $value) { $temparray = getcustomoptions($host, $dbusername, $dbpassword, $dbname, $_session['companyid'], $value); array_push($result, $temparray); } print_r(json_encode($result)); the getcustomoptions() returns array using following script: $dataarray = []; while ($stmt->fetch()) { $dataarray[] = array( 'id' => $id, 'description' => $description ); } the problem when print_r(json_encode($result)); i'm getting following result: [ [ { "id":21, "description":"bshd" }, { "id":22, "description":"gandhi " }, { "id":23, "description":"aaaa...

python - How to execute function after returning Flask response (hosted on Heroku)? -

while i've heared need use called "job queue" i'm new , i've had hard time setting up. how execute function after returning response in flask? walk me through process? so i've figured out that it's extremely easy , easier on heroku problem documentation quite scattered around , who's discovering job queues may overwhelming. for example i'm going use reddis go addon on heroku first thing have install dashboard. after set flask app this: from flask import flask rq import queue redis import redis import os import urllib.parse urlparse app = flask(__name__) def function_to_queue(): return "finished" # tell rq redis connection use , parse url global variable added addon redis_url = os.getenv('redistogo_url') urlparse.uses_netloc.append('redis') url = urlparse.urlparse(redis_url) conn = redis(host=url.hostname, port=url.port, db=0, password=url.password) q = queue(connection=conn) #no args implies defau...

math - Excel - Multiply Until Total Reached -

Image
i want multiply x*y until x>=20 , multiply z value , have results displayed 2 values, multiple , multiple*z the question behind formula is, how many boxes of x capacity need have total capacity of 20 liters , how cost. x = volume of bottle y = number of bottles in box z = price per box this done hand, i've been playing (with little effect) in excel while , solution. i hope makes sense i rather think formula provided @jeeped for: i want multiply x * y until x>=20, multiply z value , have results displayed 2 values, multiple , multiple * z label 2 arrays 1 20 columns , rows shown, populate v1 price per box , in b2: =if(and($a2*b$1>20,a2>=20),"",$a2*b$1) and in x2: =if(b2="","",$v$1*b2) with both formulae copied across 19 columns , 2 sets of 20 formulae copied down 19 rows. result should similar to:

css - How to position ngshow messages in angular js -

how have ng-show messages beside text box rather underneath it. right displaying validation messages underneath input box. <!doctype html> <html ng-app="myapp" > <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <link rel="stylesheet" href="style.css" /> <script> "use strict"; var app = angular.module('myapp', []); app.controller('mainctrl', function ($scope) { $scope.cityarray = ["hyderabad", "secunderabad", "delhi", "mumbai"]; $scope.submit = function ($eve...

ios - How to change background color of custom keyboard when button is pressed into host app? -

Image
i trying change custom keyboard background host app reason not work. i tried nsuserdefaults doesn't work, here code when button pressed host app: func buttontapaction() { nsuserdefaults.standarduserdefaults().setinteger(1, forkey: "abc") } and way reading values disk execute else condition: override func viewdidload() { super.viewdidload() let abc = nsuserdefaults.standarduserdefaults().integerforkey("abc") if abc == 1 { self.view.backgroundcolor = uicolor.redcolor() }else{ self.view.backgroundcolor = uicolor(red: 241.0/255, green: 235.0/255, blue: 221.0/255, alpha: 1) } //other code } i don't know doing wrong. here full project. enable app groups both targets step 1. same steps , group name should same nuberwidget target keep in mind. step 2. step 3. step 4.code store value objective c nsuserdefaults *shareddefaults = [[nsuserdefaults alloc] initwithsuitename:@...

php - foreach loop with decoded json data -

i'm trying data json response displayed using foreach loop. if try error: invalid argument supplied foreach() the data put in foreach loop isn't null or empty, checked that. my code: $json = file_get_contents($goodurl); $the_data = json_decode($json, true); $count = 0; foreach($the_data->response $video) { //case show results text //echo $video->title; $html.= "<p><div class='p2go_title'><a href='". $video->playbackurl ."' target='_blank'>" . $video->title . "</a></div>"; $html.= "<div class='p2go_contributors'>by: ". $video->contributors ."</div>"; $html.= "<div class='p2go_views'>views: ". $video->views ."</div></p>"; $count++; } return $html; $the_data array. try - foreach($the_data['response'] $video) json_decode($json, true); return array. second ...

regex - How to sed to capture the rightmost string? -

i have different environments. in each environment logs located in different path. e.g.: /u01/../etc/apps/../def-20150626044921.log /u01/log02/../etc/apps/../mno-20150626071656.log /u02/../etc/apps/../xyz-20150626044921.log i trying grab rightmost digits before .log , display them in yyyy-mm-dd hh:mm:ss format. using these in different combinations result individually. e.g.: sed "s/01//"; sed "s/[^0-9]*//g"; sed "s/(.{4})(.{2})(.{2})/\1-\2-\3 /", sed "s/(.{10})(.{3})(.{2})/\1 \2:\3:/"; my requirement add command in script. however, i'm unable results when path different. if instead of u01 , it's u02 command doesn't work. basically need capture yyyymmddhhmmss before .log , remove else. there way make command dynamic independent of log path , should not matter logs located, show date , time in desired format. thanks looking @ question...!! try this: sed 's/.*\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2...

C# LINQ to SQL Multiple entity join -

i have table full of data split across year, brand , customer want join customer master table. want each output record customer, brand1 qty year, brand2 qty year, etc , total of brands. created class recieve output. when view data in statistics table has data should meet criteria used (i.e. debtorid, financialyearid , brandid. my select looks this var debtors = dbs.debtors; var bikesales = dbs.salesbikes.defaultifempty(); if (sortstatepostcode) { dquery = y in debtors in bikesales a.debtorid == y.id && a.finyearid == finyear.id && a.bikebrandid == 1 b in bikesales b.debtorid == y.id && b.finyearid == finyear.id && b.bikebrandid == 2 c in bikesales c.debtorid == y.id && c.finyearid == finyear.id && c.bikebrandid == 3 d in bikesales d.debtorid == y.id && d.finyear...