Wednesday, 15 April 2015

What is the difference between width and precision in Python string format in case of strings -



What is the difference between width and precision in Python string format in case of strings -

what difference between width , precision in python string format in case of strings?

i mean smth this

'%5.5s'

precision interpreted maximum length, width minimum length:

>>> '%5.5s' % 'foobar' 'fooba' >>> '%5.3s' % 'foobar' ' foo' >>> '%3.5s' % 'foobar' 'fooba'

foobar truncated fit in 5 , 3 character maximum length, respectively. truncated string fit 5 , 3 character wide column (which can overflow).

python python-2.7

twitter bootstrap - Rails 4 - Flash as Key Value Pair Error -



twitter bootstrap - Rails 4 - Flash as Key Value Pair Error -

i trying utilize bootstrap styles display flash messages color users.

controller

def create @category = category.new(category_params) # assigning default values @category.status = 1.to_i if @category.save redirect_to admin_categories_path, :flash => { :success => "category created." } else flash[:error] = "category not save. please seek again." render :new end end

view

<%= render 'admin/partials/flash_message' %>

partial

<% if flash.present? %> <%= flash.inspect %> <% flash.each |key, value| %> <div class="<%= flash_class(key) %> fade in widget-inner"> <button type="button" class="close" data-dismiss="alert">×</button> <%= value %> </div> <% end %> <% end %>

helper

# flash messages def flash_class(level) case level when :notice "alert alert-info" when :success "alert alert-success" when :error "alert alert-error" when :alert "alert alert-error" end end output

i not able pass key helper function. assuming sends blank. html gets outputted

<div class=" fade in widget-inner"> <button data-dismiss="alert" class="close" type="button">×</button> category not save. please seek again. </div>

i not able figure out why foreach not able extract key , value pair. on inspect following

#<actiondispatch::flash::flashhash:0x007fc0e74dfa58 @discard=#<set: {}>, @flashes={"error"=>"category not save. please seek again."}, @now=nil>

in rails 4, supports strings. had alter helper following

# flash messages def flash_class(level) case level when 'notice' "alert alert-info" when 'success' "alert alert-success" when 'error' "alert alert-danger" when 'alert' "alert alert-warning" end end

**edit: according deep suggestions **

by changing flash partial to

<% if flash.present? %> <% flash.each |key, value| %> <div class="alert alert-<%= key %> fade in widget-inner"> <button type="button" class="close" data-dismiss="alert">×</button> <%= value %> </div> <% end %> <% end %>

and extendting bootstrap classes follows can eliminate helper class together.

alert-notice { @extend .alert-info; } alert-error { @extend .alert-danger; }

ruby-on-rails twitter-bootstrap foreach flash-message

javascript - Animate Newly Created List Element -



javascript - Animate Newly Created List Element -

i trying have added 'li' tags animated upon entrance, preferably using css. adding transitions 'display', 'opacity', , 'all' have not resulted in change. here's code:

function additem(item){ item = document.getelementbyid('plan_submit').value; var listcontainer = document.getelementbyid('list_container'); listcontainer.innerhtml += '<li class=list_item>' + item + '</li>'; }

thanks :)

you can this:

function additem(text){ var item = document.createelement('li'); item.innerhtml = text; item.classname = 'list_item'; var listcontainer = document.getelementbyid('list_container'); listcontainer.appendchild(item); item.style.opacity = 0; settimeout(function(){ item.style.opacity = 1}, 1); }

css:

.list_item { transition:opacity 1s; }

it's of import utilize settimeout in case (even delay 1 ms). note utilize of class .list_item not necessary because can set transition newly added li using script.

demo.

javascript css animation

ruby on rails - Topics have_many posts. Get all topics without any posts -



ruby on rails - Topics have_many posts. Get all topics without any posts -

a blog has "topics", "topics" have "posts".

how can count of topics without posts? unused topics.

topics = topic.all topics.???

topic.includes(:posts).where('posts.topic_id null').references(:posts).count

after seeing other answers, ran both statements in console.

this reply generates next query

(0.9ms) select count(distinct "topics"."id") "topics" left outer bring together "posts" on "posts"."topic_id" = "topics"."id" (posts.topic_id null)

while other reply generates 2 queries (as obvious).

(0.6ms) select "posts"."topic_id" "posts" (0.5ms) select count(*) "topics" ("topics"."id" not in (2,3,11,23))

ruby-on-rails ruby-on-rails-4 rails-activerecord

javascript - Defining global functions and properties accessible by AngularJS factory and controllers -



javascript - Defining global functions and properties accessible by AngularJS factory and controllers -

i'm working on angularjs app. when error thrown, want custom handling of error. that, i've done following:

var myapp = angular.module('myapp', []); myapp.factory('$exceptionhandler', function($rootscope) { homecoming function(exception, cause) { seek { console.log('unhandled error happening in version ' + $rootscope.app_version); console.log('error happened @ ' + $rootscope.getformatteddatetime()); } grab (uex1) { console.log('unable log unhandled exception.'); } }; }); myapp.run(function ($rootscope) { $rootscope.app_version = '1.0'; $rootscope.getformatteddatetime = function() { homecoming '--'; }; });

when run code, this error. guess can't add together $rootscope mill declarations. if that's case, how define globally accessible functions , variables can access them in controllers factory?

thank much assistance can provide.

you cant inject $routescope mill , , not thought however

the best can define new mill , , define property factoy :

app.factory('getappinfofactory',function(){ return{ getappversion:function(){ homecoming app_version = '1.0'; }, getformatteddatetime : function() { homecoming '--'; } });

and can utilize mill whenever/whereever want , :

myapp.factory('$exceptionhandler', function(getappinfofactory) { homecoming function(exception, cause) { seek { console.log('unhandled error happening in version ' + getappinfofactory.getappversion()); console.log('error happened @ ' + getappinfofactory.getappinfofactory()); } grab (uex1) { console.log('unable log unhandled exception.'); } }; });

javascript angularjs

php - Symfony2, FOSUserBundle, forgot password email not sending -



php - Symfony2, FOSUserBundle, forgot password email not sending -

i have config.yml settings here:

fos_user: db_driver: orm # other valid values 'mongodb', 'couchdb' , 'propel' firewall_name: main user_class: main\userbundle\entity\user resetting: email: from_email: address: noreply@mmerica.com sender_name: mmerica inc.

when tried "reset password" button sends me page says email has been sent ....@email.com, , there reset link. however, didn't receive email. there setting should refer to?

you must set swiftmailer in config.yml , set parameters in parameters.yml

config.yml:

swiftmailer: transport: "%mailer_transport%" host: "%mailer_host%" username: "%mailer_user%" password: "%mailer_password%" spool: { type: memory }

parameters.yml

parameters: database_driver: pdo_mysql database_host: 127.0.0.1 database_port: null database_name: xxxxxx database_user: xxxxxx database_password: xxxxxx mailer_transport: smtp mailer_host: "your smtp server" mailer_user: "your smtp user" mailer_password: "your smtp user password" locale: en secret: ddddddddddddsfcdvfrergfergergergrggergrgregre

php email symfony2

ruby - How do you reject a JSON key in jQuery? -



ruby - How do you reject a JSON key in jQuery? -

i have json payload , i'd utilize in several places , wondering how reject 2 keys this.

@metatagsadvanced = { app: { comparison: ['was', 'was not'], value: ['opened in lastly 2 days', 'opened in lastly 2 weeks', 'opened in lastly month'], enabled: true }, appversion: { comparison: ['equals', 'not equal', 'greater than', 'less than', 'greater or equal', 'less or equal'], value: 'string', enabled: true }, controlgroup: { comparison: ['less than', 'less or equal', 'greater than', 'greater or equal', 'equals'], value: 'number', numberoptions: {min: 1, max: 10}, enabled: true }, country: { comparison: ['is', 'is not'], value: 'country', enabled: true }, deliverable: { comparison: ['is', 'is not'], value: ['push notification','local force notification', 'app originated push', 'in-app alert', 'in-app content', 'sms', 'mms', 'email', 'rich message'], enabled: true }, event: {comparison: {eventnumber: ['did occur n days ago', 'did occur greater n days ago','did occur greater or equal n days ago','did occur less n days ago','did occur less or equal n days ago', 'did not occur n days ago','did not occur greater n days ago','did not occur greater or equal n days ago','did not occur less n days ago','did not occur less or equal n days ago'], standards: ['did occur', 'did not occur']}, value: 'events', enabled: true}, installdate: { comparison: ['before', 'was', 'after', 'within', 'days ago', 'greater n days ago', 'greater or equal n days ago','less n days ago', 'less or equal n days ago'], value: 'date', enabled: true }, language: { comparison: ['is', 'is not'], value: 'language', enabled: true }, lastopendate: { comparison: ['before', 'was', 'after', 'within', 'n days ago', 'greater n days ago', 'greater or equal n days ago', 'less n days ago', 'less or equal n days ago'], value: 'date', enabled: true }, os: { comparison: ['is', 'is not'], value: ['android', 'ios'], enabled: true }, pushopenrate: { comparison: ['greater or equal', 'less or equal'], value: ['0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1'], enabled: true }, segment: {comparison: ['is in'], value: 'segments', enabled: true}, sessions: { comparison: ['less than', 'greater than'], value: 'number', numberoptions: {min: 1}, enabled: true }, tag: {comparison: {string: ['is', 'is not', 'contains'], double: ['equals', 'not equal to', 'less than', 'greater than', 'less or equal', 'greater or equal'], timestamp: ['before', 'after', 'was', 'within', 'n days ago', 'greater n days ago', 'greater or equal n days ago','less n days ago','less or equal n days ago'], segment: ['is in', 'is not in'], standard: ['exists', 'does not exist']}, value: 'tags', enabled: true}, timezone: {comparison: ['is', 'is not'], value: 'timezone', enabled: true} }

so i'm wanting insert instance can see below. however, how alter code reject/exclude 'segment' , 'timezone' key above?

filters = $.extend({}, @metatagsadvanced)

any help appreciated allow me refactor of code! (i'm using coffeescript, hence why it's formatted way is!)

cheers

i'd utilize utility library lodash or underscore more robust solution, if didn't want rely on native prototype methods on array. intermittent log statements show how gets built up.

jsfiddle here: http://jsfiddle.net/trqg8/

jquery only sometags = foo: {foo: 'bar'} bar: {foo: 'bar'} baz: {foo: 'bar'} _keys = (obj)-> $.map(obj, (value, key)-> key) # seems odd key lastly appears way jquery 2.1.0 works. console.log _keys(sometags) # => ["foo", "bar", "baz"] _in = (arr, key)-> arr.indexof(key) != -1 console.log _in(_keys(sometags), 'foo') #=> true # there native filter function array.prototype _filter = (obj, keys...)-> objkeys = _keys(obj) # poor man's cut down ob = {} k in objkeys ob[k] = obj[k] unless _in(keys, k) ob console.log _filter(sometags, 'bar') #=> object {foo: object, baz: object} console.log $.extend({}, _filter(sometags, 'bar', 'baz')) #=> object {foo: object} underscore

in contrast, using underscore this:

sometags = foo: {foo: 'bar'} bar: {foo: 'bar'} baz: {foo: 'bar'} console.log _.extend({}, _.omit(sometags, 'bar'))

jsfiddle: http://jsfiddle.net/nusm8/1/

jquery ruby json coffeescript

linux - Expect command in bash script -



linux - Expect command in bash script -

i meet problem executing expect command bash variable. have location given parameter of script , need utilize in send command via expect -c. need give " send command thinking i've ended typing , recognizing rest of command characters after close-quote. thing like:

#!/bin/bash sign=ppp expect -cd 'spawn ssh user@host expect "password:" send -- "pass\r" expect "*~>" send -- "find /local/"$sign"/ -maxdepth 1 -type d -mtime +30 |xargs rm -rfv\r" expect "*~>" send -- "exit\r"'

any thought how send variable bash expect without double-quotes? btw - cannot utilize keys ssh

you can escape '"$sign"':

ex:

#!/bin/bash sign=ppp expect -c 'spawn ssh tiago@localhost expect "password:" send -- "mypass\r" expect "~" send -- "echo '"$sign"'\r" expect "^ppp" send -- "exit\r"'

linux bash shell ssh expect

ios - Identifying table cells in a method -



ios - Identifying table cells in a method -

i trying implement flatuikit in custom cell in uitableview within viewcontroller returns values nsuserdefaults based on switch state. usual switch, have method 'saveswitchstate' connected valuechanged outlet. problem in want pass state user defaults , utilize label key, method can't access the cells , labels. have tried adding:

static nsstring *cellidentifier = @"cell"; setuponecell *cell = (setuponecell *)[tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath];

to method, still no luck. if there improve way save switch states valuechanged method i'm ears. below viewcontroller , custom cell.

viewcontroller.m:

#import "setup1viewcontroller.h" #import "setup1tableview.h" #import "setuponecell.h" #import "social.h" #import "fuiswitch.h" #import "uifont+flatui.h" #import "uicolor+flatui.h" @interface setup1viewcontroller () - (ibaction)saveswitchstate:(id)sender; @end @implementation setup1viewcontroller - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { // custom initialization } homecoming self; } - (void)viewdidload { [super viewdidload]; self.onetableview.datasource = self; self.onetableview.delegate = self; self.medias = [[nsmutablearray alloc] init]; social *media = [[social alloc] init]; media.socialmedia = @"facebook"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"twitter"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"instagram"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"tumblr"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"gmail"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"linked in"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"github"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"you tube"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"vine"; [self.medias addobject:media]; media = [[social alloc] init]; media.socialmedia = @"soundcloud"; [self.medias addobject:media]; //self.setup1table.editing = yes; } - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } #pragma mark - table view info source - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { homecoming [self.medias count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; setuponecell *cell = (setuponecell *)[tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; cell.cellswitch.oncolor = [uicolor turquoisecolor]; cell.cellswitch.offcolor = [uicolor cloudscolor]; cell.cellswitch.onbackgroundcolor = [uicolor midnightbluecolor]; cell.cellswitch.offbackgroundcolor = [uicolor silvercolor]; cell.cellswitch.offlabel.font = [uifont boldflatfontofsize:14]; cell.cellswitch.onlabel.font = [uifont boldflatfontofsize:14]; social *media = (self.medias)[indexpath.row]; cell.socialname.text = media.socialmedia; homecoming cell; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { return; } - (ibaction)saveswitchstate:(id)sender { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; if ([cell.cellswitch ison]) [defaults setbool:yes forkey:celllabel]; else [defaults setbool:no forkey:celllabel]; } @end

setuponecell.h:

#import <uikit/uikit.h> #import "fuiswitch.h" #import "uifont+flatui.h" #import "uicolor+flatui.h" @interface setuponecell : uitableviewcell @property (weak, nonatomic) iboutlet uilabel *socialname; @property (weak, nonatomic) iboutlet fuiswitch *cellswitch; @end

the basic thought have cell hear switch value changing, study alter view controller through delegate call. in view controller can info associated cell , utilize modify nsuserdefaults.

how this:

inside cell's setup code should add together cell target switch, instead of having view controller target. (probably in cell's -awakefromnib work in sort of -configurewithsocialmedia: method.)

- (void)awakefromnib { [self.cellswitch addtarget:self action:@selector(switchvaluechanged:) forcontrolevents:uicontroleventvaluechanged]; } - (void)switchvaluechanged:(id)sender { [self.delegate setuponecell:self witchvaluedidchange:[self.cellswitch ison]]; }

then create protocol method -setuponecell:switchvaluedidchange: passes cell , switch value. create cell take delegate follows protocol.

code protocol:

@protocol setuponecelldelegate; @interface setuponecell : uitableviewcell @property (weak, nonatomic) iboutlet uilabel *socialname; @property (weak, nonatomic) iboutlet fuiswitch *cellswitch; @property (weak, nonatomic) id<setuponecelldelegate> delegate; @end @protocol setuponecelldelegate <nsobject> - (void)setuponecell:(setuponecell *)cell switchvaluedidchange:(bool)switchvalue; @end

now view controller set callback cell when switch value changes. when configure cell, create sure set view controller delegate:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; setuponecell *cell = (setuponecell *)[tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; cell.cellswitch.oncolor = [uicolor turquoisecolor]; cell.cellswitch.offcolor = [uicolor cloudscolor]; cell.cellswitch.onbackgroundcolor = [uicolor midnightbluecolor]; cell.cellswitch.offbackgroundcolor = [uicolor silvercolor]; cell.cellswitch.offlabel.font = [uifont boldflatfontofsize:14]; cell.cellswitch.onlabel.font = [uifont boldflatfontofsize:14]; social *media = (self.medias)[indexpath.row]; cell.socialname.text = media.socialmedia; cell.delegate = self; homecoming cell; }

and implement delegate method:

- (void)setuponecell:(setuponecell *)cell switchvaluedidchange:(bool)switchvalue { nsindexpath *indexpath = [self.onetableview indexpathforcell:cell]; nsstring *label = [self.medias[indexpath.row] socialmedia]; nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; [defaults setbool:switchvalue forkey:label]; }

ios objective-c uitableview nsuserdefaults uiswitch

java - Delete child objects when removed from parent collection -



java - Delete child objects when removed from parent collection -

i experiencing problem similar 1 discussed here hibernate triggering constraint violations using orphanremoval

unfortunately sqlexception - column cannot null error. entities follows:

calldetail

@onetomany(mappedby = "calldetail", cascade = cascadetype.all, orphanremoval = true) private set<callcycledetail> callcycles; public void addcallcycledetail(callcycledetail callcycledetail) { if (this.callcycles == null) { this.callcycles = new hashset<callcycledetail>(); } callcycles.add(callcycledetail); callcycledetail.setcalldetail(this); } public void removecallcycledetail(callcycledetail callcycledetail) { callcycles.remove(callcycledetail); callcycledetail.setcalldetail(null); }

callcycledetail

@manytoone(optional=false) @joincolumn(name = "call_detail", nullable=false) private calldetail calldetail;

my junit test follows:

calldetail calldetail = createcalldetail(); callcycledetail ccd = new callcycledetail(calldetail); calldetail.addcallcycledetail(ccd); calldetailservice.savecalldetail(calldetail); calldetail = calldetailservice.findcalldetail(calldetail.getid()); calldetail.removecallcycledetail(ccd); calldetailservice.updatecalldetail(calldetail);

it saves correctly. when seek clear set of callcycles, fails notnull constraint. how can prepare this?

java hibernate junit jpa-2.0

c - getopt switch statement never hitting default case -



c - getopt switch statement never hitting default case -

i've tried searching , haven't found duplicate/similar question.

how come "default" never triggering in case? working on previous homework assignments course of study prepare fall, , i'm having issue getopt() in c.

here particular lines in question:

while ((c = getopt(argc, argv, "i:o:")) != -1) { switch (c) { case 'i': infile = strdup(optarg); break; case 'o': outfile = strdup(optarg); break; default: usage(); //this prints "usage" statement , exits cleanly. } }

my issue is, how come calling

./fastsort b c d

doesn't print usage , exit?

the below code search options -i hello or/and -o world

while((c = getopt(argc, argv, "i:o:") != -1)

however executing is:

./fastsort b c d

where getopt(argc, argv, "i:o:") != -1 not satisfied since none of passed argument a b c dis option

c command-line-arguments getopt

google drive sdk - How to handle if else in Dart Future -



google drive sdk - How to handle if else in Dart Future -

i need google drive folder's fileid. if folder not exist, need create folder name , homecoming fileid. fileid, need other works.

the google drive api in dart ok me, can create folder dart. question future. code follow:

class="lang-dart prettyprint-override"> drive.files.list(q:"title='test'").then((result){ if(result.items.length == 0) { driveclient.file file = new driveclient.file.fromjson({"title":"test", "mimetype": "application/vnd.google-apps.folder"}); drive.files.insert(file).then((result2) { homecoming result2.id; }); } else { homecoming result.items[0].id; } });

when test exists, id returned. if test doesn't, function error because no return.

how that?

thanks in advance.

you need homecoming future method phone call in line 4:

class="lang-dart prettyprint-override">drive.files.list(q:"title='test'").then((result){ if(result.items.length == 0) { driveclient.file file = new driveclient.file.fromjson({"title":"test", "mimetype": "application/vnd.google-apps.folder"}); homecoming drive.files.insert(file).then((result2) { homecoming result2.id; }); } else { homecoming result.items[0].id; } });

then() returns new future there completes value returned method give parameter method. then() smart plenty resolve nested future's handle value within then() method , never instance of future.

dart google-drive-sdk

networking - consistent network device naming disable in kickstart centos 6.5 -



networking - consistent network device naming disable in kickstart centos 6.5 -

i disable consistent network device naming in kickstart.

on fedora kickstart options page suggests adding next

network --biosdevname=0

however when add together kickstart anaconda says not valid option.

how disable feature can build dell servers used , default eth0

many thanks

networking centos install

asp.net - Pass a value from the javascript in a user control to a webform -



asp.net - Pass a value from the javascript in a user control to a webform -

right now, have user command raises event webform handles handler. typical set delegate, event, , handler working together.

but trying same javascript. user command calls webservice process task, , gets value.

function performsomething(){ //calls webservice ws.callwebservice(valpassed, onsuccess, onfail); } function onsuccess(result){ //result webform handle in script. how can pass webform? } function onfail(){ alert('something bad happened'); }

so 1 time "result" comes webservice, want webform's javacript take there , whatever needs do. give thanks you.

to phone call javascript function code behind should

javascript:

<script type="text/javascript"> function myfunction(result) { alert('this result:' + result); } </script>

c#:

page.clientscript.registerstartupscript(this.gettype(),"callmyfunction","myfunction(result)",true);

javascript asp.net ajax webforms

javascript - Issues Loading jqGrid with 25,000 Rows -



javascript - Issues Loading jqGrid with 25,000 Rows -

i'm having difficulty loading jqgrid big amount of rows. 1 time document ready i'm calling javascript function gets collection of objects api , adds row info grid. has been working fine, have on 20,000 rows, grid never loads. there can prepare this? possible paint info user can see? example, if row number on pager set 50, can load 50 rows , not 25,000?

here's grid:

$(function () {

$("#grid").jqgrid({ datatype: "local", loadonce: false, height: "auto", search: true, title: false , autowidth: true, shrinktofit: true, searchonenter: true, colnames: ['id', 'bdo number', 'bdo date', 'delivery date', 'miles', 'zip code', 'zone', 'fuel surcharge', 'driver', 'driver rate', 'total driver pay', 'order', 'driver id', 'vendor id', 'vendor', 'airport', 'airline', 'claim reference', 'clear date', 'mileage', 'mileage cost', 'special', 'special cost', 'exc cost', 'pickup date', 'total delivery cost', 'vendor profit', 'driver percent', 'driver fuel surcharge', 'total driver reported', 'payment', 'user cleared', 'excess costs', 'additional fees', 'drivercostschemaid'], colmodel: [ { name: 'id', index: 'id', hidden: true }, { name: 'bdonumber', index: 'bdonumber', align: 'center', classes: 'gridbutton' }, { name: 'bdodate', index: 'bdodate', width: 250, align: 'center', formatter: 'date', formatoptions: { newformat: 'l, f d, y g:i:s a' } }, { name: 'deliverydate', index: 'deliverydate', width: 250, align: 'center', formatter: 'date', formatoptions: { newformat: 'l, f d, y g:i:s a' } }, { name: 'miles', index: 'miles', width: 40, align: 'center' }, { name: 'zipcode', index: 'zipcode', width: 55, align: 'center' }, { name: 'zone', index: 'zone', width: 40, align: 'center' }, { name: 'fuelfloat', index: 'fuelfloat', width: 50, align: 'center', formatter: money, sorttype: 'float' }, { name: 'drivername', index: 'drivername', width: 125, align: 'center' }, { name: 'ratefloat', index: 'ratefloat', width: 75, align: 'center', formatter: money, sorttype: 'float' }, { name: 'payfloat', index: 'payfloat', width: 75, align: 'center', formatter: money, sorttype: 'float' }, { name: 'order', index: 'order', hidden: true }, { name: 'driver', index: 'driver', hidden: true }, { name: 'vendor', index: 'vendor', hidden: true }, { name: 'airport', index: 'airport', hidden: true }, { name: 'airline', index: 'airline', hidden: true }, { name: 'vendorname', index: 'vendorname', hidden: true }, { name: 'claimreference', index: 'claimreference', hidden: true }, { name: 'cleardate', index: 'cleardate', hidden: true, formatter: 'date', formatoptions: { newformat: 'l, f d, y g:i:s a' } }, { name: 'mileage', index: 'mileage', hidden: true }, { name: 'mileagecost', index: 'mileagecost', hidden: true, formatter: money }, { name: 'special', index: 'special', hidden: true }, { name: 'specialcost', index: 'specialcost', hidden: true, formatter: money }, { name: 'exccost', index: 'exccost', hidden: true, formatter: money }, { name: 'pickupdate', index: 'pickupdate', hidden: true, formatter: 'date', formatoptions: { newformat: 'l, f d, y g:i:s a' } }, { name: 'totaldeliverycost', index: 'totaldeliverycost', hidden: true, formatter: money }, { name: 'vendorprofit', index: 'vendorprofit', hidden: true, formatter: money }, { name: 'driverpercent', index: 'driverpercent', hidden: true }, { name: 'driverfuelsurcharge', index: 'driverfuelsurcharge', hidden: true, formatter: money }, { name: 'totaldriverreported', index: 'totaldriverreported', hidden: true, formatter: money }, { name: 'payment', index: 'payment', hidden: true }, { name: 'usercleared', index: 'usercleared', hidden: true }, { name: 'exccost', index: 'exccost', hidden: true }, { name: 'additionalfees', index: 'additionalfees', hidden: true, formatter: money }, { name: 'drivercostschemaid', index: 'drivercostschemaid', hidden: true }, ], rownum: 100, rowlist: [100, 500, 1000, 100000], viewrecords: true, pager: "pager", sortorder: "desc", sortname: "deliverydate", ignorecase: true, headertitles: true, emptyrecords: "there no results.", }) $("#grid").jqgrid('filtertoolbar', { stringresult: true, searchonenter: true, defaultsearch: 'cn' }); getbdos(); });

and getbdos function:

function getbdos() {

var request = $.ajax({ url: "@url.action("getbdos", "dpadmin")", type: "get", cache: false, async: true, datatype: "json" }); request.done(function (results) { var thegrid = $("#grid"); thegrid.cleargriddata(); (var = 0; < 100; i++) { thegrid.addrowdata(i + 1, results[i]); } thegrid.trigger("reloadgrid"); }); }

which calls this:

[authorize] public jsonresult getbdos() { list<bdo> bdos= new list<bdo>(); // bdos bdos = webinterface.getbdos(); var jsonresult = json(bdos.toarray(), jsonrequestbehavior.allowget); jsonresult.maxjsonlength = int.maxvalue; homecoming jsonresult; }

webinterface.getbdos hits database , grabs current bdo objects, between 20,000 - 25,000 , freezes grid. help this?

you should paginating info on server side before sending browser. need fetch next/prev page , redraw grid.

javascript jquery jqgrid

MongoDB MapReduce--is there an Aggregation alternative? -



MongoDB MapReduce--is there an Aggregation alternative? -

i've got collection documents using schema (some members redacted):

{ "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : [ 2, 3, 5 ], "activity" : [ 4, 4, 3 ], }, "media" : [ objectid("537ea185df872bb71e4df270"), objectid("537ea185df872bb71e4df275"), objectid("537ea185df872bb71e4df272") ] }

in schema, first, second, , 3rd positivity ratings correspond first, second, , 3rd entries in media array, respectively. same true activity ratings. need calculate statistics positivity , activity ratings respect associated media objects across documents in collection. right now, i'm doing mapreduce. i'd to, however, accomplish aggregation pipeline.

ideally, i'd $unwind media, answers.ratings.positivity, , answers.ratings.activity arrays simultaneously end with, example, next 3 documents based on previous example:

[ { "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : 2, "activity" : 4 } }, "media" : objectid("537ea185df872bb71e4df270") }, { "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : 3 "activity" : 4 } }, "media" : objectid("537ea185df872bb71e4df275") }, { "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : 5 "activity" : 3 } }, "media" : objectid("537ea185df872bb71e4df272") } ]

is there way accomplish this?

the current aggregation framework not allow this. beingness able unwind multiple arrays know same size , creating document ith value of each feature.

if want utilize aggregation framework need alter schema little. illustration take next document schema:

{ "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : [ {k:1, v:2}, {k:2, v:3}, {k:3, v:5} ], "activity" : [ {k:1, v:4}, {k:2, v:4}, {k:3, v:3} ], }}, "media" : [ {k:1, v:objectid("537ea185df872bb71e4df270")}, {k:2, v:objectid("537ea185df872bb71e4df275")}, {k:3, v:objectid("537ea185df872bb71e4df272")} ] }

by doing adding index object within array. after it's matter of unwinding arrays , matching on key.

db.test.aggregate([{$unwind:"$media"}, {$unwind:"$answers.ratings.positivity"}, {$unwind:"$answers.ratings.activity"}, {$project:{"media":1, "answers.ratings.positivity":1,"answers.ratings.activity":1, include:{$and:[ {$eq:["$media.k", "$answers.ratings.positivity.k"]}, {$eq:["$media.k", "$answers.ratings.activity.k"]} ]}} }, {$match:{include:true}}])

and output is:

[ { "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : { "k" : 1, "v" : 2 }, "activity" : { "k" : 1, "v" : 4 } } }, "media" : { "k" : 1, "v" : objectid("537ea185df872bb71e4df270") }, "include" : true }, { "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : { "k" : 2, "v" : 3 }, "activity" : { "k" : 2, "v" : 4 } } }, "media" : { "k" : 2, "v" : objectid("537ea185df872bb71e4df275") }, "include" : true }, { "_id" : objectid("539f41a95d1887b57ab78bea"), "answers" : { "ratings" : { "positivity" : { "k" : 3, "v" : 5 }, "activity" : { "k" : 3, "v" : 3 } } }, "media" : { "k" : 3, "v" : objectid("537ea185df872bb71e4df272") }, "include" : true } ]

doing creates lot of document overhead , may slower current mapreduce implementation. need run tests check this. computations required grow in cubic way based on size of 3 arrays. should kept in mind.

mongodb mapreduce aggregation-framework

node.js - Backend server app which listens to multiple Server Sent Events and saves data to DB -



node.js - Backend server app which listens to multiple Server Sent Events and saves data to DB -

what best tool/way implement server side application hear multiple server sent events(sse) , action saving values database on receiving events. number of sse listeners alter new users gets registered. considering node.js, please help me thoughts on implementing not server application development background.

i think best solution here -if considering nodejs- utilize websockets. can utilize socket.io , set on own or utilize paas take of you, example: http://pusher.com/.

using websockets can seamlessly communicate client (browser) , and send , receive info in real time. can applied other device capable of doing http connections.

to store values utilize redis, quite fast , should give simple , basic functionality looking for. if actions need atomic, can build simple worker process write values redis database, postgresql instance.

node.js server-sent-events

Variable within a Variable in Bash -



Variable within a Variable in Bash -

can not figure out. can't figure out variable within variable. also, how quiet output if host down.

#/bin/bash ip in `cat list`; output=$( $name=`snmpwalk -v 2c -c snmp2 $ip snmpv2-mib::sysname.0 | grep -o '[^ ]*$'` $type=`snmpwalk -v 2c -c snmp2 $ip snmpv2-smi::mib-2.47.1.1.1.1.13.1 | grep -o '[^ ]*$'` $soft=`snmpwalk -v 2c -c snmp2 $ip 1.3.6.1.2.1.1.1.0 | grep -i ios | awk -f, '{print $2,$3}'` ) if [ $? -eq 0 ]; echo $ip,echo $output[$name][$type][$soft] else echo $ip,null fi done

$name=value wrong. in bash it's name=value.

the $name etc. variables declared in subshell, won't available in outside code.

some other issues code:

it checks exit code of last snmpwalk. utilize set -o errexit own sanity. use $(foo) command substitutions. `foo` obsolete. use more quotes! useless utilize of cat award awarded. use portable shebang line (disclaimer: own answer) echo foo,echo bar print foo,echo bar. ; line separator, whenever sense tempted utilize add together newline clarity.

bash

asp.net - JQuery fixed header is not working when added to master page -



asp.net - JQuery fixed header is not working when added to master page -

everything works fine without master page. when added master page not working.

please help. please response possible.

here actual link: http://www.asual.com/jquery/thead/

my master page:

<%@ master language="vb" codefile="defaultmaster.master.vb" inherits="defaultmaster" %> <%@ register src="~/usercontrols/header.ascx" tagname="header" tagprefix="ucheader" %> <%@ register src="~/usercontrols/topmenu.ascx" tagname="topmenu" tagprefix="uctopmenu" %> <%@ register src="~/usercontrols/sitemap.ascx" tagname="sitemap" tagprefix="ucsitemap" %> <%@ register assembly="trirand.web" tagprefix="trirand" namespace="trirand.web.ui.webcontrols" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="head1" runat="server"> <title>bms</title> <link href="../app_themes/defaulttheme/images/icons/tab_favorite.png" rel="shortcut icon" /> <link href="~/app_themes/defaulttheme/css/static.css" rel="stylesheet" type="text/css" /> <link href="~/app_themes/defaulttheme/css/content.css" rel="stylesheet" type="text/css" /> <link href="~/app_themes/defaulttheme/css/ajaxclass.css" rel="stylesheet" type="text/css" /> <link href="~/app_themes/defaulttheme/css/theme.css" rel="stylesheet" type="text/css" /> <!--------------------jquery css section---------------> <link rel="stylesheet" href="~/app_themes/defaulttheme/ui/css/redmond/jquery-ui-1.8.17.custom.css" /> <link href="../app_themes/defaulttheme/css/ui.jqgrid.css" rel="stylesheet" type="text/css" /> <link href="../scripts/treeview/jquery.treeview.css" rel="stylesheet" type="text/css" /> <!--------------------jquery js---------------> <script type="text/javascript" src="../app_themes/defaulttheme/ui/js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="../app_themes/defaulttheme/ui/js/jquery-ui-1.8.17.custom.min.js"></script> <script type="text/javascript" src="../scripts/trirand/i18n/grid.locale-en.js"></script> <script type="text/javascript" src="../scripts/trirand/jquery.jqgrid.min.js"></script> <script type="text/javascript" src="../scripts/treeview/lib/jquery.cookie.js"></script> <script type="text/javascript" src="../scripts/treeview/jquery.treeview.js"></script> <script type="text/javascript" src="../scripts/custom_ui.js"></script> <!---------------------end------------------------> <!---------------------starting new style link------------------------> <link href="../app_themes/defaulttheme/css/ddsmoothmenu.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="../app_themes/defaulttheme/javascript/ddsmoothmenu.js"></script> <!---------------------end------------------------> <script language="javascript" type="text/javascript"> // track key presses document.onkeydown = checkkeycode; { // global variables used checkkeycode , checkforbrowserclose functions var oldkeycode; var closingkey; // key pressed? function checkkeycode(key) { var keycode; if (window.event) { keycode = window.event.keycode; } else if (key) { keycode = key.which; } // if user pressed alt key(18) , f4(115), trying close browser if ((keycode == 115) && (oldkeycode == 18)) { // alert(keycode); closingkey = true; window.location.href = 'login/logout.aspx'; } oldkeycode = keycode; } } </script> <script language="javascript" type="text/javascript"> // onkeydown="if (event.keycode==8) {event.keycode=0; homecoming event.keycode; }" var isns = (navigator.appname == "netscape") ? 1 : 0; var enablerightclick = 1; //make 1 view source if (isns) document.captureevents(event.mousedown || event.mouseup); function mischandler() { if (enablerightclick == 1) { homecoming true; } else { homecoming false; } } function mousehandler(e) { if (enablerightclick == 1) { homecoming true; } var myevent = (isns) ? e : event; var eventbutton = (isns) ? myevent.which : myevent.button; if ((eventbutton == 2) || (eventbutton == 3)) homecoming false; } function keyhandler(e) { var myevent = (isns) ? e : window.event; if (myevent.keycode == 96) enablerightclick = 1; return; } document.oncontextmenu = mischandler; document.onkeypress = keyhandler; document.onmousedown = mousehandler; document.onmouseup = mousehandler; document.onkeydown = showdown; //--> function showdown() { if (document.all) { if (event.keycode == 116) { event.keycode = 0; homecoming false; } } } function closeit() { navigate("../login.aspx"); //event.returnvalue = " " ; } </script> <!--javascript newly added--> <script type="text/javascript"> ddsmoothmenu.init({ mainmenuid: "smoothmenu1", //menu div id orientation: 'h', //horizontal or vertical menu: set "h" or "v" classname: 'ddsmoothmenu', //class added menu's outer div //customtheme: ["#1c5a80", "#18374a"], contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"] }) ddsmoothmenu.init({ mainmenuid: "smoothmenu2", //menu div id orientation: 'v', //horizontal or vertical menu: set "h" or "v" classname: 'ddsmoothmenu-v', //class added menu's outer div //customtheme: ["#804000", "#482400"], contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"] }) // <![cdata[ var mymenu; window.onload = function () { mymenu = new sdmenu("my_menu"); mymenu.init(); /*var firstsubmenu = mymenu.submenus[0]; mymenu.expandmenu(firstsubmenu); var firstsubmenu1 = mymenu.submenus[1]; mymenu.expandmenu(firstsubmenu1); */ }; // // ]]> // $(document).ready(function () { // $(".ddsmoothmenu ul").hide(); // $(".ddsmoothmenu li").hover( // function () { // $('ul:first', this).show(); // }, // function () { // $('ul:first', this).hide(); // }); // }); </script> <!--end--> </head> <body> <div class="page"> <ucheader:header id="header1" runat="server" /> <div id="logininfo"> <label> welcome <%=userinfo.getuserinfo.fullname%> | [&nbsp;<a id="logoff" href="~/login/logout.aspx" runat="server">log out</a>&nbsp;]</label> </div> <div id="wrapper"> <form id="form1" runat="server"> <asp:scriptmanager id="scriptmanager1" runat="server" enablehistory="true" > </asp:scriptmanager> <div id="topmenucontainer"> <%--<uctopmenu:topmenu id="tpmenu" runat="server" />asyncpostbacktimeout="36000" onnavigate="onnavigatehistory" enablehistory="true" enablesecurehistorystate="false" --%> <div id="portaltopmenu" runat="server"> </div> </div> <div id="pagecontent"> <div id="progressbar"> <ucsitemap:sitemap id="sitemap1" runat="server" /> </div> <asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <div style="width: 100%; height: 100%;"> <asp:updateprogress id="updateprogress1" runat="server"> <progresstemplate> <asp:panel id="updateprogresspanel" runat="server" width="100%" height="100%"> <div style="position: absolute; width: 100%; height: 100%; background-color: gray; z-index: 1000; opacity: 0.4;"> </div> <div style="position: absolute; top: 48%; left: 48%; z-index: 1001"> <asp:image id="image1" imageurl="../app_themes/defaulttheme/images/spinner.gif" runat="server" /> </div> </asp:panel> </progresstemplate> </asp:updateprogress> <asp:alwaysvisiblecontrolextender id="alwaysvisiblecontrolextender1" targetcontrolid="updateprogresspanel" verticalside="top" verticaloffset="0" horizontalside="left" horizontaloffset="0" runat="server" /> </div> <asp:contentplaceholder id="head" runat="server"></asp:contentplaceholder> <asp:contentplaceholder id="contentbody" runat="server"> </asp:contentplaceholder> </contenttemplate> </asp:updatepanel> </div> </form> </div> </div> </body> </html>

and kid page:

<%@ page title="" language="vb" masterpagefile="~/masterpages/defaultmaster.master" autoeventwireup="false" codefile="invoicedailybalance.aspx.vb" inherits="pages_invoicedailybalance" %> <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <asp:content id="content1" contentplaceholderid="contentbody" runat="server"> <script type="text/javascript" src="../scripts/jquery.thead-1.1.min.js"></script> <div id="content"> <div id="content_header" class="no_expand"> <div id="header_title"> <label class="header"> invoice daily balance</label> </div> <div id="header_menu"> <div id="validation"> <asp:label id="lblmessage" runat="server"></asp:label> <asp:validationsummary id="vgsearch" runat="server" validationgroup="vgsearch" cssclass="errormsg" /> </div> </div> <div id="content_main"> <div id="content_main_top"> <fieldset> <!--displays filedset label--> <legend>inputs</legend> <div class="field_content"> <table> <tr> <td> <label class="title"> operator name</label> </td> <td> <label class="title"> start date </label> </td> <td> <label class="title"> end date </label> </td> <td> </td> </tr> <tr> <td class="fields"> <asp:dropdownlist id="ddloptname" runat="server" autopostback="false" cssclass="dd_box" height="24px"> </asp:dropdownlist> &nbsp; <asp:requiredfieldvalidator id="rfvddloptname" runat="server" display="dynamic" controltovalidate="ddloptname" errormessage="please select operator name." validationgroup="vgsearch" cssclass="errormsg">* </asp:requiredfieldvalidator> </td> <td> <%--<asp:textbox id="txtstrtdatesearch" runat="server" text="" width="110px" height="18px"></asp:textbox> <asp:textboxwatermarkextender id="tbwetxtstartdateedit" runat="server" targetcontrolid="txtstrtdatesearch" watermarktext="dd/mm/yyyy" watermarkcssclass="watermarked" /> <asp:maskededitextender id="meedtxtstartdateedit" runat="server" mask="99/99/9999" targetcontrolid="txtstrtdatesearch" clearmaskonlostfocus="true" masktype="date"> </asp:maskededitextender> <asp:calendarextender id="txtstartdateedit_calendarextender" runat="server" enabled="true" targetcontrolid="txtstrtdatesearch" format="dd/mm/yyyy" popupbuttonid="txtstrtdatesearch"> </asp:calendarextender> <asp:requiredfieldvalidator id="rfvtxtstrtdatesearch" runat="server" display="dynamic" controltovalidate="txtstrtdatesearch" errormessage="please come in start date." validationgroup="vgshow" cssclass="errormsg">* </asp:requiredfieldvalidator> <asp:regularexpressionvalidator id="revtxtstartdateedit" runat="server" controltovalidate="txtstrtdatesearch" errormessage="please come in valid start date" validationexpression="^(?:((31/(01|03|05|07|08|10|12))|(((0[1-9]|[12][0-9])|30)/(01|03|04|05|06|07|08|09|10|11|12))|((0[1-9]|[12][0-9]|2[0-8])/02))|(29/02(?=-((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))/((1[6-9]|[2-9]\d)\d{2})$" validationgroup="vgshow" cssclass="errormsg">*</asp:regularexpressionvalidator>&nbsp;--%> <asp:textbox id="txtstrtdatesearch" runat="server" cssclass="txt_small"></asp:textbox> <asp:textboxwatermarkextender id="tbwetxtstrtdatesearch" runat="server" targetcontrolid="txtstrtdatesearch" watermarktext="dd/mm/yyyy" watermarkcssclass="watermarked" /> <asp:maskededitextender id="meetxtstrtdatesearch" runat="server" mask="99/99/9999" targetcontrolid="txtstrtdatesearch" clearmaskonlostfocus="true" masktype="date"> </asp:maskededitextender> <asp:calendarextender id="txtstrtdatesearch_calendarextender" runat="server" enabled="true" targetcontrolid="txtstrtdatesearch" format="dd/mm/yyyy" popupbuttonid="txtstrtdatesearch"> </asp:calendarextender> <asp:requiredfieldvalidator id="rfvtxtstrtdatesearch" runat="server" display="dynamic" controltovalidate="txtstrtdatesearch" errormessage="please come in start date" validationgroup="vgsearch" cssclass="errormsg">* </asp:requiredfieldvalidator> <asp:regularexpressionvalidator id="rexvtxtstrtdatesearch" runat="server" controltovalidate="txtstrtdatesearch" errormessage="please come in valid start date" validationexpression="^(?:((31/(01|03|05|07|08|10|12))|(((0[1-9]|[12][0-9])|30)/(01|03|04|05|06|07|08|09|10|11|12))|((0[1-9]|[12][0-9]|2[0-8])/02))|(29/02(?=-((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))/((1[6-9]|[2-9]\d)\d{2})$" validationgroup="vgsearch" cssclass="errormsg">*</asp:regularexpressionvalidator> </td> <td class="fields"> <asp:textbox id="txtenddatesearch" runat="server" text="" cssclass="txt_small"></asp:textbox> <asp:textboxwatermarkextender id="tbwetxtendedit" runat="server" targetcontrolid="txtenddatesearch" watermarktext="dd/mm/yyyy" watermarkcssclass="watermarked" /> <asp:maskededitextender id="meedtxtenddateedit" runat="server" mask="99/99/9999" targetcontrolid="txtenddatesearch" clearmaskonlostfocus="true" masktype="date"> </asp:maskededitextender> <asp:calendarextender id="txtenddateedit_calendarextender" runat="server" enabled="true" targetcontrolid="txtenddatesearch" format="dd/mm/yyyy" popupbuttonid="txtenddatesearch"> </asp:calendarextender> <asp:requiredfieldvalidator id="rfvtxtenddatesearch" runat="server" display="dynamic" controltovalidate="txtenddatesearch" errormessage="please come in end date" validationgroup="vgsearch" cssclass="errormsg">* </asp:requiredfieldvalidator> <asp:regularexpressionvalidator id="revtxtenddateedit" runat="server" controltovalidate="txtenddatesearch" errormessage="please come in valid end date" validationexpression="^(?:((31/(01|03|05|07|08|10|12))|(((0[1-9]|[12][0-9])|30)/(01|03|04|05|06|07|08|09|10|11|12))|((0[1-9]|[12][0-9]|2[0-8])/02))|(29/02(?=-((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)))))/((1[6-9]|[2-9]\d)\d{2})$" validationgroup="vgsearch" cssclass="errormsg">*</asp:regularexpressionvalidator> <asp:comparevalidator id="cmpval1" controltocompare="txtstrtdatesearch" controltovalidate="txtenddatesearch" type="date" operator="greaterthanequal" errormessage="end date should not less start date" runat="server" validationgroup="vgsearch" cssclass="errormsg">*</asp:comparevalidator> </td> <td> <asp:button id="btnsearch" runat="server" text="search" cssclass="submitbtn" validationgroup="vgsearch" causesvalidation="true" /> </td> </tr> </table> </div> </fieldset> </div> <div id="content_main_bottom" class="sample jquery-thead" > <asp:gridview id="gvinvoiceddailybalance" runat="server" autogeneratecolumns="false" showfooter="true" cssclass="gridview" alternatingrowstyle-cssclass="gv_altrow" footerstyle-cssclass="gv_footer" pagerstyle-cssclass="gv_pager" emptydatatext="no info found"> <alternatingrowstyle cssclass="gv_altrow"></alternatingrowstyle> <columns> <asp:boundfield datafield="billing date" headertext="billing date" /> <asp:boundfield datafield="start balance" headertext="start balance" /> <asp:boundfield datafield="payment or receipt" headertext="payment or receipt" /> <asp:boundfield datafield="adjustment" headertext="adjustment" /> <asp:boundfield datafield="no of call" headertext="no of call" /> <asp:boundfield datafield="chargeable duration" headertext="chargeable duration" /> <asp:boundfield datafield="chargeable amount" headertext="chargeable amount" /> <asp:boundfield datafield="end balance" headertext="end balance" /> <asp:boundfield datafield="% of utilization" headertext="% of utilization" /> <asp:boundfield datafield="status" headertext="status" /> </columns> </asp:gridview> </div> </div> </div> </div> </asp:content>

i added in aspx.vb page:

protected sub gvinvoiceddailybalance_prerender(byval sender object, byval e system.eventargs) handles gvinvoiceddailybalance.prerender if gvinvoiceddailybalance.rows.count > 0 gvinvoiceddailybalance.databind() gvinvoiceddailybalance.headerrow.tablesection = tablerowsection.tableheader end if end sub

please add together content place holder in master page.

<asp:contentplaceholder id="head" runat="server"></asp:contentplaceholder>

and place jquery files under <head> tag. might work

jquery asp.net gridview

javascript - Meteor method cannot read property "quantity" undefined -



javascript - Meteor method cannot read property "quantity" undefined -

i'm getting error "typeerror: cannot read property 'quantity' of undefined" when running meteor method.

frontend call:

template.listingpage.events({ "submit #add-to-cart": function(e,t){ e.preventdefault(); var quantity = parseint($("#spinner-01").val()); var listingid = t.data._id; if(!session.get("cartid")){ var id = carts.insert({ line_items: []}); session.set("cartid", id); } var cartid = session.get("cartid"); meteor.call("addtocart", (quantity, listingid, cartid), function(err, res){ if(err){ toastr.error(err.reason, "error"); } else{ toastr.success("added cart", "success"); } }); } });

method ( in collection folder ):

meteor.methods({ addtocart: function(quantity, listingid, cartid){ var listing = listings.findone(listingid); if(quantity > listing.quantity) throw new meteor.error(422, 'you cannot add together many cart'); var lineitem = lineitems.find({ cartid: cartid, listingid: listingid }); if(lineitem){ //in cart var cartquantity = lineitem.quantity; if ( (cartquantity + quantity) > listing.quantity) throw new meteor.error(422, 'you cannot add together many cart'); lineitems.update({ cartid: session.get("cartid"), listingid: listingid}, { $inc: { quantity: quantity}}); toastr.success("added cart", "success"); } else{ // not in cart lineitem = { cartid: cartid, listingid: listingid, quantity: quantity, imageid: listing.imageobj._id } lineitems.insert(lineitem); carts.update(cartid, { $inc: { count: 1 }}); } } });

line 5 on method causing error, seems listing undefined. why case when subscribed listing on route calls method. need create server method?

when phone call method

meteor.call("addtocart", (quantity, listingid, cartid), function(err, res){

you shouldn't have ( ) around quantity, listingid, cartid:

meteor.call("addtocart", quantity, listingid, cartid, function(err, res){

when write f(a, (b, c, d), e), (b, c, d) comma operator, evaluates operands, returns lastly one. same f(a, d, e).

javascript jquery mongodb meteor

java - How to show IDs of objects in ArrayList -



java - How to show IDs of objects in ArrayList -

i have little application can write random stuff , save in sqllite database file. activity read informations , show in arraylist. created button delete first object of list. i'm trying alter bit user can take object deleted. , it's working great well. problem don't know how show ids of objects list on screen. can @ code , help me?

oncreate in activity shows list:

dbwrapper = new mydatabasewrapper(this); dbwrapper.open(); mycontactslist = dbwrapper.getallcontacts(); this.setlistadapter(new arrayadapter<mycontact>(this, android.r.layout.simple_list_item_1, mycontactslist));

getallcontacts function mydatabasewrapper:

public list<mycontact> getallcontacts() { list<mycontact> mylist = new arraylist<mycontact>(); cursor c = db.rawquery("select * " + contacts_table, null); c.movetofirst(); while (!c.isafterlast()) { mycontact mc = new mycontact(); mc.setdata(c.getint(0), c.getstring(1), c.getstring(2), c.getstring(3)); c.movetonext(); mylist.add(mc); } c.close(); homecoming mylist; }

and class convert values database string:

package com.example.sqlite; import java.util.arraylist; import java.util.list; public class mycontact { string imie; string nazwisko; string tel; int id; public mycontact() { // todo auto-generated constructor stub } public void setdata(int _id, string i, string n, string t){ id=_id; imie=i; nazwisko=n; tel=t; } @override public string tostring() { homecoming "[" + string.valueof(id) + "]" + "\n" + imie + "\n" + nazwisko + "\n" + tel; } public int getid() { homecoming id; } }

it looks that: http://screenshooter.net/100009676/chxmipm http://screenshooter.net/100009676/ngbxmgx

i deleted 1 object number 3.

so yeah. far number in "[ ]" id database. want alter number id of object.

i don't much android dev apologize may not understand this, why can't utilize indexof(object o)? wouldn't plenty id of given element, long know element itself? (which, assuming want delete it, would)

java android arraylist

javascript - JQuery Mobile popup snaps to top after closing -



javascript - JQuery Mobile popup snaps to top after closing -

i'm working on app uses jquery mobile show popup upon tapping image. image larger version of tapped one.

the problem when tap anywhere on screen snaps top of page, annoying when want browse through images.

is mutual thing jquery mobile? don't have code show besides this:

<div class="block"> <a href="#bl209" data-rel="popup" data-position-to="window"><img src="img/items/autorai-b/bl209.jpg" alt="block" width="100%" height="100%"></a> <p>bl209</p> <div data-role="popup" id="bl209"> <img src="img/items/autorai-b/bl209.jpg" alt="block" width="100%" height="100%"> </div> </div>

javascript jquery ios css jquery-mobile

python - Scripts quits after launching Popen command -



python - Scripts quits after launching Popen command -

while true: command = 'cmd /c start chrome http://google.com' subprocess.popen(command) time.sleep(120)

when seek launch browser chrome using code in python, browser launches after script quits. there way launch browser , move on process next block of codes.

i tried changin/c /k , using subprocess.popen(command, stdout=subprocess.pipe).wait() in case neither quit nor process next block of codes

wait () wait launched programme terminate. without wait script go on after launching

python python-2.7

How can I get my javascript image onMouseOver code to work in an html image map? -



How can I get my javascript image onMouseOver code to work in an html image map? -

i'm trying code working chrome, firefox , ie. each link in image map has have own image should appear on hover. main problem links showing same image instead of own specific one.

also, seems work in chrome :( why?

please help if can :)

fiddle

sample html file

<img src="images/solutions_table.jpg" width="940" height="818" alt="solutions comparative table" usemap="tablemap"> <map name="tablemap" > <script type = "text/javascript"> function show() { document.getelementbyid('pop').style.visibility = 'visible'; } function hide() { document.getelementbyid('pop').style.visibility = 'hidden'; } </script> <area id="pop" class="p1" href="minnow.html" shape="rect" coords="1,116,105,184" alt="minnow" onmouseover="show()" onmouseout="hide()"> <area id="pop" class="p2" href="guppie.html" shape="rect" coords="1,182,105,250" alt="guppie" onmouseover="show()" onmouseout="hide()"> <area id="pop" class="p3" href="blue marlin.html" shape="rect" coords="1,248,105,316" alt="blue marlin" onmouseover="show()" onmouseout="hide()"> <area id="pop" class="p4" href="black marlin.html" shape="rect" coords="1,314,105,382" alt="black marlin" onmouseover="show()" onmouseout="hide()"> <area id="pop" class="p5" href="baracuda.html" shape="rect" coords="1,381,105,450" alt="baracuda" onmouseover="show()" onmouseout="hide()"> </map>

the css

#pop { display:block; width:506px; height:506px; z-index:110; position:absolute; margin-top:-701px; margin-left:105px; visibility:hidden; } .p1 { content:url(images/minnow.jpg); display:block; width:506px; height:506px; z-index:110; position:absolute; margin-top:-701px; margin-left:105px; visibility:hidden; } .p2 { content:url(images/guppie.jpg); display:block; width:506px; height:506px; z-index:110; position:absolute; margin-top:-701px; margin-left:105px; visibility:hidden; } .p3 { content:url(images/blue marlin.jpg); display:block; width:506px; height:506px; z-index:110; position:absolute; margin-top:-701px; margin-left:105px; visibility:hidden } .p4 { content:url(images/black marlin.jpg); display:block; width:506px; height:506px; z-index:110; position:absolute; margin-top:-701px; margin-left:105px; visibility:hidden } .p5 { content:url(images/baracuda.jpg); display:block; width:506px; height:506px; z-index:110; position:absolute; margin-top:-701px; margin-left:105px; visibility:hidden }

thank you!

in jsfiddle, if you're going phone call functions in events, need declare variables window.show , window.hide because script set within window.onload method:

window.show = function() { document.queryselector('.pop').style.visibility = 'visible'; } window.hide = function() { document.queryselector('.pop').style.visibility = 'hidden'; }

if want to, can alter wrap on left side of jsfiddle. alternative no wrap - in <body> puts script in global scope, before closing of body tag.

javascript html css

numpy - python equivalent of MATLAB statement A(B==1)= C -



numpy - python equivalent of MATLAB statement A(B==1)= C -

i have 3 numpy arrays follows:

a = [1, 2, 3, 4, 5] b = [0, 1, 0, 0, 1] c = [30, 40]

i replace elements of equivalent in b equal 1. above illustration this:

a = [1, 30, 3, 4, 40]

in matlab, can this:

a(b==1) = c'

do know equivalent code in python (preferably works when , b multidimensional too)? in advance.

the syntax pretty similar:

>>> import numpy np >>> = np.array([1, 2, 3, 4, 5]) >>> b = np.array([0, 1, 0, 0, 1]) >>> c = np.array([30, 40]) >>> a[b==1] = c >>> array([ 1, 30, 3, 4, 40])

python numpy indexing

xcode - Objective C general troubleshooting process -



xcode - Objective C general troubleshooting process -

i'm 2 weeks learning objective-c (but previous experience java , python), , after initial hurdle i'm starting hang of things pointers, arc, , delegates. however, on more 1 occasion i've come across problem/bug have no thought how solve, , worse, have no thought how approach solution.

my general troubleshooting strategy, when things aren't working expected, follows:

reread through relevant section of code create sure general logic , flow makes sense look @ self-defined methods , create sure they're working properly put few nslog statements within code see doing unexpected things once i've identified troublesome part(s), search apple docs/stackoverflow/google see if has experienced same problems.

i might omitting step , general process works part. however, there problems come across process not work, , totally stuck. few examples:

i trying load nswindowcontroller using proper method called in proper location, wasn't displaying. turned out issue pointers, after long time of aimless experimenting i'm testing illustration pulled straight apple technical q&a create clickable hyperlink nsattributedstring, when hover on said link pointing hand cursor not appear. see my thread more info. i've created nsbutton , want pointing hand cursor appear when hover on button. i'm using code in accepted reply here, doesn't work , don't know why. also, subclassing every button want utilize tedious , messy.

clearly troubleshooting strategy not working. 1 time exhaust 4 steps no avail, have seek random fixes until one, seemingly magically, works. neither time efficient nor helping me understand language better. there steps can add together troubleshooting strategy, , if so, they?

for example, when asked friend same question, suggested using breakpoints monitor instance variables , objects.

when across bug,

first thing need read error, see error , occurred. go specific location of error, see if there obvious mistake. if not, set break point @ skeptical location, step in , check step step see if each value on stack expected be. you may want set test, consider possibilities, such if value null, if it's 0, etc.

sometimes bugs tricky, not recommended read code on 1 time again each time see error.

objective-c xcode osx cocoa oop

view - Share data in every subview -



view - Share data in every subview -

i have created layout contains header , main content changes regularly.

@include('tshop.includes.header') @yield('content') @include('tshop.includes.footer')

i have created below view composer in order pass products in basket pop dialog in header.

view::composer('tshop.includes.header', function($view) { $basket = app::make('basketinterface'); $view->with( 'productsiterator' , $basket->getiterator() ); });

the thing want share in views, including main content.

i tried utilize share (and shares) function thinking same view::share isn't.

view::composer('tshop.includes.header', function($view) { $basket = app::make('basketinterface'); $view->share( 'productsiterator' , $basket->getiterator() ); });

i tried utilize view composer layout in vain.

view::composer('tshop.layouts.default', function($view) { $basket = app::make('basketinterface'); $view->shares( 'productsiterator' , $basket->getiterator() ); });

next placed below filter constructor.

$this->beforefilter(function() { $basket = app::make('basketinterface'); view::share('productsiterator' , $basket->getiterator()); });

and worked, utilize several controllers, it's not best thing do. know can create base of operations controller class , extend isn't there improve way do?

you may utilize app::before event share info views globally using view::share, example:

app::before(function($request) { $basket = app::make('basketinterface'); view::share( 'productsiterator' , $basket->getiterator() ); });

now, may access $productsiterator view , btw, have used shares instead of share. may utilize view composer instead of using view::share, this:

view::composer('tshop.includes.header', function($view) { $basket = app::make('basketinterface'); homecoming $view->with( 'productsiterator' , $basket->getiterator() ); });

in case need utilize $view->with() method instead of share.

view laravel-4 blade

android - How to scroll the edittext inside the scrollview -



android - How to scroll the edittext inside the scrollview -

i have scrollview within there editext multiline. want scroll edittext see lower content can't done.

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="50dp" android:background="@android:color/holo_blue_light" android:gravity="center" > <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="view complaint" android:textappearance="?android:attr/textappearancelarge" /> </linearlayout> <scrollview android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:padding="20dp" > <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="15dp" android:text="order number 0100c1" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textview3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="5dp" android:text="name of clientclient 1" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textview4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="5dp" android:text="subject : measurement issues" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textview5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="25dp" android:text="description" android:textappearance="?android:attr/textappearancemedium" /> <textview android:id="@+id/textview6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="15dp" android:text="lorem ipsum dolor sit down amet, sapien etiam, nunc amet dolor ac odio mauris justo. luctus arcu, urna praesent @ id quisque ac. arcu massa vestibulum malesuada, integer vivamus el/ european union " android:textappearance="?android:attr/textappearancemedium" /> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <textview android:id="@+id/textview7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="2dp" android:text="assign to" android:textappearance="?android:attr/textappearancemedium" /> <spinner android:id="@+id/spinner1" android:layout_width="match_parent" android:layout_height="40dp" android:entries="@array/array_name" /> </linearlayout> <edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="200dp" android:layout_margintop="15dp" android:background="#eeeeee" android:inputtype="textmultiline" android:singleline="false" android:text="android applications run exclusively on single thread default “ui thread” or “main thread”. android:textappearance="?android:attr/textappearancemedium" > </edittext> <textview android:id="@+id/textview5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="20dp" android:text="comment history" android:textappearance="?android:attr/textappearancemedium" /> <imageview android:id="@+id/imageview1" android:layout_width="fill_parent" android:layout_height="147dp" android:src="@drawable/adddd" /> <checkbox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margintop="10dp" android:text="close complaints" android:textappearance="?android:attr/textappearancelarge" /> <button android:id="@+id/login" style="?android:attr/buttonstylesmall" android:layout_width="match_parent" android:layout_height="45dp" android:layout_below="@+id/ll" android:layout_marginleft="20dp" android:layout_marginright="20dp" android:layout_margintop="15dp" android:background="@drawable/login_btn" android:text="submit" android:textcolor="@android:color/holo_blue_dark" android:textsize="25dp" android:textstyle="bold" /> </linearlayout> </scrollview>

can guys help me in . think edittext getting focus when cursor within it.

thanks..!!!!!

try this..

add below lines edittext

android:overscrollmode="always" android:scrollbarstyle="insideinset" android:scrollbars="vertical"

example

<edittext android:id="@+id/edittext1" android:layout_width="match_parent" android:layout_height="200dp" android:layout_margintop="15dp" android:background="#eeeeee" android:inputtype="textmultiline" android:singleline="false" android:overscrollmode="always" android:scrollbarstyle="insideinset" android:scrollbars="vertical" android:text="android applications run exclusively on single thread default “ui thread” or “main thread”. android:textappearance="?android:attr/textappearancemedium" > </edittext>

edit

programmatically

youredittext.setontouchlistener(new ontouchlistener() { public boolean ontouch(view v, motionevent event) { v.getparent().requestdisallowintercepttouchevent(true); switch (event.getaction() & motionevent.action_mask){ case motionevent.action_up: v.getparent().requestdisallowintercepttouchevent(false); break; } homecoming true; } });

android user-interface scrollview

mongodb - How to monitor Inserts for whole sharded cluster via web? -



mongodb - How to monitor Inserts for whole sharded cluster via web? -

i have installed , running mongodb sharded cluster consists of:

conf1.example.com conf2.example.com conf3.example.com query1.example.com query2.example.com shard1.example.com shard2.example.com shard3.example.com

is there possibility monitor inserts whole cluster not each instance separately via web interface? i'm not mongodb developer, need easy installation solution.

thank you.

mongodb

dynamics crm 2011 - switch between SetStateDynamicEntity Update and Create -



dynamics crm 2011 - switch between SetStateDynamicEntity Update and Create -

the pipeline stage pre-valadation:

does know how switch between entityreference , entity. have got problem. have fire plugin setstatedynamicentity ,update , create if fire setstatedynamicentity doesn’t (entity target = (entity)context.inputparameters["target"];) because doesn’t have target , have got enitymonika , it’s not entity if fire update , create stop on there want target how can switch between them

in case plugin triggered setstatedynamicentity message should register preimage fields - http://inogic.com/blog/2010/07/pre-image-post-image-explained/

dynamics-crm-2011 dynamics-crm crm

yii - Construct CDbCriteria with column names as MySQL reserved words -



yii - Construct CDbCriteria with column names as MySQL reserved words -

i have same problem in this question (attempt utilize cdbcriteria column named key, reserved word in mysql). however, provided solution:

$criteria = new cdbcriteria; $criteria->condition = 't.key=:key'; $criteria->params = array(':key'=>$this->key); $criteria->compare('position', $this->position); $criteria->compare('dictionary', $this->dictionary);

works me partially. don't exception anymore, search works key column only. other ignored (if key set, respects value in search, if not set -- returns empty results set).

what missing? how should build cdbcriteria queries, when table contains reserverd words column names, search respect other (non-reserved) columns well, not one?

cdbcriteria::compare() adds status if parameter set otherwise no action taken.see here

$criteria->condition = 't.key=:key'; $criteria->params = array(':key'=>$this->key);

however logic works irrespective of whether key set or not. status becomes

select * `some_table` t t.key =:key

even though key value beingness blank resulting in query breaking when key attribute not set

so if modify statement work

if(isset($this->key){ $criteria->condition = 't.key=:key'; $criteria->params = array(':key'=>$this->key); }

in case statement activated when key attribute set, ignored otherwise, , query not break

yii

c++ - binary '[' : 'std::initializer_list' does not define this operator or a conversion to a type acceptable to the predefined operator -



c++ - binary '[' : 'std::initializer_list<const char *>' does not define this operator or a conversion to a type acceptable to the predefined operator -

how access value initializer declared using auto keyword?

auto arr = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; auto = arr[0];

give next compile-error on vs:

binary '[' : 'std::initializer_list' not define operator or conversion type acceptable predefined operator

take @ interface of std::initializer_list:

auto arr = { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; auto = *arr.begin();

(or, more practical, initialize container or array braced-init-list)

c++ c++11 visual-studio-2013

asp.net mvc 4 - An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll -



asp.net mvc 4 - An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll -

<div class="head"> @{html.renderaction("top_head", "my_partialview");} </div> <div class="content"> <div class="content-left"> <div class="ad"> <img src="~/images/imagefontend/ad.jpg" /> </div> @renderbody() </div><!--end content-left--> <div class="content-right"> <div class="##-lhe-support-login-sp" id="lien-he"> <div class="label-238px-box"></div> <img src="~/images/imagefontend/call-pic.jpg" /> </div> @{html.renderaction("search_price", "my_partialview");}

2.created my_partialview

using system; namespace shopclothes.controllers { public class my_partialviewcontroller : controller { shoponline1entities db = new shoponline1entities(); // get: /mypartialview/ #region[head] [childactiononly] public actionresult top_head() { homecoming partialview(); } #endregion } }

i follow right syntax? why has been such problem?

the @renderbody should utilize on layout views, seek removing that

asp.net-mvc-4

c++ - Why does unique_ptr overload reset(pointer p = pointer()) and reset(nullptr_t)? -



c++ - Why does unique_ptr overload reset(pointer p = pointer()) and reset(nullptr_t)? -

accroding http://en.cppreference.com/w/cpp/memory/unique_ptr/reset,

void reset( pointer ptr = pointer() ); template< class u > void reset( u ) = delete; void reset( std::nullptr_t p );

1) given current_ptr, pointer managed *this, performs next actions, in order: saves re-create of current pointer old_ptr = current_ptr; overwrites current pointer argument current_ptr = ptr; if old pointer non-empty, deletes managed object if(old_ptr != nullptr) get_deleter()(old_ptr).

2) in specialization dynamic arrays, std::unique_ptr<t[]>, template fellow member provided prevent using reset() pointer derived (which result in undefined behavior arrays).

3) in specialization dynamic arrays, std::unique_ptr<t[]>, 3rd overload necessary allow reset nullptr (which otherwise prohibited template overload). equivalent reset(pointer())

now reset(nullptr) equivalent reset(pointer()), why latter exist?

if want reset array form unique_ptr, why can not utilize rest(pointer())?

the

template< class u > void reset( u ) = delete;

would chosen phone call nullptr argument, if not for

void reset( std::nullptr_t p );

that's why exists, allow phone call nullptr.

example (compile fix defined suppress compilation error):

#include <cstddef> // std::nullptr_t struct s { void reset( char* ) {} template< class type > void reset( type ) = delete; #if prepare void reset( std::nullptr_t ) {} #endif }; auto main() -> int { s().reset( nullptr ); // fails when prepare not defined. }

c++ arrays c++11 overloading unique-ptr

how do i integrate spree commerce with spree hub? -



how do i integrate spree commerce with spree hub? -

i integrate spree commerce hub. can't find tutorials spree site. can give me tutorials so. or guide me it! give thanks you.

integrating spree commerce wombat (the hub's new name) can done gem, has decent readme on how:

https://github.com/spree/spree_wombat

spree

Parsing values from a JSON file in Python -



Parsing values from a JSON file in Python -

i have json in file:

{ "maps": [ { "id": "blabla", "iscategorical": "0" }, { "id": "blabla", "iscategorical": "0" } ], "masks": [ "id": "valore" ], "om_points": "value", "parameters": [ "id": "valore" ] }

i wrote script prints of json text:

json_data=open(file_directory).read() info = json.loads(json_data) pprint(data)

how can parse file , extract single values?

i think ignacio saying json file incorrect. have []s when should have {}s. []s lists, {}s dictionaries. here's how json file should (your json file wouldn't load me):

{"maps":[{"id":"blabla","iscategorical":"0"},{"id":"blabla","iscategorical":"0"}], "masks":{"id":"valore"}, "om_points":"value", "parameters":{"id":"valore"} }

then can utilize code:

import json pprint import pprint open('data.json') data_file: info = json.load(data_file) pprint(data)

with data, can find values in so:

data["maps"][0]["id"] data["masks"]["id"] data["om_points"]

try out , see if starts create sense.

python json parsing

java - Can nulling a method variable make it garbage collectable? -



java - Can nulling a method variable make it garbage collectable? -

this question has reply here:

does setting java objects null anymore? 4 answers

background: have method bunch of fiddling copies of giant lists , running our of memory. of in single method scope.

question: luckily need original giant list @ origin of method. in method, setting list null allow garbage collecting it? or jit or compiler automatically dereference variable sees no longer used? i'm thinking minor optimization allow before garbage collection.

there no need nullify variable. article on garbage collection (that worth read) can found here. looking section labeled "explicit nulling"

java garbage-collection jvm

python - Pandas read_csv import results in error -



python - Pandas read_csv import results in error -

my csv follows (mqm q.csv):

date-time,value,grade,approval,interpolation code 31/08/2012 12:15:00,,41,1,1 31/08/2012 12:30:00,,41,1,1 31/08/2012 12:45:00,,41,1,1 31/08/2012 13:00:00,,41,1,1 31/08/2012 13:15:00,,41,1,1 31/08/2012 13:30:00,,41,1,1 31/08/2012 13:45:00,,41,1,1 31/08/2012 14:00:00,,41,1,1 31/08/2012 14:15:00,,41,1,1

the first few lines have no "value" entries start later on.

here code:

import pandas pd stringio import stringio q = pd.read_csv(stringio("""/cygdrive/c/temp/mqm q.csv"""), header=0, usecols=["date-time", "value"], parse_dates=true, dayfirst=true, index_col=0)

i next error:

traceback (most recent phone call last): file "daily.py", line 4, in <module> q = pd.read_csv(stringio("""/cygdrive/c/temp/mqm q.csv"""), header=0, usecols=["date-time", "value"], parse_dates=true, dayfirst=true, index_col=0) file "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 443, in parser_f homecoming _read(filepath_or_buffer, kwds) file "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 228, in _read parser = textfilereader(filepath_or_buffer, **kwds) file "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 533, in __init__ self._make_engine(self.engine) file "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 670, in _make_engine self._engine = cparserwrapper(self.f, **self.options) file "/usr/lib/python2.7/site-packages/pandas-0.14.0-py2.7-cygwin-1.7.30-x86_64.egg/pandas/io/parsers.py", line 1067, in __init__ col_indices.append(self.names.index(u)) valueerror: 'value' not in list

link file

this appears bug csv parser, firstly works:

df = pd.read_csv('mqm q.csv')

also works:

df = pd.read_csv('mqm q.csv', usecols=['value'])

but if want date-time fails same error message yours.

so noticed utf-8 encoded , converted using notepad++ ansi , worked, tried utf-8 without bom , worked.

i converted utf-8 (presumably there bom) , failed same error before, don't think imaging , looks bug.

i using python 3.3, pandas 0.14 , numpy 1.8.1

to around this:

df = pd.read_csv('mqm q.csv', usecols=[0,1], parse_dates=true, dayfirst=true, index_col=0)

this set index date-time column correctly convert datetimeindex.

in [40]: df.index out[40]: <class 'pandas.tseries.index.datetimeindex'> [2012-08-31 12:15:00, ..., 2013-11-28 10:45:00] length: 43577, freq: none, timezone: none

python csv pandas