Posts

Showing posts from February, 2011

php - Laravel 5 route using server -

i installed laravel 5 on ftp server. fine, main page enable. have problem routes. link calling route calling controller returning view. my link : <div class="logo"><a href="{{ route('accueil') }}"><img src="images/logo.png" alt=""></a></div> my route : route::get('/', [ 'as' => 'accueil', 'uses' => 'controllertest@accueil']); my controller : class controllertest extends controller { public function accueil() { return view('accueil'); } } but when element, can see : href="http://xx.xxx.xx.xxxc:/test/public/index.php" instead of href="http://xx.xxx.xx.xxx/test/public/index.php" it seems laravel mixing server's ip , localhost. can't find what's wrong. searched online solution, have issue. there .htaccess file in /public folder <ifmodule mod_rewrite.c> <ifmodule mod_negotiati

c# - Deploy config files along with exes and dlls on windows CE device -

Image
currently deploying windows ce application on windows ce platform vs 2008. running fine. my problem want deploy config files along exes , dlls. when deploy, exes , dlls deployed not config files. properties each config files "content" , "copy always". please how can deploy config files well? in solution explorer, right-click config file want deploy , select properties. in properties window, select ' copy always ' in ' copy output directory ' in deployment project, make sure include folder you've saved config files. this link explains how add items deployment note : if using publish solution explorer, select build action none , copy output directory do not copy

unity3d - Can I know in Unity 5 who Instantiated the object? -

is possible information instantiated object 1 instantiated it? for example let's have objecta: instantiate(objectb, gameobject.transform.position, quaternion.identity); is there way in objectb: awake() { var vector = parent.transform.position }; where "parent" initiator. you can following accomplish that: // in objecta class's function gameobject objb = instantiate(objectb, gameobject.transform.position, quaternion.identity); objb.parentpos = transform.position; // , if want know instantiated it, use line: objb.parentgameobj = gameobject; // in objectb class public vector3 parentpos; public gameobject parentgameobj;

javascript - split and create an array from a json object in js -

i have given exif of image split each key of json object , create sorted array it. output i'm expecting { "app14":[ {"app14flags0": 16384}, {"app14flags1": 0}, {"colortransform": 1} ], "composite":[ {"aperture": 2.8} {"circleofconfusion": 0.0309526315549036} {"datetimecreated": "2013:08:04 13:15:03+00:00"} {"focallength35efl": 97.0717484087605} {"..."} ], "sourcefile": "c.jpg", "xmp":[ {"alreadyapplied": true}, {"approximatefocusdistance": 1.17}, {"autolateralca": 0}, {"blacks2012": 0} ] } my last console.log({key:values}); giving me same array. js fiddle var the_keys =[]; _.foreach(data, function(n, key) { //creating array of uniq keys if(key.indexof(':')> -1) { if (_.includes(the_keys, key.split(':')[0]

sql - How to apply aggregate function only on contiguous rows? -

on postgresql 9.4, i'm trying achieve i'll call "aggregate function" on contiguous rows. example: input data: recipe prod1 prod2 timestamp 0 5 4 2015-07-02 08:10:34.357 0 2 7 2015-07-02 08:13:45.352 0 7 0 2015-07-02 08:16:22.098 1 3 2 2015-07-02 08:22:14.678 1 9 4 2015-07-02 08:22:56.123 2 2 6 2015-07-02 08:26:37.564 2 1 7 2015-07-02 08:27:33.109 2 0 8 2015-07-02 08:31:11.687 0 3 5 2015-07-02 08:40:01.345 1 4 2 2015-07-02 08:42:23.210 desired output: recipe prod1_sum prod2_avg timestamp_first timestamp_last 0 14 3.6666 2015-07-02 08:10:34.357 2015-07-02 08:16:22.098 1 12 3 2015-07-02 08:22:14.678 2015-07-02 08:22:56.123 2 3 7 2015-07-02 08:26:37.564 2015-07-02 08:31:11.687 0

jquery - Bootstrap table header issue -

Image
have bootstrap table. table header not render in chrome browser. , table css changes when perform append operation. please check code. <div class="panel-body"> <table id="tablerelease" data-height="400" data-search="true" data- click-to-select="true"> <thead> <tr> <th data-field="state" data-checkbox="true"> </th> <th data-field="id" data-sortable="true">sequence</th> <th data-field="stepname" data-sortable="true">step type</th> <th data-field="parameter" data-sortable="true">parameter(s)</th> <th data-field="packageno" data-sortable="true">package no</th> </tr> <

c++ - QString functions giving incorrect results on CentOS -

i using c++ qt library , following code working on windows not working on centos : if(line.startswith("[", qt::caseinsensitive)) { int index = line.indexof(']', 0, qt::caseinsensitive); qstring subline = line.mid(index+1); subline = subline.trimmed(); tokenlist = subline.split("\t"); } else { tokenlist = line.split("\t"); } i have line [ x.x.x.x ] ../dir/file.extension , want ignore [x.x.x.x] part while breaking line tokens. using vc9 on windows debug , working fine. edit: have removed mid() , used right() still same problem persists, working on windows not on centos. edit: after debugging on linux using qmessagebox have concluded control never going inside if block, tried using if(line.data()[0] == '[') same results. your code can simplified. line.remove(qregexp("\\[\\s+\\d+\\.\\d+\\.\\d+\\.\\d+\\s+\\]")); tokenlist = line.split("\t");

java - sheet.getLastRowNum() gives different values -

i have 2 excel files single row. trying last row number of file. first file gives value 0 , second 1 1. idea why there inconsistency in this? read documentation (from here ): gets number last row on sheet. owing idiosyncrasies in excel file format, if result of calling method zero, can't tell if means there 0 rows on sheet, or 1 @ position zero. case, additionally call getphysicalnumberofrows() tell if there row @ position 0 or not.

java - Supporting 3D secure cards for recurring -

my target support 3d secured cards recurring billing. right have implemented paypal direct payment. paypal direct payment api not support 3d secure recurring billing ; 3-d secure not supported direct recurring billing , reference transactions. cards require 3-d secure authentication cannot use these apis 3d secure implementation so did research , came across 2checkout supports 3d secure. here 2checkout supports recurring billing . first thing want know not written, 2co supports 3d secure recurring well? secondly there other way or source through can achieve target more 2co. any highly appreciated. 3d secure available on first , initial transaction, reason expression chargeback , e.g. friendly chargeback done on recurring transaction , not on initial one, since have been approved 3d secure , pretty hard disprove it's authenticity.

asp.net - How to pass a selected dropdown value to the MVC controller? -

this ajax method , mvc controller. dropdownlist in url " http://localhost:1424/home/drop ". after navigating, choose state dropdownlist , when navigate url " http://localhost:1424/home/getstates ", json data null. json on url {"selectedcountyid":null}. please assist.!!!!!!!!!!!!!!!!! $('.ddlcountry').change(function () { $('#ddlstate').empty(); $.ajax({ type: "post", datatype:"json", url: "home/getstates", data: { id: $('.ddlcountry').val() }, }); }); public actionresult getstates(string id) { return json(new { selectedcountyid = id }, jsonrequestbehavior.allowget); } your using class selector, may finding multiple elements in dom. also advise use url.action generate urls, don't string way url cause trouble in future. modify jquery code : $('.ddlcountry').change(function

algorithm - Iteratively find all combinations of size k of an array of characters (N choose K) -

i working on problem personal project. basically: given array of elements, e.g. e = {1,2,a,b} and given number, k, e.g. k = 2 i want return combinations of e of size k (e choose k) e.g. {{1,1}, {1,2}, {1,a}, {1,b}, {2,1}, ... , {b,1}, {b,2}, {b,a}, {b,b}} i have achieved recursively using following function: char[] pool = new char[]{'1', '2', '3'}; public void buildstringrec(char[] root, int pos, int length){ for(char c : pool){ char[] newroot = root.clone(); newroot[pos] = c; if(pos+1 < length){ buildstringrec(newroot, pos+1, length); } else{ system.out.println(string.valueof(root)); } } } where pool e , length k. so call: buildstringrec(new char[2], 0, 2); , get 11 12 13 21 22 23 31 32 33 can done iteratively? have been trying wrap head around how variable lengths. any appreciated! if need be, can post code is, changes due retrying it's useless post i

c++ - Loop help: string vector to 3D char vector -

i'm new c++ , first attempt @ 3d vector. i'm trying take input file of variable length this: xxooo##xx xoxxxoxoo xxx#oxoo# oxxxoxoox xxoooo#xx xxxo#o### xxo#o#xxo x##oxxoox xxx##oxoo xoxx#xooo and turn 3d char vector each line 3x3 box first 3 characters being first row, next 3 2nd row, , last 3 3rd row. example first row of input should turn this: x x o o o # # x x this attempt @ solution, feel i've made several mistakes: vector<vector<vector<char> > > makeboard(vector<string> iflines) {// function fill game boards input strings vector<vector<vector<char> > > charboard; (int = 0; != iflines.size(); i++) { (int j = 0; j < 9; j=j+3) { charboard[i][j/3][0] = iflines[i][j]; charboard[i][j/3][1] = iflines[i][j+1]; charboard[i][j/3][2] = iflines[i][j+2]; } } return charboard; } would please me out here? edit: edited suggestions plus couple things tried fix. error:

Inserting data from Twitter API into a MySQL Database using php -

very new php coding - i've set server based mysql database insert twitter api data into. i can retrieve twitter api data , profile on web ( http://www.pdanalytics.ca/stephenharpertweets.php ). using php, how insert database. i've googled, , made attempts based on general tutorials, still feel pretty far off believe should straight forward task. thanks. here code: <?php require_once('twitterapiexchange.php'); /** set access tokens here - see: https://dev.twitter.com/apps/ **/ $settings = array( 'oauth_access_token' => "xxxxxxxxxxxxxxx", 'oauth_access_token_secret' => "xxxxxxxxxxxxxxx", 'consumer_key' => "xxxxxxxxxxxxx", 'consumer_secret' => "xxxxxxxxxxxxxxxxxxx" ); $url = "https://api.twitter.com/1.1/statuses/user_timeline.json"; $requestmethod = "get"; $getfield = '?screen_name=pmharper&count=20'; $twitter = new twitterapiexchange($set

.htaccess - Block Blank HTTP_X_FORWARDED_FOR traffic -

is possible block traffic when http_x_forwarded_for blank/empty htaccess ? i've tried these two: rewriteengine on rewritecond %{http:x-forwarded-for} ^.{0}$ rewriterule .* - [f] and rewriteengine on rewritecond %{http:x-forwarded-for} ^$ rewriterule .* - [f]

How to hide the y axis and x axis line and label in my bar chart for chart.js -

i new chart.js , want hide y axis , x axis line , label in chart. looked @ documentation , couldn't find option. has else encountered problem , have solution? using showscale option better var ctx = document.getelementbyid("linewithline").getcontext("2d"); new chart(ctx).line(data, { showscale: false }); fiddle - http://jsfiddle.net/wb3kcunt/ this hides gridlines too. if want hide axes , labels , not grid lines, set scalefontcolor , scalelinecolor transparent color.

merge - gdal_merge.py not working after gdal and it python bindings have been installed -

i installed python 3.4.0 64 bit , gdal file release-1400-x64-gdal-1-11-1-mapserver-6-4-1.zip http://www.gisinternals.com/release.php . found binding http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal , filename gdal-1.11.2-cp34-none-win_amd64. install these files , import gdal. however, when run following command within python ide merge files 1 2 , 3, got error >>> gdal_merge.py -o out.tif 1.tif 2.tif 3.tif file "<console>", line 1 gdal_merge.py -o out.tif 1.tif 2.tif 3.tif ^ syntaxerror: invalid syntax i check see if can import gdal_merge below >>> import gdal_merge and ok. appreciate if issue. gdal_merge.py part of gdal utilities executed command line, not within python ide or python script. just open command line ( cmd ) , type: python gdal_merge.py -o out.tif 1.tif 2.tif 3.tif depending on environment variables , whether included gdal in path variable might need specificy full path gdal_merge.py

In Android which path is recommend for large storage? -

i have large package, 200mb size, download when app launchs. path recommend storing it? '/data/data' or '/sdcard/android/data'? i think default choice sdcard, context.getexternalfilesdir ,which system take care of deleting if application uninstalled

javascript - Responsive Image Grid with Different Heights and Widths -

i need able create responsive image grid different image widths, (link image below.) http://jessewintondesign.com/imagegrid.jpg here's have right now. http://magnumdigitalcinema.com/dev this ^ fits , looks on 27" imac, isn't responsive, , haven't been able figure out solution due varying heights , widths. masonry.js didn't work me i'm developing site in wordpress , grid created dynamically. need know if there option this. in advance! this potential helpful resource: http://susy.oddbird.net/ also, css can well. @ past question: simple css grid unequal image sizes

node.js - typescript getting error TS2304: cannot find name ' require' -

i trying first typescript , definitelytyped node app , running, , running errors. i getting error "ts2304: cannot find name 'require' " when attempt transpile simple ts node page. have read through several other occurrences of error on , not think have similar issues. running @ shell prompt command : tsc movie.server.model.ts. contents of file are: 'use strict'; /// <reference path="typings/tsd.d.ts" /> /* movie.server.model.ts - definition of movie schema */ var mongoose = require('mongoose'), schema = mongoose.schema; var foo = 'test'; the error thrown on var mongoose=require('mongoose') line the contents of typings/tsd.d.ts file are: /// <reference path="node/node.d.ts" /> /// <reference path="requirejs/require.d.ts" /> the .d.ts file references placed in appropriate folders , added typings/tsd.d.ts commands: tsd install node --save tsd install require --save

r - lme4 random effect structure with dredge -

i have constructed lme4 model model selection in dredge having trouble aligning random effects relevant fixed effects.the structure of full model follows. fullmodel<-glmer(y ~x1 + x2 + (0+x1|year) + (0+x1|country) + (0+x2|year) + (0+x2|country) + (1 | year) +(1|country), family=binomial('logit'),data = alldata) in model structure, model selection in dredge produces 3 combinations of fixed effects, i.e. x1, x2, , x1+x2, random effect structure remains same in full model, such when fixed effect x1, random effect include (0+x2|year) + (0+x2|country) . example model x1 fixed effect, still have x2 within random effects structure follows. y ~x1 + (0+x1|year) + (0+x1|country) + (0+x2|year) +(0+x2|country) + (1 | year) +(1|country), family=binomial('logit') is there way configure dredge not select random effects have other fixed effects specified in them? have x1….x50. you cannot out-of-box dredge omits (x|g) expressions, can make "wrapper&quo

database - Syntax error in INSERT STATEMENT from c# to Access DB -

con.open(); cmd = new oledbcommand("insert login (user, password) values ('" +textbox1 .text + "','" + textbox2 .text + "');",con); cmd.commandtype = commandtype.text; int temp = cmd.executenonquery(); if (temp > 0) { textbox1.text = null; textbox2.text = null; messagebox.show("record successfuly added"); } else { messagebox.show("record fail added"); } con.close(); when try insert of error appear ( syntax error in insert statement ) i'm try different method values parameters or direct plz ! escape reserved keyword user use parameterized query avoid sql injection make use of disposable objects try approach: using (oledbconnection con = new oledbconnection(connectionstring)) { con.open(); using (var cmd = new sqlcommand( "insert login ([user], [pass

javascript - Angular Service Subtractive Filter -

i have angular service , i'm trying return filtered data set, using javascript's array.prototype.filter() method. i'm matching multiple input objects' key value pairs set of object's key value pairs , returning object if match. here service: app.service('scatterservice', function(inputservice) { return function(data) { var inputs = inputservice.selectedinmodel(); // returns 1 - 4 user input objects function getselected(inputs) { return data.filter(function(obj) { // each user input exists angular.foreach(inputs, function(val, id) { var dataprop = val['indata']; // if prop value in data = prop value in user input if (obj[dataprop] == val['value']) { // returns objects have *either* of user inputs return true; } return fals

javascript - Set mongo's _id with a custom UID -

background: i have no control on post event coming db document called things . when post comes in, i've written function called findorcreate() .(which either find or create record(object?) in things document). reduce redundancy, want use 3rd party post payload field nuid replace default _id of record(object). question: how can replace _id payloads field called nuid ? example payload: curl -h "content-type: application/json" -x post -d '{"participant":{"nuid":"98asdf988sdf89sdf89989sdf9898"}}' http://localhost:9000/api/things schema 'use strict'; var mongoose = require('mongoose'), schema = mongoose.schema; var thingschema = new schema( {nuid: string} ); module.exports = mongoose.model('thing', thingschema); thing.controller.js //*currently function have both _id , nuid (which works not desirable) exports.findorcreate = function(req, res) { var query = {"nuid"

javascript - How to render innerHTML of tag as nested HTML -

using angularjs making request receive json document. json document, after traversal, find array of additional json documents. more json traversal on each object in array, resulting inner json documents raw html. i trying display each of raw htmls in page, however, can them raw text equivalent displayed mere text, not rendered in html. using $sce in controller, can render 1 specific path on 1 specific element of array html correctly not of them. here code: // controller: $scope.latestemails = function() { $http.get('/emails/last/'+$scope.numberofemails).success(function(response) { $scope.inserthtmlhere = $sce.trustashtml(response.body[0].body[0].content); $scope.latestemails = response.body; }); } // html <div ng-bind-html="inserthtmlhere"></div> <!-- works 1 given element --> <ul> <li ng-repeat="email in latestemails">{{email.body[0].content}} <!-- raw text displayed

jquery - JavaScript Callbacks and Splunk -

i in process of using splunk javascript api gain access of functionality, i'm having trouble understanding javascript concepts behind callbacks. an example docs: var http = new splunkjs.proxyhttp("/proxy"); var service = new splunkjs.service(http, { username: username, password: password, scheme: scheme, host: host, port: port, version: version }); async.chain([ // first, log in function(done) { service.login(done); }, // perform search function(success, done) { if (!success) { done("error logging in"); } service.search("search index=_internal | head 3", {}, done); }, // wait until job done function(job, done) { async.whilst( // loop until done function() { return !job.properties().isdone; }, // refresh job on every iteration, sleep 1

Blur images in Windows Runtime C# using WriteableBitmapEx -

i trying blur image in new windows phone runtime c# app (wprt) used writeablebitmapex nuget , code make image blured can't see changes in picture . what's going wrong guys ? public testxaml() { this.initializecomponent(); .... test(); } async void test() { var imgfile = await windows.storage.storagefile.getfilefromapplicationuriasync(new uri("ms-appx:///assets/testbg.jpg")); var wb = new writeablebitmap(100,100); using (var strm = await imgfile.openreadasync()) { wb = await wb.fromstream(strm); } var wb3 = writeablebitmapextensions.convolute(wb, writeablebitmapextensions.kernelgaussianblur5x5); imagebrush ib = new imagebrush(); ib.imagesource = wb3; pagebackground.background = ib; } also tried writeablebitmapextensions.kernelgaussianblur3x3 still no change

android - how to get channel count of audio file -

i trying retrieve channel count of .wav sound file using trackinfo , mediaformat cant seem handle of mediaformat object believe provide channel count. i have tried following instruction not helping. here have far mediaplayer = new mediaplayer(); mediaplayer.setdatasource(soundpath); mediaplayer.prepare(); trackinfo info = mediaplayer.gettrackinfo()[0]; mediaformat mf = you need use mediaextractor , mediaformat access key_channel_count here example, mediaextractor extractor = new mediaextractor(); extractor.setdatasource(path); //where path string variable , points data source mediaformat format = extractor.gettrackformat(i); //where int variable , denotes index value of track. //for first track: = 0; int count = format.getinteger(mediaformat.key_channel_count); i recommend reading example in mediaextractor class description android developer reference. here link: http://developer.android.com/reference/android/media/mediaextractor.htm

java - Null pointer exception whilst adding to the DB -

i'm developing simple bird-watching log app 1 of classes @ college , seem not able spot heck going wrong, after spending few days banging head against wall, suppose it'd make more sense ask fresh pair of eyes have look. the app simple - have 2 activities, 1 listview, gets populated db (mainactivity) , another, takes arguments create new entry (addactivity). besides these have dbhelper (mysqlitehelper) handle db calls, simple class describe how object should (sighting), datasource class (sightingdatasource) handle facilitate calls helper , bunch of non-relevant resources (layouts, etc.) addactivity blows null pointer exceptions whilst calling addsighting method. whatever reason doesn't int typecast of bcount field, testing purposes i've set static int, whilst figure out exception portion of problem. here's source: addactivity: package com.vladislavtachev.cscb763; import android.app.listactivity; import android.os.bundle; import android.view.menuitem; impor

css3 - CSS drop-down menu: z-index issue -

i've got 2 problems css drop-down menu: jsfiddle 1) transitions: menu slide-down when mouse switches open it. opened menu should slide-up close. #nav ul li ul { -webkit-transition:height .5s ease-in; -moz-transition:height .5s ease-in; -o-transition:height .5s ease-in; -ms-transition:height .5s ease-in; transition:height .5s ease-in; } this doesn't seem work; possibly under wrong "ul li" selector, though tried others. 2) bring parent item ("menu1", "menu2") on top of menu item list covers top border of first child. is, there should no border between "menu1" , "item1" since "menu1" doesn't have bottom border, looks since "item1" on top of it. tried playing z-index , can't working. neither transitions. i realize menu bit convoluted , has more css necessary. what it? jsfiddle #nav ul { padding: 0; margin: 0; list-style: none; } #nav ul

php - How to receive images with the Telegram API? -

is possible receive images (and store on server) sent user bot? if image sent, receive json post. link telegram bot-api description. don't know if it's possible receive whole image or not: https://core.telegram.org/bots/api#available-types {"update_id":xxxxx, "message":{"message_id":2222,"from":{"id":xxxxx,"first_name":"christoph","last_name":"xxxxx"},"chat":{"id":xxxxx,"first_name":"christoph","last_name":"xxxxx"},"date":1435704055,"forward_from":{"id":xxxxx,"first_name":"christoph","last_name":"xxxxx"},"forward_date":1435703471,"photo":[{"file_id":"agadagadmaoxg9kknwf4o978o3emqb_ewsoabi5s-wwq46dqir0aagi","file_size":998,"width":51,"height":90},{"file_id":"agadagadmaoxg

javascript - how to set a value of a dropdown to that value having a class as "selected"-Jquery -

i'm trying set value in dropdown has classname = "selected". here html: <select style="width:180px;" class="chosen-select" id="range"> <option value="7 days">7days</option> <option value="20days" class="selected">20days</option> <option value="30days">30days</option> </select> now here im trying work out: js: $("#range_select").find('option.selected'); //gives me: <option value="20days" class="selected">20days</option> below psedo code: if($("#range_select").find('option').hasclass("selected")){ //set value of dropdown "20days" //currently showing default value "7days" } https://jsfiddle.net/xwo10r7k/ how can achieve this? help!! use $("#range").find('option.selected').attr("selected",&q

Docker build ADD vs RUN curl -

if run dockerfile have command like run curl -o file.txt http://x.x.x.x/path/to/file/file.txt the build works, whereas if use add http://x.x.x.x/path/to/file/file.txt file.txt the build fails , complains about got http status code >= 400: 503 service unavailable is there add i'm not understanding? edit file accessible through docker host. add executed in docker host. run executed inside container. is http://x.x.x.x/path/to/file/file.txt accessible outside of docker container?

Magento override addAction method(CartController.php) -

what want override addaction method. what have far is: config.xml(in mymodule/cartoverride/etc/) <?xml version="1.0" encoding="utf-8"?> <config> <modules> <mymodule_cartoverride> <version>0.1.0</version> </mymodule_cartoverride> </modules> <frontend> <routers> <checkout> <args> <modules> <mymodule_cartoverride before="mage_checkout">mymodule_cartoverride</mymodule_cartoverride> </modules> </args> </checkout> </routers> </frontend> </config> mymodule_override.xml(in app/etc/modules/): <?xml version="1.0" encoding="utf-8"?> <config> <modules> <mymodule_cartoverride> <active>true</active> <codepool>local</codepool> </mymodule_cartoverri

mysql - SQL - Find Highest Single Day of Sales From Date Range -

i using mysql .. i have simple sales table follow: o----o----------o-----------o | id | store_id | logdate | o----o----------o-----------o | 1 | 1 | 2015-1-13 | | 2 | 1 | 2015-1-14 | | 3 | 2 | 2015-1-11 | | 4 | 2 | 2015-1-18 | o----o----------o-----------o and sale product table o----o----------o---------o------------o | id | sale_id | qty | price | o----o----------o---------o------------o | 1 | 1 | 1 | 10 | | 2 | 2 | 1 | 10 | | 3 | 2 | 1 | 10 | | 4 | 3 | 1 | 10 | | 5 | 3 | 1 | 10 | | 6 | 3 | 1 | 10 | | 7 | 4 | 1 | 10 | | 8 | 4 | 1 | 10 | o----o----------o---------o------------o expected result o-- --------o----------------o---------------------o | store_id | sum(price*qty) | highest date on | o-----------o----------------o---------------------o |

sql - Python pandas read_sql returns generator object -

i pulling data oracle db using pyodbc , pandas read_sql. i see no errors when enter line df = pd.read_sql(sql_str,cnxn,chunksize=10) but when try see df i error <generator object _query_iterator @ 0x092d40f8> my search error means or causing yielded no satisfactory answers. the reason using chunksize have oracle db table 60 million rows, , plan download in bits , put them together, here: how create large pandas dataframe sql query without running out of memory? as explanation of chunksize says, when specified, returns iterator chunksize number of rows include in each chunk . can iterate through result , each chunk: for chunk in pd.read_sql_query(sql_str, engine, chunksize=10): do_something_with(chunk) typically can process chunk , add list, , after loop concat processed chunks in list together. also see docs on sql querying: http://pandas.pydata.org/pandas-docs/stable/io.html#querying example.

c# - What is the Best Way to Create a Global Variable? -

i have simple question, important project: best way create global variable? in project, when user authenticated, build web menus according profile, claims or roles (i create own claims), , start build menu, specifics pages wich user have permission access. in filter method, check in database if user has permission access menu. what wanna know if have possibility put list of menus in global variable, session ("/) or application, because dont wanna have go database check permissions, , in case better if list in server memory or that... regards. the best way handle situation child action. create action in controller in project. since deals user-level access, i'll use accountcontroller . [allowanonymous] [childactiononly] public actionresult usermenu() { if (user.identity.isauthenticated()) { // logic select menu database return view(menu); } // optionally can return different menu anonymous users here return content(&quo

Installing Citrix receiver VIA PowerShell -

i'm trying create script install receiver i'm getting popup box asking if i'm sure. $installfiles = "c:\users\raw.admin\documents\citrixreceiver.exe" $argumentlist = '/silent /includesson enable_sson=yes enableprelaunch=true allowaddstore=a store0="kiewit;https://apps.kiewit.com/citrix/kiewit/discovery;on"' write-host "installing citrix receiver" start-process -filepath $installfiles -argumentlist $argumentlist -wait ##make sure single sign in provider order key $path = "hklm:\system\currentcontrolset\control\networkprovider\order" $providerorder = (get-itemproperty -path $path).providerorder if ($providerorder -notlike "*pnsson*") { set-itemproperty -path $path -name providerorder -value ($providerorder + ",pnsson") $newproviderorder = (get-itemproperty -path $path).providerorder write-host provider order key has following values $newproviderorder } else { write-host "pnsso

Loading an external xml file and then saving it into a website directory using PHP -

so found page: load external xml , save using php me out, doesn't seem work me. i'm trying same thing loading external xml file , saving (with no changes xml file) website directories batch system. have dynamically created directories needed. ex: /xml/en/281 now i'm trying load company's xml files ( https://thiscompany.com/xml/en/281/18511095_en.xml ) , save in own directory same name, 18511095_en.xml in 281 directory. i've been researching , getting lots of simplexml_load_file , domdocument examples i'm not getting results needed. for sake , purposes here code: (i'm changing url of actual xml file because client doesn't want out there. edited responses below $url = "https://thiscompany.com/xml/en/281/18511095_en.xml"; $timeout = 10; $curl = curl_init(); curl_setopt($curl, curlopt_url, $url); curl_setopt($curl, curlopt_returntransfer, 1); curl_setopt($curl, curlopt_connecttimeout, $timeout); $response = curl_exec($curl); file

Java simple OCR algorithm -

i've been working on simple ocr project couple days. app supposed extract text image. solution i've come is: greyscaling, rotating, removing noise image , isolating every single character on image. need simple algorithm let me recognise character. need recognise letters a,b,c,d. the method i'd use make mask of each letter, scaling rectangle found when cutting picture , "score" each letter, comparing rgb example.

angularjs - Is there something similar to angular $rootScope in Polymer.dart? -

i know in angular exists called $rootscope. 1 contains variables going shared controllers. i'm looking similar polymer, don't need pass parent variable attributes always. right i'm doing similar this: index html code: <body> <my-parent-component some-attribute="hello"></my-parent-component> </body> parent html code: <my-parent-component> <template> <p>someattribuet used parent: {{someattribute}}</p> <my-child-component some-attribute="{{someattribute}}"></my-child> </template> </my-parent-component> parent dart code: class myparentcomponent extends polymerelement { @published var someattribute; } child html code: <my-child-component> <template> <p>some attribute used here: {{someattribute}}</p> </template> </my-child-component> child dart code: class mychildcomponent extends polymerelement { @publ

sql server - SqlPackage not exporting entire database -

i'm trying move large database (50gb) azure. running command on local sql server generate bacpac can upload. sqlpackage.exe /a:export /ssn:localhost /sdn:mdbilling /su:sa /sp:somepassword /tf:"d:\test.bacpac" the export not print errors , finishes "successfully exported database , saved file 'd:\test.bacpac'." when @ bacpac in file system, comes out 3.7gb. there's no way 50gb database can compressed small. upload azure regardless. package upload succeeds, when query azure database of tables return 0 rows. it's if bacpac not contain database's data. are there known limitations export method? database size, data types, etc? i tried using 64bit version of sqlpackage reading experienced out of memory issues on large databases, wasn't getting error or error matter. update/edit: made progress after ensuring export transactionally consistent restoring backup , extracting bacpac that. however, have run new error when uploading az

crm - Why error "The state is invalid"? -

we have crm 2011, on-premises. in wcf service (c#) programmatically creating contracts , contractdetails. after creating contract, set state = 'invoiced' using code: try { setstaterequest setstaterequest = new setstaterequest() { entitymoniker = new entityreference { id = gnewcontractid, logicalname = xrm.contract.entitylogicalname }, state = new optionsetvalue((int)xrm.contractstate.invoiced), status = new optionsetvalue((int)xrm.contractstate.invoiced + 1) }; _service.execute(setstaterequest); } this process used work error, did today: "system.servicemodel.faultexception`1[microsoft.xrm.sdk.organizationservicefault]: state invalid, contract cannot set invoice state. (fault detail equal microsoft.xrm.sdk.organizationservicefault)." the state of contract when snippet executed (and failed today) 'draft'. this contract has child contract details, , activeon date 6/1/2015, should

use variable to specify format in python -

i want format string fixed width if use following statement: "{0:<8}".format(str(size)) #this 1 works however, # 1 gives invalid conversion specification "{0:<width}".format(str(size)) is there anyway use variable format string? solution 1: use width generate string {0:<8} first width = 8 ("{0:<%d}"%width).format(s) solution 2: nested format : "{0:<{1}}".format(s, width) named format maybe more readable: "{string:<{width}}".format(string=s, width=width) solution 3: way translate {0:<8} : .ljust(8) "{0}".format(s.ljust(width)) i choose 3. when 1) dealing other encodings in i18n 2) print pretty print 'a'.rjust(10, '-') ---------a

python - Extract words from string to create featureset nltk -

i using nltk , nltk-trainer sentiment analysis. have accurate algorithm pickled. when follow instruction s provided nltk-trainer, works well. here works (returns desired output) >>> words = ['some', 'words', 'in', 'a', 'sentence'] >>> feats = dict([(word, true) word in words]) >>> classifier.classify(feats) 'feats' looks this: out[52]: {'a': true, 'in': true, 'sentence': true, 'some': true, 'words': true} however , don't want type in words separated commas , apostrophes each time. have script preprocessing on text , returns string looks this. "[['words'], ['in'], ['a'], ['sentence']]"` however, when try define 'feats' string, left looks this {' ': true, "'": true, ',': true, '[': true, ']': true, 'a': true, 'b': true, 'c': t

jquery autocomplete filter second one based on first value -

i have 2 autocomplete jquery function. i'd show in second value based on 1 choosen on first text filed. not want change original aval array, because if change first txt value, second 1 has adjust on it. here code , jsfiddle : $(function() { var shared; var aval = [{label: "odd", value: "1"}, { label: "even", value: "2"} ]; var bval = [{ label: "one", value: "1"}, { label: "two", value: "2"}, { label: "three", value: "1"}, { label: "four", value: "2"} ]; $( "#input_txt" ).autocomplete({ minlength: 0, source: aval, focus: function( event, ui ) { $( "#input_txt" ).val( ui.item.label ); return false; },