Monday, 15 August 2011

excel - Paste Values From One Worksheet To Another If X = True -



excel - Paste Values From One Worksheet To Another If X = True -

i'm trying create macro that, if column f in 5th worksheet = 3, pastes values left of 3 (columns through e) sheet (sheet 1). can't seem started. when run macro nil happens. i'm sure i've made bunch of dumb mistakes.

thanks in advance help!

jack

sub movevalues() dim q integer, w integer w = 7 q = 1 1000 if activeworkbook.worksheets("taxable accounts import").cells(q, 6).value = 3 range(cells(q, 1), cells(q, 5)).select selection.copy worksheets(1).select range(22, w).select selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks _ :=false, transpose:=false worksheets(5).select w = w + 1 end if next q end sub

i think issue here you're copying 5 cells in row worksheets(5), incrementing w 1 on each loop. if goal add together same row on worksheets(1), need increment w 5 instead... nice, easy prepare haha:

w = w + 5

that beingness said, you're looping 1000 times, means there potentially 1000 matches, populate 1000 columns (or 5000 columns if by-5-correction accurate). that's lot! if intention instead start @ row 7, column 22, , increment rows there, might utilize next strategy. (heavily commented explain what's going on...)

option explicit sub movevaluesrev2() dim q long, w long dim tai worksheet, sheetone worksheet, _ sheetfive worksheet dim source range, target range 'set references up-front w = 7 set tai = thisworkbook.worksheets("taxable accounts import") set sheetone = thisworkbook.worksheets(1) set sheetfive = thisworkbook.worksheets(5) 'loop through cells in question q = 1 1000 if tai.cells(q, 6).value = 3 'store left-of-the-found-value-3 cells in range sheetfive set source = .range(.cells(q, 1), .cells(q, 5)) end 'set target range in row w, col 22 sheetone set target = .cells(w, 22) end 'the next 2 lines re-create , paste step source.copy target.pastespecial (xlpastevalues) 'increment w w = w + 1 end if next q end sub

excel vba excel-vba paste

angularjs - Angular routeProvider named groups not working? -



angularjs - Angular routeProvider named groups not working? -

this code. i'm trying match url. if replace /*path /:something/:somethingelse , visit /asdf/asdf work, won't match @ using /*path. i've been able find indicates proper syntax.

i'm using angular 1.2.18, , have tried bleeding border beta release well.

does know might running here?

edit: here's fiddle showing not working: http://jsfiddle.net/2hyk9/

window.myapp = myapp = angular.module 'myapp', ['ngresource', 'ngsanitize', 'nganimate', 'ngroute', 'ngtouch'] myapp.config ['$locationprovider', ($locationprovider) -> $locationprovider.html5mode true ] myapp.config ['$routeprovider', ($routeprovider, $routeparams, $location) -> $routeprovider. when("/*path", { templateurl: (path) -> console.log path homecoming '/pages/asdf.html' , controller: 'browsecontroller', reloadonsearch: false }) ]

i think right syntax :path*.

from angular documentation:

path can contain named groups starting colon , ending star: e.g.:name*. characters eagerly stored in $routeparams under given name when route matches.

angularjs

Grafana won't connect to InfluxDB -



Grafana won't connect to InfluxDB -

the database, username, , password combination work. next configuration grafana doesn't tho.

datasources: { influxdb: { type: 'influxdb', url: "http://xxx.xxx.xxx.xx:8086/db/dbname", username: 'username', password: 'password', default: true }, },

i've tried removing default parameter, changing influxdb influx, , append /series url, no avail. has gotten work?

influxdb v0.7.3 (git: 216a3eb) grafana 1.6.0 (2014-06-16)

i'm using below configuration , works. seek insert grafana database db , add together grafana db configuration.

...

datasources: {

influxdb: { type: 'influxdb', url: "http://localhost:8086/db/test", username: 'root', password: 'xxxx' }, grafana: { type: 'influxdb', url: "http://localhost:8086/db/grafana", username: 'root', password: 'xxxx', grafanadb: true } },

...

influxdb grafana

c - How to setup an Autoconf project to make with GTK? -



c - How to setup an Autoconf project to make with GTK? -

how setup autoconf project utilize gtk? there 1 source file (main.c). created necessary files autoconf, , when type "make" can't find gtk include "gtk/gtk.h".

// create error

make[2]: entering directory `/home/anon/projects/firstgtkprog/src' gcc -dhave_config_h -i. -i.. -g -o2 -mt main.o -md -mp -mf .deps/main.tpo -c -o main.o main.c main.c:1:21: fatal error: gtk/gtk.h: no such file or directory compilation terminated.

// configure.ac file contents

ac_init([firstgtkprog], [1.0], [bug-developer@foda.com])

am_init_automake([-wall -werror foreign])

ac_prog_cc

ac_config_headers([config.h])

ac_config_files([ makefile src/makefile ])

ac_output

gtk+ uses pkg-config utility provide necessary compiler , library flags development tools build programs library. example, pkg-config --cflags gtk+-3.0 prints out flags compile gtk, , pkg-config --libs gtk+-3.0 prints out libs.

to integrate autoconf build system, need utilize pkg_check_modules macro. this tutorial explains in details.

c gcc gtk configure autoconf

c# - Jpeg to pdf with itextsharp is cutted on top and bottom -



c# - Jpeg to pdf with itextsharp is cutted on top and bottom -

i utilize itextsharp assembly in order convert jpg pdf.

my jpg scanned twain ( a4). jpg good.

i convert png in pdf this:

document doc = new document(); pdfwriter.getinstance(doc, new system.io.filestream(this._filename, system.io.filemode.create)); doc.open(); itextsharp.text.image img = itextsharp.text.image.getinstance(scanners.twain.getimage(i), system.drawing.imaging.imageformat.jpeg); doc.setpagesize(new itextsharp.text.rectangle(0, 0, img.width, img.height)); doc.newpage(); doc.add(img); doc.close();

my problem thaht pdf resulted bit ( bit) cutted on top , on bottom. why ?

how can avoid ?

thanks lot,

seuxin

unless specify otherwise, document has margin of 36 on sides. can remove them by:

doc.setmargins(0, 0, 0, 0);

c# .net pdf itextsharp twain

javascript - How can i use scope's variable in directive? -



javascript - How can i use scope's variable in directive? -

i want scope's variable in directive javascript variable. here code:

app.controller("home", ["$scope", function($scope) { ... $scope.nb_msg = data.length; ... }]); app.directive("mydiv", function() { // here, want $scope.nb_msg var nb_msg = ???; var result = []; // nb_msg result var template = ""; ... for(var i=0; i<10; i++) { template += "<span>" + result[i] + "</span>"; } ... homecoming { restrict: "e", template: template }; });

how can do? in advance!

you can access scope in link function:

app.directive("mydiv", function() { homecoming { restrict: "e", template: '<span ng-repeat="i in result">{{i}}</span>', link: function(scope, element, attr) { // here, want $scope.nb_msg var nb_msg = scope.nb_msg; scope.result = []; for(var i=0; i<10; i++) { scope.result.push(i); } } }; });

javascript angularjs scope angularjs-directive

http - How can I change the redirect method in Spring Security from 302 to 303? -



http - How can I change the redirect method in Spring Security from 302 to 303? -

i utilize spring security 3.2.1 secure spring mvc application deployed tomcat.

when web session expires, spring security automatically redirects user login page. however, of ajax requests utilize put, post , delete methods. when 1 of requests gets redirected, firefox shows dialogue (other browsers behave differently):

this normal behaviour redirect 302 status code according http/1.1 specification says:

if 302 status code received in response request other or head, user agent must not automatically redirect request unless can confirmed user...

i rid of dialogue. think, dialogue not appear if spring security used response 303 status code (not 302). how can alter status code 303?

1) rfc 2616 obsolete. text in current spec reads (http://svn.tools.ietf.org/svn/wg/httpbis/specs/rfc7231.html#rfc.section.6.4):

the 3xx (redirection) class of status code indicates farther action needs taken user agent in order fulfill request. if location header field (section 7.1.2) provided, user agent may automatically redirect request uri referenced location field value, if specific status code not understood. automatic redirection needs done care methods not known safe, defined in section 4.2.1, since user might not wish redirect unsafe request.

2) firefox in process of removing these prompts. see https://bugzilla.mozilla.org/show_bug.cgi?id=677754

3) whether 303 more appropriate 302 depends on semantics of redirect are.

http firefox spring-mvc redirect spring-security

How to get a unique key from unicode string in php -



How to get a unique key from unicode string in php -

i have many unicode strings , want store them in mysql db. want add together field such represents character identity of string. example:

string key ------ ----------- 1st string 113547858 first string 113547865 go school 524872354

as may have noticed above, first 2 keys close each other, representing strings similarity, whereas 3rd 1 far them. dont want utilize php's similar_text or levenshtein need 2 strings check similarity, want store value each single string store in db in order set index on future use.

any help?!

simple addition of character codes of characters of string can solution?

update:

summation of hash value @ level of every word of string can solution

php string similarity levenshtein-distance

matlab - Backpropagation for rectified linear unit activation with cross entropy error -



matlab - Backpropagation for rectified linear unit activation with cross entropy error -

i'm trying implement gradient calculation neural networks using backpropagation. cannot work cross entropy error , rectified linear unit (relu) activation.

i managed implementation working squared error sigmoid, tanh , relu activation functions. cross entropy (ce) error sigmoid activation gradient computed correctly. however, when alter activation relu - fails. (i'm skipping tanh ce retuls values in (-1,1) range.)

is because of behavior of log function @ values close 0 (which returned relus approx. 50% of time normalized inputs)? tried mitiage problem with:

log(max(y,eps))

but helped bring error , gradients real numbers - still different numerical gradient.

i verify results using numerical gradient:

num_grad = (f(w+epsilon) - f(w-epsilon)) / (2*epsilon)

the next matlab code presents simplified , condensed backpropagation implementation used in experiments:

function [f, df] = backprop(w, x, y) % w - weights % x - input values % y - target values act_type='relu'; % possible values: sigmoid / tanh / relu error_type = 'ce'; % possible values: se / ce n=size(x,1); n_inp=size(x,2); n_hid=100; n_out=size(y,2); w1=reshape(w(1:n_hid*(n_inp+1)),n_hid,n_inp+1); w2=reshape(w(n_hid*(n_inp+1)+1:end),n_out, n_hid+1); % feedforward x=[x ones(n,1)]; z2=x*w1'; a2=act(z2,act_type); a2=[a2 ones(n,1)]; z3=a2*w2'; y=act(z3,act_type); if strcmp(error_type, 'ce') % cross entropy error - logistic cost function f=-sum(sum( y.*log(max(y,eps))+(1-y).*log(max(1-y,eps)) )); else % squared error f=0.5*sum(sum((y-y).^2)); end % backprop if strcmp(error_type, 'ce') % cross entropy error d3=y-y; else % squared error d3=(y-y).*dact(z3,act_type); end df2=d3'*a2; d2=d3*w2(:,1:end-1).*dact(z2,act_type); df1=d2'*x; df=[df1(:);df2(:)]; end function f=act(z,type) % activation function switch type case 'sigmoid' f=1./(1+exp(-z)); case 'tanh' f=tanh(z); case 'relu' f=max(0,z); end end function df=dact(z,type) % derivative of activation function switch type case 'sigmoid' df=act(z,type).*(1-act(z,type)); case 'tanh' df=1-act(z,type).^2; case 'relu' df=double(z>0); end end

edit

after round of experiments, found out using softmax lastly layer:

y=bsxfun(@rdivide, exp(z3), sum(exp(z3),2));

and softmax cost function:

f=-sum(sum(y.*log(y)));

make implementaion working activation functions including relu.

this leads me conclusion logistic cost function (binary clasifier) not work relu:

f=-sum(sum( y.*log(max(y,eps))+(1-y).*log(max(1-y,eps)) ));

however, still cannot figure out problem lies.

every squashing function sigmoid, tanh , softmax (in output layer) means different cost functions. makes sense rlu (in output layer) not match cross entropy cost function. seek simple square error cost function test rlu output layer.

the true powerfulness of rlu in hidden layers of deep net since not suffer gradient vanishing error.

matlab machine-learning neural-network backpropagation

python - Processing different data through same equation -



python - Processing different data through same equation -

i have array looks this:

a=[ id. r d ] [[ 47. 223.25190261 58.0551391 ] [ 49. 223.25102751 58.05662719] [ 57. 223.25013049 58.05139459]]

the first column isnt important. next 2 though, coordinates.

i have compare each set of coordinates (column 2 , 3 together) against these coordinates: (223.251, 58.05) using equation: b=sin(d)sin(d) + cos(d)cos(d)cos(r-r).

where (r,d) original coordinates (223.251, 58.05) , (r,d) coordinates in array. how do each set of coordinates in array without having input numbers myself or having define each number , replace them next set of coordinates? want programme maintain (r,d) consistent , alter (r,d) each row , create calculations. after it's done making calculation each row want have them output. have no thought how this, i'm thinking maybe loop. i'm lost. end of code this:

b=(((sin(dec0))*(sin(dec1)) + (cos(dec0)*cos(dec1))*(cos(ra0-ra1)))) print b 0.540302302454

but first row of coordinates, want done manually

i'm not sure if formula right , info representative, because values close each other. anyway, print b value each item in data, can use:

from math import radians, sin, cos orig = (223.251, 58.05) r = radians(orig[0]) d = radians(orig[1]) = [[ 47., 223.25190261, 58.0551391 ], [ 49., 223.25102751, 58.05662719], [ 57., 223.25013049, 58.05139459]] item in a: r = radians(item[1]) d = radians(item[2]) b = sin(d)*sin(d) + cos(d)*cos(d)*cos(r-r) print(b)

if you've got numpy array input, utilize numpy module instead of math of course.

python arrays loops numpy sin

sql server - Calculating 2 weeks for every week SQL -



sql server - Calculating 2 weeks for every week SQL -

i'm still new sql question asking may easy you. creating study every week generates prior 14 days (or 2 weeks) of funded contracts. know has hardcoded specific company. id specific company '55' can help me function? query know not yet finished stuck on how come in date function this.

create proc [dbo].[spadminfundeddateee] begin select c.program_id, d.dealer_code,b.last_name dealername, a.account_no, a.vin, ((e.last_name)+','+(e.first_name)) name, a.funded_date, a.cancel_refund_date, a.purchase_date,a.miles, a.duration,a.sale_price,a.number_of_payments, a.sales_tax, a.downpayment tdealer d bring together tcontact b on d.contact_id = b.contact_id bring together tcontract on d.dealer_id = a.dealer_id bring together tcompany c on d.company_id= c.company_id bring together tcontact e on e.contact_id = a.contact_id c.program_id = 55 , a.funded_date between end exec spadminfundeddateee '05/1/2014','05/30/2014','55'

in order check if a.funded_date between today's date , 2 weeks ago, going need several sql server functions. first 1 getdate(). returns current date , time datetime value.

now, want check date parameter (not time). if runs stored procedure @ 1pm, don't want eliminate of info before 1pm day 14 days ago. want data, no matter time, origin 14 days ago. solve issue, want alter getdate() date only. so, cast(getdate() date). today, homecoming 6-18-14.

lastly, want check date 2 weeks ago. dateadd allows add together amount of time specify date or time. in case, want info 14 days ago. going dateadd(dd, -14, cast(getdate() date)).

since between inclusive, need set together!

between dateadd(dd, -14, cast(getdate() date)) , cast(getdate() date)

sql sql-server hardcode

SQL Server 2008 Create Trigger after insert... return id... called stored procedure -



SQL Server 2008 Create Trigger after insert... return id... called stored procedure -

i want simple sql server trigger (after insert) id table inserted into... algorithm:

new record inserted table

trigger called

trigger takes id inserted record , called stored procedure

my failed effort below:

create trigger [dbo].[insertnewmarket] on [dbo].[markets] after insert begin declare @marketid int set nocount on; --select id inserted --set @marketid = inserted.id--get inserted id , pass stored proc exec marketinsert @marketid end go

create trigger [dbo].[insertnewmarket] on [dbo].[markets] after insert as begin declare @marketid int set nocount on; select @marketid = id inserted exec marketinsert @marketid end go

sql sql-server sql-server-2008 stored-procedures

Bison reduce/reduce, shift/reduce conflicts -



Bison reduce/reduce, shift/reduce conflicts -

hey guys i'm having problem bison code... after compiling chunk of code, 58 shift/reduce , 40 reduce/reduce conflicts... tips on how constrain them, or point me guide on how it? in advance!! (everything starts t_, t_get tokens defined above code)

start:t_get g |t_head g |t_post g ; g:url canon ; url: t_http t_dslash t_host t_abs_path ; canon:gh canon|rh canon|eh canon|mb ; gh:t_con t_akt t_seq gh|t_date t_akt d gh|t_trans t gh| ; d:t_day t_slash t_month t_slash t_year t_hour t_akt t_min ; t:t_chunked |t_gzip |t_deflate ; rh:t_acc t_akt t_seq rh|t_ref t_akt t_seq rh|t_user t_akt t_seq rh| ; eh:t_content t_akt t_seq eh|t_exp t_akt t_seq eh| ; mb:t_seq| ; %% int main(){ yyparse(); }

even if dont have time study logic in code, appreciate general help in these conflicts,like how generated etc

use bison's -v alternative verbose output giving states , conflicts in generated parser. if you'll see state like:

state 7 4 g: url . canon t_acc shift, , go state 12 : t_trans shift, , go state 19 t_user shift, , go state 20 $end cut down using rule 13 (gh) $end [reduce using rule 21 (rh)] $end [reduce using rule 24 (eh)] $end [reduce using rule 26 (mb)] t_acc [reduce using rule 13 (gh)] :

this telling when parser has seen url , looking recognize canon, can't tell -- should recognize empty gh, rh, eh, or mb, or should shift token recognize non-empty 1 of those?

these conflicts come basic ambiguity in grammar -- have canon rule consists of 0 or more repeats of gh, rh, and/or eh, , each of rules consist of 0 or more repeats of something. has no way of telling how many empty things insert parse tree (as consume no input, arbitrary number can added), , has no thought whether grouping similar things single gh (or rh or eh) or multiple distinct ones.

so prepare this, need decide want. probably, don't care grouping of gh/rh/eh structures, nor care empty ones, should rid of recursion rules:

gh:t_con t_akt t_seq|t_date t_akt d|t_trans t; rh:t_acc t_akt t_seq|t_ref t_akt t_seq|t_user t_akt t_seq; eh:t_content t_akt t_seq|t_exp t_akt t_seq;

now each of rules match 1 construct, , if have multiple, they'll grouped canon rule. fixes conflicts have, still leaves potential problem -- canon rule right recursive, suck entire input onto stack before reducing rules (since right-recursion, reduces right-to-left). want create rule left recursive instead -- general rule in bison always utilize left recursion , not right recursion, unless need right recursion reason. gives grammar:

start : t_get g | t_head g | t_post g ; g : url canon mb ; url : t_http t_dslash t_host t_abs_path ; canon : canon gh | canon rh | canon eh | ; gh : t_con t_akt t_seq | t_date t_akt d | t_trans t ; d : t_day t_slash t_month t_slash t_year t_hour t_akt t_min ; t : t_chunked | t_gzip | t_deflate ; rh : t_acc t_akt t_seq | t_ref t_akt t_seq | t_user t_akt t_seq ; eh : t_content t_akt t_seq | t_exp t_akt t_seq ; mb : t_seq | ;

bison

xdebug - PHP debugging code formatting -



xdebug - PHP debugging code formatting -

i want enchance php development powerfulness , introduce code formatting, rectangle selection mode , debugging php. have eclipse xdebug working code formatting not working expected.

using netbeans php problem debugging.

switched jetbrains php storm problem debugging.

my environment mac os x mamp , version of xdebug.so (works in eclipse).

this in php 5.5.10 version ini file

[xdebug] xdebug.remote_enable = on xdebug.remote_autostart = 1 xdebug.default_enable=1 xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=8888 zend_extension="/applications/mamp/bin/php/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so" xdebug.remote_mode=req xdebug.idekey="netbeans-xdebug" xdebug.max_nesting_level = 250

checked php --version.

i installed jetbrains browser plugin testing chrome. played ports.

hardware macbook pro stand lone debug , testing.

php xdebug

How to import external font/ typeface in ANDROID STUDIO? -



How to import external font/ typeface in ANDROID STUDIO? -

i wanna know how utilize external font in android studio there no assets folder. have helpful turtorial on net pretend utilize assets folder. created asset folder myself in src/main android studio doesnt recognie getassets(). help me maybe :)

thank you

go on project: app-->src-->main

create assets folder this:

|assets |-----------------fonts |-------------------font.ttf |java |res androidmanifest.xml

and use

typeface face=typeface.createfromasset(getassets(),"fonts/digital.ttf"); txtv.settypeface(face);

android fonts android-studio

mouseenter - jQuery event not firing on after DOM element is overwritten -



mouseenter - jQuery event not firing on after DOM element is overwritten -

first dynamically writing table div using innerhtml , i'm trying jquery function run when user hovers table cell. jquery function fires on table exists in html, 1 time overwrite innerhtml new table, jquery doesn't run function on hover anymore.

<div id="replacethis"> <table id="mytable"> <tr><td class="mycell">help</td></tr> </table> </div>

then utilize .on('mousenter') run function

$('#mytable tr td.mycell').on('mouseenter',function(){alert('omg help'); }

this works fine until replace innerhtml of div new table, much bigger, created loop through data. jquery not fire function on mouseenter though id's , classes same.

use delegated events. when replace body, generates new html elements, not have event handler attached anymore.

jquery provides delegated handler feature selector parameter on on function.

for instance:

$('body').on('mouseenter', '#mytable tr td.mycell', function(){alert('omg help'); }

read direct , delegated events paragraph in docs: http://api.jquery.com/on/

jquery mouseenter

Use ruby parallel gem and pass variables to main -



Use ruby parallel gem and pass variables to main -

i trying speed parallel gem. works have problem. want nil overwrite test. or array out have output.but result nil. how can create happen ? have advise folks.

require 'parallel' genes=[[1,nil],[2,nil],[3,nil],[4,nil],[5,nil],[6,nil],[7,nil],[8,nil]] out =[] parallel.each(genes, in_threds: 4) |g| g[1] = "test" out << g end p genes p out

--result--- [[1, nil], [2, nil], [3, nil], [4, nil], [5, nil], [6, nil], [7, nil], [8, nil]] []

i noticed have typo in "in_threads" portion of parallel command. 1 time tried in_threads instead of in_threds, got output believe expecting.

output expecting: [[1, "test"], [3, "test"], [2, "test"], [4, "test"], [5, "test"], [6, "test"], [8, "test"], [7, "test"]]

ruby parallel-processing gem

ssl - Unable to perform CRL check during certificate validation in OpenSSL -



ssl - Unable to perform CRL check during certificate validation in OpenSSL -

i trying perform certificate validation using openssl crl check.

i able using command prompt both below mentioned commands -

1. openssl verify -crl_check -cafile ca_crl.pem recipient_cert.pem 2. openssl verify -crl_check -crlfile crls.pem -cafile ca.pem mycert.pem

in first command ca_crl.pem contains both ca certificate , crl content. , in sec command ca , crl mentioned in different files.

now want perform same operation using c code. refered below link maintain getting homecoming value 0 x509_verify_cert no error codes give hint.

http://etutorials.org/programming/secure+programming/chapter+10.+public+key+infrastructure/10.5+performing+x.509+certificate+verification+with+openssl/

any pointers mistake?

update 1:

i trying different approach. curent code. getting homecoming value 1 x509_verify_cert should getting error code 12 crl has expired error.

this code -

void printerror() { __android_log_print(android_log_debug, "openssljni", "\nprinting errors"); long err = err_get_error(); while (err != 0 ) { char buf[130]; char* ptr = err_error_string(err, buf); __android_log_print(android_log_debug, "openssljni", "\nerror buffer: %s", buf); err = err_get_error(); } }

//verification code starts.

x509* x509 = initialised; stack_of(x509) *certs = initialised; char* cafile = initialised; x509_store *cert_ctx=x509_store_new(); if (cert_ctx == null) { homecoming 0; } x509_store_set_verify_cb(cert_ctx,cb); x509_lookup *lookup=x509_store_add_lookup(cert_ctx,x509_lookup_file()); if (cafile) { i=x509_lookup_load_file(lookup,cafile,x509_filetype_pem); if(!i) { __android_log_print(android_log_debug, "openssljni", "\nerror loading file %s\n", cafile); //bio_printf(bio_err, "error loading file %s\n", cafile); //err_print_errors(bio_err); //goto end; } } else { x509_lookup_load_file(lookup,null,x509_filetype_default); } x509_store_ctx *csc = x509_store_ctx_new(); if (csc != null) { x509_store_set_flags(cert_ctx, x509_v_flag_crl_check); if(x509_store_ctx_init(csc, cert_ctx, x509, certs)) { x509_store_ctx_set_flags(csc, x509_v_flag_crl_check); __android_log_print(android_log_debug, "openssljni", "\ncalling x509_verify_cert"); int = x509_verify_cert(csc); int ret = 0; if (i > 0) { ret=1; } __android_log_print(android_log_debug, "openssljni", "\nreturn value: %d", i); printerror(); return(ret); } }

ssl openssl certificate x509certificate x509

sql - Why does Hibernate JPA lose the column names when queried? -



sql - Why does Hibernate JPA lose the column names when queried? -

when query hibernate a:

"select business relationship a", jaxrs gives me column names in json, when execute query:

"select a.firstname, a.lastname business relationship a" json contains info without column names.

for instance:

{ firstname: "simon" }

becomes:

{ "simon" }

select business relationship

is jpql query returns list<account>. list serialized json array of objects.

on other hand,

select a.firstname, a.lastname business relationship

is jpql query returns list<object[]>. list serialized json array of arrays.

and finally,

select a.firstname business relationship

is jpql query returns list<string>. list serialized json array of strings.

sql hibernate jpa orm

unit testing - ldexp or hex floats in C++/CLI -



unit testing - ldexp or hex floats in C++/CLI -

i'm writing unit tests, using visual studio unit testing framework, expects me utilize managed c++.

in test, want test accuracy , error recovery of floating point helper function, i'd load floating constants specifying mantissa , exponent. in normal c++, i'd using ldexp, cannot include <math.h>, or <cmath> managed code.

is there way load (possibly denormalized) floating point constant?

fwiw, solved relaxing build flags /clr:safe /clr.

unit-testing floating-point c++-cli

node.js - Mongodb find(), limit(), sort() are not working -



node.js - Mongodb find(), limit(), sort() are not working -

in project need find recent document in collection. created 1 dose not homecoming , don't problem exactly. can help me? function:

dbmanagerconnection.prototype.finddevicelastdeviceactivity = function(id, callback){ database.deviceactivity.find({deviceid:id}).sort({devicelogin:-1}).limit(1), function(err, deviceid){ if(err || !deviceid){ console.log(err); callback(err, null); }else{ console.log("find: " + deviceid); callback(null, deviceid); } } }

update: yup yup solved problem show bellow:

dbmanagerconnection.prototype.finddevicelastdeviceactivity = function(id, callback){ database.deviceactivity.find({deviceid:id}).sort({devicelogin:-1}).limit(1).toarray(function(err, deviceid){ if(err || !deviceid){ console.log(err); callback(err, null); }else{ deviceid.foreach(function(item){ console.log("find: "); console.dir(item); }); callback(null, deviceid); } }); }

i welcome suggestions improve function.

node.js mongodb mongojs

angularjs directive - Nvd3 Pie Chart Label Issues -



angularjs directive - Nvd3 Pie Chart Label Issues -

i using nvd3 pie chart,i have 1 issue,my pie chart labels not aligning correctly within pie chart![,][1]

did add together nvd3 css file in project?

angularjs-directive nvd3.js

regex - Separate validation for day - month - year with Abide Foundation 4.3.2 -



regex - Separate validation for day - month - year with Abide Foundation 4.3.2 -

thank in advance help can provide.

i trying validate day / month / year separate fields (a limitation of scheme can building in) , having problem getting validation on these work.

i have tried adding custom patterns (throws console errors) , adding regex fields (no errors, invalid if date valid).

any help great.

code snippets:

i have tried adding custom patterns eg:

abide : { patterns: { day_only: /0[1-9]|1[0-9]|2[0-9]|3[01]/, month_only: /0[1-9]|1[012]/, year_only: /.]\/(19|20)\d\d/, }

}

and adding regex fields straight (escaping special characters) - no errors, wrong validation

<input type="tel" id="policyholder.dobdd" name="personalform.dobdd" placeholder="dd" size="2" maxlength="2" required pattern="/(0/[1/-9/]/|/[12/]/\d/|3/[01/]/)" />

/ /

regex validation zurb-foundation

php - How to remove part of the url ratther than the shop url from the currently fetched web page url -



php - How to remove part of the url ratther than the shop url from the currently fetched web page url -

in prestashop shop have fetched current web page url using below php code.

<?php $url="http://".$_server['http_host'].$_server['request_uri']; echo $url; ?>

my current echo url http://shoppingworld.com/int/mens-tshirts/fashion.html

my shop url http://shoppingworld.com/int/

i need remove url portion coming next above shop url.

you can't straight partial url.

try this,

$url = 'http://shoppingworld.com/int/mens-tshirts/fashion.html'; $parsed = parse_url($url); $path_array = explode('/', $parsed['path']); echo $parsed['scheme'] . '//' . $parsed['host'] .'/'. $path_array[1] . '/';

demo

php prestashop

javascript - How to store a file together with a REST object -



javascript - How to store a file together with a REST object -

i'm designing rest api handles post/put requests creating/updating collection objects (lets phone call 1 object shoe). shoes may have image attached. i'm looking best way handle shoe-pictures in api. api used 100% pure javascript webclients.

in past i've done multipart form-data: 1 part containing json object (shoe) , other part file or stream (shoe picture). worked php/mobile app clients not browsers/javascript clients cannot set content-type of body parts in multipart request. i'm stuck question how alter api meet needs of browser client.

i'm thinking of cutting file part away json object , have 2 post requests:

@post /api/shoe << shoe json-object ^^ creates new shoe in shoe collection, returns shoe object generated shoe id @post /api/shoe/{shoe-id}/picture << file/stream ^^ creates new shoepicture object generated id. @delete /api/shoe/{shoe-id}/picture/{shoe-picture-id} ^^ deletes shoe-picture described shoe-picture-id @put /api/shoe/{shoe-id}/picture/{shoe-picture-id} << file/stream + json-object ??? ^^ alter shoe-picture described shoe-picture-id

basically shoepicture object json again, can't sent browser... means set can't done. how solve this?

javascript json api rest multipartform-data

c - Alternative to the poll function to check new data in a FIFO -



c - Alternative to the poll function to check new data in a FIFO -

i'm writing method check if there new info in fifo opened in rdonly mode. until using poll() function realized kernel on code run doesn't have function , implements subset of linux functionality , subset of posix functionality.

there alternatives poll function?

(in particular, machine bluegene/q , functionalities offered can found in application development redbook under chapter kernel access.)

review: reading improve redbook realized poll phone call included in kernel. leave anyway question because reply can useful else.

check if select(2) available, should fit needs.

it performs similar task poll(2).

c linux posix named-pipes fifo

angularjs - Accessing nested data with Angularfire -



angularjs - Accessing nested data with Angularfire -

i trying capture changes nested array in firebase data. info laid out so:

calls (unique firebase id) station: "foobar" time: "20:30" responders (unique firebase id) name: "frank" avatar: "foo.jpg" (unique firebase id) name: "martha" avatar: "bar.jpg"

i need maintain track of when calls changed , when responders added or removed. struggling tracking responders phone call - not have random ids ahead of time, need track in real time calls , responders each phone call change.

here have far. code related paths , getting jwt missing-

var ref = new firebase('https://foobar.firebaseio.com/clients/' + clientauth); var callref = ref.child('calls'); $scope.activecalls = 0; $scope.calls = $firebase(callref); $scope.calls.$on("change", function() { var keys = $scope.calls.$getindex(); $scope.activecalls = keys.length; keys.foreach(function(key, i) { console.log($scope.calls[key].responders); // provides object array of responders }); });

update

i remembered child_added regular firebase.. came this. more eloquent way appreciated, trying maintain more angular based.

$scope.calls.$on("child_added", function(v) { console.log(v.snapshot.value); // gives me details need });

angularjs firebase angularfire

Customizing twitter Bootstrap -



Customizing twitter Bootstrap -

i never used twitter bootstrap 3 have utilize modal in html page.when button clicked modal should used.i want utilize to the lowest degree code modal.no css , typography twitter bootstrap.can please help how jquery plugin related modal ??

as instructed in http://getbootstrap.com/javascript/#modals

just improve understanding, can see fiddle here. utilize jquery , bootstrap-modal.js without other css , typography.

first, create modal divs structure, , hide when page load whether using own css or jquery

<!-- modal --> <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title" id="mymodallabel">modal title</h4> </div> <div class="modal-body"> ... </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <button type="button" class="btn btn-primary">save changes</button> </div> </div> </div> </div>

hide piece of jquery

$('.modal').hide();

and allow button toggle visibility of modal

twitter-bootstrap twitter-bootstrap-3

python 2.7 - Why does get_linesize() incorrectly return 1 for .fon fonts? -



python 2.7 - Why does get_linesize() incorrectly return 1 for .fon fonts? -

i've had unusual thing happen in pygame1.9.1's font module, .get_linesize() returns 1 fonts glyph height (let lone per-line height) renders greater 1. happens .fon fonts.

here 2 examples, plus 3rd font does work, sake of control. i've run these idle's shell, same thing happens proper modules. in case, pygame has been initialized.

>>> testfont = pygame.font.font("c:/windows/fonts/vga850.fon", 12) >>> testfont.get_linesize() # 1 returns 1. 'terminal regular' 1 >>> otherfont = pygame.font.font("c:/windows/fonts/vgafix.fon", 18) >>> otherfont.get_linesize() # returns 1. 'fixedsys regular' 1 >>> lastfont = pygame.font.font("c:/windows/fonts/ocrastd.otf", 24) >>> lastfont.get_linesize() # returns right value. 'ocr std regular' 29 >>> textsurf = testfont.render("this nightmare!", true, (0,0,0)) >>> textsurf.get_size()[1] # let's height of surface... 12 >>> othersurf = otherfont.render("an inescapable nightmare!", false, (0,0,0)) >>> othersurf.get_size()[1] # one, too. antialiasing makes no difference. 15 >>> lastsurf = lastfont.render("you're okay, ocra.", true, (0,0,0)) >>> lastsurf.get_size()[1] # , finally, control... 25

the height of render command little shorter, since get_linesize() includes gap between lines aesthetic reasons. <font>.size("sample string")[1] works correctly, that's been stopgap line height.

all 3 fonts render correctly.

the mutual thread fonts not respond <font>.get_linesize() share extension .fon, easy 'solution' simply, "do not utilize .get_linesize() .fon fonts; utilize .size('sample')[1] + some_adjustment instead." this, however, inelegant , (worse still!) terribly boring, , i'm much more interested know what causes problem, , if there a way create these fonts work get_linesize() should.

i looked through pygame's documentation , couldn't find issue, , number of web searches proved fruitless well.

pygame's font back upwards depends on sdl_ttf in turn depends on freetype2. suspect there's problem in calculating value line height font goes through layers (specifically sdl_ttf layer, freetype2 reads font data).

consider using pygame.freetype.font instead of pygame.font. freetype module skips sdl_ttf layer , works freetype directly. there a much richer set of options fonts there. i'd seek get_sized_height() replacement get_linesize().

if still doesn't work, freetype bug in reading fon files, or perchance fon files don't have value set correctly.

python-2.7 fonts pygame

c# - WPF Clickevent for Grid (zIndex=0) which is behind another Grid (zIndex =1) -



c# - WPF Clickevent for Grid (zIndex=0) which is behind another Grid (zIndex =1) -

i seek create grids. on every grid have mouse-eventlistener, fire event when go mouse on grid. create big grid zindex = 1 , rowspan = 3. grid located in front end (because of zindex = 1). have problems fire events of grids lay behind big grid zindex = 1. how can fire events of grid located behind big grid?

simple code example:

<grid> <grid.rowdefinitions> <rowdefinition height="1*"/> <rowdefinition height="1*"/> <rowdefinition height="1*"/> <rowdefinition height="1*"/> <rowdefinition height="1*"/> <rowdefinition height="1*"/> </grid.rowdefinitions> <grid grid.row="0" background="aliceblue"/> <grid grid.row="1" grid.rowspan="3" panel.zindex="1" background="aqua" opacity="0.2" previewmousemove="grid_previewmousemove_1"/> <grid grid.row="2" previewmousemove="grid_previewmousemove" background="antiquewhite"/> <grid grid.row="3" previewmousemove="grid_previewmousemove" background="beige"/> <grid grid.row="4" previewmousemove="grid_previewmousemove" background="bisque"/> <grid grid.row="5" previewmousemove="grid_previewmousemove" background="blanchedalmond"/> </grid>

set ishittestvisible false grid zindex 1.

for more info : ishittestvisible

c# wpf grid mouseevent z-index

core text - Issue with CoreText CTFrameGetLineOrigins in Swift -



core text - Issue with CoreText CTFrameGetLineOrigins in Swift -

i have next code working in objective-c

nsarray *lines = (nsarray *)ctframegetlines((__bridge ctframeref)columnframe); cgpoint origins[[lines count]]; ctframegetlineorigins((__bridge ctframeref)columnframe, cfrangemake(0, 0), origins);

but when ported swift, compiler complains cannot convert expression´s ´void´to type ´cmutablepointer<cgpoint> in ctframegetlineorigins line

let nslinesarray: nsarray = ctframegetlines(ctframe) // utilize nsarray bridge array allow ctlinesarray = nslinesarray array var originsarray: array<cgpoint> = cgpoint[]() //var originsarray: nsmutablearray = nsmutablearray.array() allow range: cfrange = cfrangemake(0, 0) ctframegetlineorigins(ctframe, range, originsarray)

i had utilize nsarray in cgframegetlines function, , convert swift array, , inspecting ctlinesarray, shows ctline objects retrieved correctly

i tried using nsmutablearray originsarray, same result.

any thought of missing?

you have add together address-of operator & pass pointer start of originsarray function:

ctframegetlineorigins(ctframe, range, &originsarray)

reference: interacting c apis in "using swift cocoa , objective-c" book:

c mutable pointers

when function declared taking cmutablepointer<type> argument, can take of following:

... an in-out type[] value, passed pointer start of array, , lifetime-extended duration of call.

and expressions in "the swift programming language" book:

in add-on standard library operators listed above, utilize & before name of variable that’s beingness passed in-out argument function phone call expression.

an add-on (as @eharo2 figured out), originsarray must have room necessary number of elements, can achieved with

var originsarray = cgpoint[](count:ctlinesarray.count, repeatedvalue: cgpointzero)

swift core-text

mongodb - Problems with mongo csharp driver version -



mongodb - Problems with mongo csharp driver version -

i utilize mongo csharp driver version 1.9.1. but, have problems dll. exception is:

"could not load file or assembly 'mongodb.bson, version=1.9.1.221, culture=neutral, publickeytoken=f686731cfb9cc103' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040)":"mongodb.bson, version=1.9.1.221, culture=neutral, publickeytoken=f686731cfb9cc103".

does have suggestion ?

thanks lot in advance

i having same problem, error occurs due conflict may have added more 1 reference monogodb in solution. solution: if there more 1 project in solution remove mongodb references project , add together 1 project dependent on other projects. worked me.

mongodb mongodb-csharp

multithreading - multi threading DB access via ADO -



multithreading - multi threading DB access via ADO -

i made basic class design work in multi threads ado / mssql database finish class design here

the basic thread code goes :

constructor paintbitmapthread.create(bmp_width, bmp_height: integer; server, databasename, tablename, sqlstr: string; threadid: integer); begin fbitmap :=tbitmap.create; fbitmap.width := bmp_width; fbitmap.height := bmp_height; fbitmap.pixelformat := pf24bit; fconnection :=tadoconnection.create(nil); fserver := server; fdatabasename := databasename; ftablename := tablename; fconnection.loginprompt := false; connecttodatabase(fserver, fdatabasename, fconnection) end; destructor paintbitmapthread.destroy; begin fbitmap.free; fconnection.free; inherited; end; procedure paintbitmapthread.execute; var threadquery : tadoquery; k : integer; begin inherited; coinitialize(nil) ; //coinitialize not called threadquery := tadoquery.create(nil) ; seek // ado db thread must utilize own connection threadquery.connection := fconnection; threadquery.cursorlocation := cluseserver; threadquery.locktype := ltreadonly; threadquery.cursortype := ctopenforwardonly; threadquery.sql.text := fsqlstr; threadquery.open; while not threadquery.eof , not terminated begin //canvas not allow drawing if not called through synchronize //synchronize(refreshcount) ; threadquery.next; end; threadquery.free; end; couninitialize() end; procedure tform1.formcreate(sender: tobject); begin fserver := 'localhost\sqlexpress'; fdatabase := 'test_wbbugfix'; ftable := 'obj'; serveredit.text := fserver; databaseedit.text := fdatabase; tableedit.text := ftable end;

before leaving thread.create constructor av screen dump below ,

what wrong code ???

the error message states problem here. creating thread createsuspended parameter set false. means thread start after calling constructor. phone call start lead exception.

solution

create thread createsuspended flag set true. can start thread calling start method.

besides problem, point out tadoconnection , tadoquery not live on same thread. because paintbitmapthread constructor executed in context of thread creates paintbitmapthread thread object. can solve problem moving connection construction code within execute method.

multithreading delphi

asp.net mvc - Specifying action filter at the controller level Versus at the action method level, which will run first -



asp.net mvc - Specifying action filter at the controller level Versus at the action method level, which will run first -

when create asp.net mvc 5 web project, check business relationship controller , find next code:-

[authorize] public class accountcontroller : controller { public accountcontroller() : this(new usermanager<applicationuser>(new userstore<applicationuser>(new applicationdbcontext()))) { } // get: /account/login [allowanonymous] public actionresult login(string returnurl) { viewbag.returnurl = returnurl; homecoming view(); }

where specify [authorize] @ controller level, , [allowanonymous] @ action method level. thought asp.net mvc check first action filters @ controller level , if successed processed action method call. seems not situation, because anonymous users can phone call login action method, although [authorize] specified @ controller level ? scenario here?

thanks

you can start having @ authorize attribute source code understand how works: http://aspnetwebstack.codeplex.com/sourcecontrol/latest#src/system.web.mvc/authorizeattribute.cs

have closer @ onauthorization method: see looks allowanonymous attribute on action or controller , skip authorization if find any.

bool skipauthorization = filtercontext.actiondescriptor.isdefined(typeof(allowanonymousattribute), inherit: true) || filtercontext.actiondescriptor.controllerdescriptor.isdefined(typeof(allowanonymousattribute), inherit: true); if (skipauthorization) { return; }

asp.net-mvc asp.net-mvc-4 asp.net-mvc-5 action-filter

sql - "No Value Given for one or more required parameter" after making changes to access database -



sql - "No Value Given for one or more required parameter" after making changes to access database -

i working on vb.net project , connecting access database system.oledb connection. code running fine , showing records in datagridview, had create changes in original database, did. after when run programme gives me error, in fact know there nil wrong code, why error of "no value given 1 or more required parameter" sample code below:

public class frmemployees private shared mycon new oledb.oledbconnection private shared con new oledb.oledbconnection private shared empcmd new oledb.oledbcommand private shared employeecmd new oledb.oledbcommand private shared employeeadapter new oledb.oledbdataadapter private shared employeebuilder oledb.oledbcommandbuilder private shared empdata new dataset private shared emptable new datatable dim id1 string private sub frmemployees_load(sender object, e eventargs) handles mybase.load seek emptable.clear() mycon.connectionstring = "provider=microsoft.jet.oledb.4.0;data source=y:\m&g_training.mdb" employeecmd.connection = mycon employeecmd.commandtype = commandtype.text employeecmd.commandtext = "select employeeid, lastname, firstname, middleinitial, active, hiredate employee active = 'y' order employeeid" employeeadapter.selectcommand = employeecmd employeebuilder = new oledb.oledbcommandbuilder(employeeadapter) employeeadapter.fill(emptable) empbindingsource.datasource = emptable empbindingnavigator.bindingsource = empbindingsource empdatagridview.datasource = empbindingsource grab ex exception messagebox.show(ex.message) end seek end sub

i have changed programme according changes have made in database, please help me, close getting project done. give thanks in advance

sql vb.net ms-access-2010 oledb

windows 8.1 multi-monitor dpi -



windows 8.1 multi-monitor dpi -

i have seen other discussions on still can not figure out. have unchecked button saying "same dpi screens" , tried adjusting "smaller/bigger" horizontal scroll selector changes seem impact main monitor. help seems indicate dpi should automatically adjusted. can see in picture, 4k 28" monitor on left different 2500x1600 30" monitor on right.

what missing?

windows windows-8.1 dpi dual-monitor

date - How to get mm-dd-yyyy in DOS batch file? -



date - How to get mm-dd-yyyy in DOS batch file? -

in batch file need file folder has today's date.

the problem can't batch date command homecoming proper format.

i have this: echo %date:/=-%

but returns example: fri 06-20-2014

what's proper phone call returning: 06-20-2014

looked on can't find.

thanks!

this works independent of regional date/time format:

for /f %%i in ('wmic os localdatetime ^|find "20"') set dt=%%i rem dt format yyyymmddhhmmss... set dt=%dt:~4,2%-%dt:~2,2%-%dt:~0,4% echo %dt%

date batch-file format

php - Incorrect integer value '' for a MySQL column that's integer and allow null? -



php - Incorrect integer value '' for a MySQL column that's integer and allow null? -

i'm working on inserting csv table. don't have command on what's in csv , lot of fields blank. in first record instance, field "baths_full" empty (two commas back).

on production server running mysql 5.5.37, inserts record baths_full empty field. on local machine running mysql 5.6.19, gives me error:

[illuminate\database\queryexception] sqlstate[hy000]: general error: 1366 wrong integer value: '' column 'baths_full' @ row 1 (sql: insert `listings_queue` (`

the weird thing schema tables identical. in fact, used export of production machine create local database.

the field baths_full set tinyint, unsigned, allow null, default null. 1 thing add together looks in sql insert statement laravel creating, treating null values spaces. regardless, production machine runs script without problem locally won't run.

i found problem. local mysql running in strict mode. reply thread (general error: 1366 wrong integer value doctrine 2.1 , zend form update) fixed it.

php mysql sql laravel laravel-4

compass sass - Horizontal list menu: Calculated equal % width -



compass sass - Horizontal list menu: Calculated equal % width -

i new sass/compass , experimenting mixins. illustration below shows code simple ribbon style horizontal menu inheriting @include horizontal-list mixin, bundled compass.

this static menu has 4 list items , hence have set li width 25%

my question. compass have method calculating equal percentage width value list items in dynamic menu undefined number of items?

something like, total li/100 = x% li width

@mixin ribbon-menu { ul { padding: 0; } li { width: 25%; border-right: 1px solid $white; text-align: center; } li.last { border-left: 0; } li.leaf { padding: 0; } { display: block; text-decoration: none; padding: 10px; color: $white; } a:link, a:visited { background: $black; } a:active, a:hover, a:focus { background: $red; } }

hopefully help you.

http://lea.verou.me/2011/01/styling-children-based-on-their-number-with-css3/

@for $i 1 through 4 { li:first-child:nth-last-child(#{$i}), li:first-child:nth-last-child(#{$i}) ~ li { width: 100% / $i } }

compass-sass

Is there a formal name for $ sign in PHP -



Is there a formal name for $ sign in PHP -

is there formal name $ sign in php? phone call dollar sign have interview upcoming , don't want sound immature language.

variables in php represented dollar sign followed name of variable.

if utilize it, utilize it, too.

src: http://www.php.net/manual/en/language.variables.basics.php

php

ruby on rails - Can I query the current scope(s)? -



ruby on rails - Can I query the current scope(s)? -

my collections model has scope this

scope :got, -> { where(status: 'got') }

i have link index follows

<%= user_collections_path(@user, got: true) %>

thanks has_scope gem creates index of user's collections status: 'got'. path

users/user1/collections?got=true

in index view want able write

<% if status: 'got' %> have these ones <% end %>

but no matter how write can't seem query scope passed in link. there standard way of doing this?

you can following:

<% if params[:got].to_s == 'true' %> have these ones <% end %>

but forces utilize true value params[:got]. maybe better:

<% if params[:got].present? %> have these ones <% end %>

but work params like:

users/user1/collections?got=true, users/user1/collections?got=false, users/user1/collections?got=nope, etc.

actually, has_scope gem provides method current_scopes returns hash (key = scope, value = value given scope) in corresponding views. should able this:

<% if current_scopes[:got].present? %> have these ones <% end %>

ruby-on-rails ruby-on-rails-4 named-scope

javascript - Jquery inview element should work on load and on scroll -



javascript - Jquery inview element should work on load and on scroll -

i'm trying create inview function working adding class element , remove when not inview. not sure i'm missing... help please?

http://jsfiddle.net/zefjh/

$.fn.isonscreen = function () { var win = $(window); var viewport = { top: win.scrolltop(), left: win.scrollleft() }; viewport.right = viewport.left + win.width(); viewport.bottom = viewport.top + win.height(); var bounds = this.offset(); bounds.right = bounds.left + this.outerwidth(); bounds.bottom = bounds.top + this.outerheight(); homecoming (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom)); }; $('.box').click(function () { alert($('.box').isonscreen()); }); if ($('.box').isonscreen() == true) { $('.box').addclass('inview'); } $(window).scroll(function () { if ($('.box').isonscreen() == true) { $('.box').addclass('inview'); } else { $('.box').removeclass('inview'); } });

you utilize $.each check every .box, whether it's on screen or not, on scroll.

$.each($(".box"), function(){ if ($(this).isonscreen()) { $(this).addclass('inview'); } else{ $(this).removeclass('inview'); } });

also: click function should check if clicked element on screen using this

$('.box').click(function(){ alert($(this).isonscreen()); });

and finally: can leave == true part in if statements.

full example: http://jsfiddle.net/zefjh/2/

javascript jquery scroll

mysql - How can I calculate average scores from these entries in django? -



mysql - How can I calculate average scores from these entries in django? -

so have model:

class scoreshow(models.model): dancer = models.foreignkey(dancer) s1 = models.integerfield(max_length = 2) s2 = models.integerfield(max_length = 2) s3 = models.integerfield(max_length = 2) s4 = models.integerfield(max_length = 2) s5 = models.integerfield(max_length = 2) s6 = models.integerfield(max_length = 2) s7 = models.integerfield(max_length = 2) counter = models.integerfield(max_length = 2) stotal = models.integerfield(max_length = 3) field_1 = models.integerfield(max_length = 20, null=true, blank=true) field_2 = models.charfield(max_length = 20, null=true, blank=true) def __unicode__(self): homecoming str(self.dancer)

which fed info view form:

def scores(request): perf = dancer.objects.filter(perform=true) if request.method =='post': intpk = request.post.get("form") whendone = request.post.get("done") contestant =dancer.objects.get(pk=intpk) showcase = inlineformset_factory(dancer, scoreshow, = 1) form = showcase(instance=none) if whendone == "save": form = showcase(request.post, request.files, instance=contestant) if form.is_valid(): form.save() homecoming render_to_response("scores.html",locals(), context_instance = requestcontext(request))

it accepts numeric values 1 10 13 people. need calculate average of scores 13 people set in. 2 averages:

the average of 7 categories ex. average of s1, average of s2 &

the average of of s's added average of s1 total+ s2 total ... divided total entries. t

i avoid having submit score twice if thats possible. can help me this?

you can utilize aggregation feature calling:

from django.db.models import avg qs = scoreshow.objects.all() homecoming qs.aggregate(avg('s1'), avg('s2'), avg('s3'), avg('s4'), avg('s5'), avg('s6'),avg('s7'))

or little shorter:

qs = scoreshow.objects.all() homecoming qs.aggregate(*[avg('s%d' % i) in range(1, 8)])

to calculate average value of scores need combine aggregate annotate:

from django.db.models import avg, sum fields = ['s%d' % in range(1,8)] qs = scoreshow.objects.annotate(sall=sum('id', field='+'.join(fields))).all() homecoming qs.aggregate(avg('sall'))

to create sure nobody submits 2 scores add together unique=true dancer foreign key:

class scoreshow(models.model): dancer = models.foreignkey(dancer, unique=true)

mysql django django-forms

android - How to pass large json string to next activity -



android - How to pass large json string to next activity -

i sending big json string records of json array length 800 when start activity application quits without crash message when reduced records 100 works perfectly.

i doing below

intent myintent = new intent(getactivity(), activityname.class); myintent.putextra("jsondata", respuserdata); getparentfragment().startactivityforresult(myintent, pick_plan); getactivity().overridependingtransition( r.anim.lefttorightanim, r.anim.righttoleftanim);

so right way send big json next activity ?

thanks in advance.

you can pass values mentioned. bundle can hold big amount of info also. can pass arraylist, model classes etc using intent.

android json

php - Foreach statement inside a called function gives an error -



php - Foreach statement inside a called function gives an error -

i insert foreach() statement, suppose display year value dynamically,into called function keeps giving errors... extract of doing

$display->content( 'the heading <select name="year" id="year">'. foreach(range(date("y",2013) $value){ echo "<option value=\"$value\">$value</option>\n"; } .'</select> script ends' );

this error receive time execute parse error: syntax error, unexpected 'foreach' (t_foreach) in /var/www/test.php on line 140 . please help deal appreciated. give thanks you.

your code syntactically invalid. next should work.

$options = ""; foreach(range(date("y",2013)) $value) { $options .= '<option value="'.$value.'">$value</option>'; } $display->content( 'the heading <select name="year" id="year">'. $options .'</select> script ends' );

php function

c pointers and javascript -



c pointers and javascript -

i have been working on conversion of c code javascript. don't homecoming same data.

i have thought on how handle pointers. in javascript i'll create array.

note: not total code, partials

origin:

// file.h unsigned char m_aucstate0[256]; unsigned char m_aucstate[256]; unsigned char m_uci; unsigned char m_ucj; unsigned char* m_pucstate1; unsigned char* m_pucstate2; // file.c unsigned char *puckeydata for(i=0; i<256; i++) { m_pucstate1 = m_aucstate0 + i; m_ucj += *m_pucstate1 + *(puckeydata+m_uci); m_pucstate2 = m_aucstate0 + m_ucj; //swaping m_uctemp = *m_pucstate1; *m_pucstate1 = *m_pucstate2; *m_pucstate2 = m_uctemp; m_uci = (m_uci + 1) % ikeylen; } memcpy(m_aucstate, m_aucstate0, 256);

javascript:

// buffer or array??? this.m_aucstate0 = new buffer(256) this.m_aucstate = new buffer(256) this.m_uci this.m_ucj this.m_pucstate1 = [] this.m_pucstate2 = [] (var = 0; < 256; i++) { this.m_pucstate1 = this.m_aucstate0 + this.m_ucj += this.m_pucstate1[0] + (puckeydata[0] + this.m_uci) this.m_pucstate2 = this.m_aucstate0 + this.m_ucj //swaping this.m_uctemp = this.m_pucstate1[0] this.m_pucstate1[0] = this.m_pucstate2[0] this.m_pucstate2[0] = this.m_uctemp this.m_uci = (this.m_uci + 1) % ikeylen } this.m_aucstate.copy(this.m_aucstate0, 0, 0, 256)

so thought because pointer returns address, address contains first byte of pointer data. if in array point first index of array right?

is did above right?

just context allow me add together 1 function:

javascript:

crypt.prototype.setup = function(puckeydata, ikeylen) { if (ikeylen < 1) throw new error("key length should @ to the lowest degree 1") var i; (i = 0; < 256; i++) this.m_aucstate0[i] = this.m_uci = 0 this.m_ucj = 0 (var = 0; < 256; i++) { this.m_pucstate1 = this.m_aucstate0 + this.m_ucj += this.m_pucstate1[i] + (puckeydata[i] + this.m_uci) this.m_pucstate2 = this.m_aucstate0 + this.m_ucj //swaping this.m_uctemp = this.m_pucstate1[i] this.m_pucstate1[i] = this.m_pucstate2[i] this.m_pucstate2[i] = this.m_uctemp this.m_uci = (this.m_uci + 1) % ikeylen } this.m_aucstate.copy(this.m_aucstate0, 0, 0, 256) //initialize indexes this.m_uci = 0 this.m_ucj = 0 //initialization finished this.m_binit = true }

cpp:

void carcfourprng::setkey(unsigned char *puckeydata, int ikeylen) { if(ikeylen < 1) throw exception("key length should @ to the lowest degree 1"); int i; for(i=0; i<256; i++) m_aucstate0[i] = i; m_uci = 0; m_ucj = 0; for(i=0; i<256; i++) { m_pucstate1 = m_aucstate0 + i; m_ucj += *m_pucstate1 + *(puckeydata+m_uci); m_pucstate2 = m_aucstate0 + m_ucj; //swaping m_uctemp = *m_pucstate1; *m_pucstate1 = *m_pucstate2; *m_pucstate2 = m_uctemp; m_uci = (m_uci + 1) % ikeylen; } memcpy(m_aucstate, m_aucstate0, 256); //initialize indexes m_uci = 0; m_ucj = 0; //initialization finished m_binit = true; }

what difference of m_pucstate1 , *m_pucstate1 in this:

m_pucstate1 = m_aucstate + m_uci; m_ucj += *m_pucstate1;

in javascript, there typed buffer objects: http://www.javascripture.com/arraybuffer

you find ctypes collection, in understanding used native os library calls.

also, don't know native js buffer object mention it. there 1 in nodejs, don't know features.

if insist of translating code one-by-one, these typed buffer objects may back upwards you. think it's not way while translating c javascript, terminology alters anyway. alters adding long pointer values forming array indices.

here 1 problem illustration in translation:

in c, write:

m_ucj += *m_pucstate1 + *(puckeydata+m_uci);

in javascript, write:

this.m_ucj += this.m_pucstate1[0] + (puckeydata[0] + this.m_uci);

the brackets in c term create m_uci altering address. in javascript should rather in square brackets, somehow this:

this.m_ucj += this.m_pucstate1[0] + puckeydata[0 + this.m_uci];

and can skip "0 +". shows how one-by-one translation between such different languages total of traps.

so let's assume utilize simplest javascript object, array []. suggestion. it's draft, should give thorough idea:

// define arrays var astate0 = []; // m_aucstate0 var astate = []; // m_aucstate // define helpers var state1index; // *m_pucstate1 var state2index; // *m_pucstate2 var i; // m_uci. there no such thing "uc" in javascript. var j; // m_ucj var iloop; // in loop. // it's readable have constant. var bufferlength = 255; // somewhere need: var keydata; var temp; var ikeylen; // here, give array size. it's done in javascript. // alternatively, fill 256 values anywhere. astate0[bufferlength] = 0; // console.log(state0.length) print 256 // ... // init i, j, ikeylen ... // ... (iloop = 0; iloop <= bufferlength; iloop++) { // this: // m_pucstate1 = m_aucstate0 + i; // m_ucj += *m_pucstate1 + *(puckeydata+m_uci); // becomes: state1index = iloop; j += astate0[state1index] + keydata[i]; // this: // m_pucstate2 = m_aucstate0 + m_ucj; // becomes: state2index = j; // this: // m_uctemp = *m_pucstate1; // *m_pucstate1 = *m_pucstate2; // *m_pucstate2 = m_uctemp; // becomes: temp = astate0[state1index]; astate0[state1index] = astate0[state2index]; astate0[state2index] = temp; // this: // m_uci = (m_uci + 1) % ikeylen; // becomes: = (i+1) % ikeylen; } // this: // memcpy(m_aucstate, m_aucstate0, 256); // clone. you'd need jquery or else. can write: (index in state0) { state[index] = state0[index]; }

finally, can drop j equal state2index, , state1index equal iloop.

but puzzle have utilize paper , pencil , draw boxes , arrows clear with.

hth :-)

javascript c arrays pointers

Rewrite javascript function into node.js module -



Rewrite javascript function into node.js module -

i have function: (which guess abstract mill creating javascript objects)

var $class = function(definition) { var constructor = definition.constructor; var parent = definition.extends; if (parent) { var f = function() { }; constructor._superclass = f.prototype = parent.prototype; constructor.prototype = new f(); } (var key in definition) { constructor.prototype[key] = definition[key]; } constructor.prototype.constructor = constructor; homecoming constructor; };

a utilize defining classes c/java syntax polymorphism , extending:

var bullet = $class({ extends: gameobject, constructor: function(texturepath, x, y, ctx, direction, passable, player) { gameobject.call(this, texturepath, x, y, ctx, 1, 1, passable, new array(8, 8, 0, 0)); }, isactive: function() { }, getplayer: function() { }, update: function(dt) { }, destroy: function() { }, processcollision: function() { } });

and calling:

var bullet = new bullet(params);

i tried rewrite nodejs module this:

(function(){ var $class = function(definition) { var constructor = definition.constructor; var parent = definition.extends; if (parent) { var f = function() { }; constructor._superclass = f.prototype = parent.prototype; constructor.prototype = new f(); } (var key in definition) { constructor.prototype[key] = definition[key]; } constructor.prototype.constructor = constructor; homecoming constructor; }; module.exports.createclass = function() { homecoming $class(); } });

and phone call with:

var c = require(__dirname + "\\class"); var bullet = c.createclass({ extends: gameobject, constructor: function() {} });

but doesn't work, can please help me rewriting?

update: rewrited @salem answer, lost extending , polymorphism in process. in order have extending have write instead of

extends: parentclass

this:

extends: parentclass.constructor

i've expected polymorphism like:

// in class extended parentclass parentclass.method(); // in parent class adding line module.exports.method = parentclass.method;

but undefined. catch?

finally used mochiscript module nodejs, improve syntax sugar more object oriented functionality.

in code, createclass function without parameter. phone call $class without paramter also.

you don't need wrap code in function, because declare there won't accessible outside unless export it. should this:

var func = function(definition) { var constructor = definition.constructor; var parent = definition.extends; if (parent) { var f = function() { }; constructor._superclass = f.prototype = parent.prototype; constructor.prototype = new f(); } (var key in definition) { constructor.prototype[key] = definition[key]; } constructor.prototype.constructor = constructor; homecoming constructor; }; module.exports.createclass = func;

this means if require module x, thing can access x.createclass, , not x.func or else.

javascript node.js rewriting

Enthought Canopy for Linux High DPI support? -



Enthought Canopy for Linux High DPI support? -

i'm using latest version of enthought canopy on linux mint 17, running on 11.1 macbook pro retina. title suggests, menus , buttons painfully minuscule in editor , canopy launch window. there way increment size of these it's more usable? or there prepare in works it?

thanks.

enthought canopy

c# - How can I overwrite html file? -



c# - How can I overwrite html file? -

this question has reply here:

write string text file , ensure overwrites existing content. 5 answers if (!system.io.file.exists(server.mappath(klasoradi + htmlname + ".html"))) { system.io.file.writealltext(server.mappath(klasoradi + htmlname + ".html"), htmltext); }

i'm using code creating , saving html file. can't overwrite file.

can please help me prepare situation ?

according msdn writealltext(string,string) overwrite file. so, need remove initial if statement , either create file or overwrite it.

c# asp.net file overwrite

c# - Output parameters may only be mapped through the RowsAffectedParameter property -



c# - Output parameters may only be mapped through the RowsAffectedParameter property -

i have stored procedure in want homecoming output value , access on application in accessing through entity framework.

my stored procedure:

alter procedure [dbo].[insert_studentdetails] ( @name varchar(150), @city varchar(150), @returnvalue int out ) begin --declare if not exists(select name pupil name=@name , city=@city) begin insert student(name, city) values(@name, @city) set @returnvalue=1 end else begin set @returnvalue=0 end select @returnvalue end

now after right click on table in edmx file showing following:

when import function take none in return.

i accessing next code:

public bool insertstudentdata(student student) { using (collegedataentities context = new collegedataentities()) { objectparameter returnedvalue = new objectparameter("returnvalue", typeof(int)); context.insertstudentdata(student.name, student.city, returnedvalue); if (convert.toint32(returnedvalue) == 1) { homecoming true; } else { homecoming false; } } }

while running, showing next exception:

in error list, next exception coming:

please help..

yes. solved it.

i changed lastly line of stored procedure:

select @returnvalue= scope_identity()

after updating model, in mapping part, added returnvalue in result column bindings to. nail come in button after writing out value. please tick adjacent checkbox of out value

c# entity-framework stored-procedures entity-framework-6.1

architecture - Database Transactions in Application Services as defined by Domain-Driven Design -



architecture - Database Transactions in Application Services as defined by Domain-Driven Design -

in book "implementing domain-driven design" vaughn vernon said on page 120

application services reside in application layer. [...]. may command persistence transactions [...]".

now, controller in mvc application application service, right? if yes, mean controller can commit or roll database transaction (directly or indirectly, through mecanism controller can manage)?

you can view controllers application services, in simple applications, might improve thought have dedicated objects these services because :

controller ui concept. might want alter or add together ui layer , still maintain applicative scenarios intact without rewriting them.

orchestrating calls repositories, domain entities , services plus carrying out applicative transactions might much responsibility controller in charge of dealing view info , view navigation. see fat controller antipattern.

design-patterns architecture domain-driven-design

javascript - Problems with jquery-ui droppable area -



javascript - Problems with jquery-ui droppable area -

i'm having issues droppable area in code. firing correctly , working should; however, area in can drop numbered circles not aligned correctly. hard explain here jsfiddle link below.

http://jsfiddle.net/sprink91/fse2l/48/

the html code area droppable:

<div id="card_area"> <div id="card1"> <p class="shadow 1"></p> <p class="shadow 2"></p> <p class="shadow 3"></p> </div> <div id="card2"> <p class="shadow 1"></p> <p class="shadow 2"></p> <p class="shadow 3"></p> </div>

javascript jquery html css jquery-droppable

vb.net - crystal report it is running perfectly on Windaws 7 and 8 but when i am running it on windows xp it is asking userid and password -



vb.net - crystal report it is running perfectly on Windaws 7 and 8 but when i am running it on windows xp it is asking userid and password -

i have 1 crystal study running on windaws 7 , 8 when running on windows xp asking userid , password. , other reports working fine have verifyed study anohter system.

this can fixed declaring in code.

for illustration report.setdatabaselogon(user, pwd)

you can write registry set in code better.

vb.net crystal-reports

jquery - how to stop body content showing over footer content and below -



jquery - how to stop body content showing over footer content and below -

i using autocomplete text box, here based on dynamic value exceed scroll bar ,if more value show in text box scroll bar automatically exceed in footer page , 2 scroll bar displayed. if more value show in text box scroll bar should not exceed footer content,only displayed in body container , not show 2 scroll bar, please help me problem.

css code:

.ui-autocomplete { max-height: 28%; overflow-y: auto; }

autocomplte code : areas info type array , contain multiple values

autocomplete({ autofocus : true, source : areas, selectfirst : true, select : function(event, ui) { };

image

a sample code great in order help, attached image, i'm guessing body container's parent has fixed height while body container has static positioning.

if so, you'll need alter body container's css position relative , assign fixed height .ui-autocomplete class:

.body-container { position: relative; } .ui-autocomplete { max-height: 100px; /* illustration */ }

if remove fixed height body container's parent, sec scrollbar should disappear. if must maintain fixed height, set overflow-y hidden.

jquery html css autocomplete overflow

panda3d - Python Toontown throwing pies error -



panda3d - Python Toontown throwing pies error -

i'm working on private server closed disney server, whenever client throws pie crashes , gives me error.

file "toontown\toon\toon.py", line 3029, in gettosspieinterval endpos=point3(0, dist, 0), duration=time) typeerror: __init__() got unexpected keyword argument 'startpos' press key go on . . .

here code breaks

def gettosspieinterval(self, x, y, z, h, power, throwtype, beginflyival = sequence()): toontown.toonbase import toontownbattleglobals toontown.battle import battleprops pie = self.getpiemodel() flypie = pie.copyto(nodepath('a')) piename = toontownbattleglobals.pienames[self.pietype] pietype = battleprops.globalproppool.getproptype(piename) animpie = sequence() if pietype == 'actor': animpie = actorinterval(pie, piename, startframe=48) sound = loader.loadsfx('phase_3.5/audio/sfx/aa_pie_throw_only.ogg') if throwtype == toontownglobals.piethrowarc: t = powerfulness / 100.0 dist = 100 - 70 * t time = 1 + 0.5 * t proj = projectileinterval(none, startpos=point3(0, 0, 0), endpos=point3(0, dist, 0), duration=time) relvel = proj.startvel elif throwtype == toontownglobals.piethrowlinear: magnitude = powerfulness / 2. + 25 relvel = vec3(0, 1, 0.25) relvel.normalize() relvel *= magnitude def getvelocity(toon = self, relvel = relvel): homecoming render.getrelativevector(toon, relvel) toss = track((0, sequence(func(self.setposhpr, x, y, z, h, 0, 0), func(pie.reparentto, self.righthand), func(pie.setposhpr, 0, 0, 0, 0, 0, 0), parallel(actorinterval(self, 'throw', startframe=48), animpie), func(self.loop, 'neutral'))), (16.0 / 24.0, func(pie.detachnode))) fly = track((14.0 / 24.0, soundinterval(sound, node=self)), (16.0 / 24.0, sequence(func(flypie.reparentto, render), func(flypie.setscale, self.piescale), func(flypie.setposhpr, self, 0.52, 0.97, 2.24, 89.42, -10.56, 87.94), beginflyival, projectileinterval(flypie, startvel=getvelocity, duration=3), func(flypie.detachnode)))) homecoming (toss, fly, flypie)

i'm not familiar server or library you're using, error implies projectileinterval constructor not want startpos keyword argument. if have source or documentation code, double check arguments expects.

python panda3d

oracle - OUT/IN OUT parameters in PL/SQL function -



oracle - OUT/IN OUT parameters in PL/SQL function -

as far understood it, possible have out or in out parameters procedures, not functions. however, when defining user-defined aggregate function, have found signature:

member function odciaggregateiterate(self in out deviationimpl, value in number) homecoming number

this seems function, however, has in out parameter. explain me why possible?

thanks

there no such restrictions. functions can have out or in out parameters.

however, oracle recommends against using them.

out , in out parameters prevent function beingness used plain sql, marked deterministic function or used result-cached function. these type of parameters problem if want utilize function in sql query.

your illustration more specific: it's fellow member function, not global function.

sql oracle function stored-procedures plsql

objective c - Is there a simpler method to set height of UIView? -



objective c - Is there a simpler method to set height of UIView? -

to set height of uiview, need set frame x, y, width , height.

[view setframe:cgrectmake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, myheight)]

which pretty annoying. there simpler build-in way?

cgrect frame = view.frame; frame.size.height = myheight; view.frame = frame;

which smaller , conveys meaning require (that alter height , nil else)

objective-c uiview

Formate type of GPS data -



Formate type of GPS data -

while getting gps info receiver in format 4119.03283,7203.39095. know kind of format is? can't mind around format dms, decimal?

the format called dm (degrees , decimal minutes).

4119.03283,7203.39095

is 41° , 19.03283 minutes (the first 2 digits in latitude), same

7203.39095: 72° 3.39095' (attention here: should 3 digits longitude: 07203.39095, check if have 5 digits before comma, first 3 degrees, else first 2 degrees. check farther missing leading zerors)

to convert decimal degrees (format name deg): 72 + 3.39095 / 60.0

gps

asp.net mvc - Loading partial view on button click only fires on the first click -



asp.net mvc - Loading partial view on button click only fires on the first click -

i have next code:

@model pedidosonlinemvc.models.superuser @{ viewbag.title = "mysystem"; layout = "~/views/shared/_layout.cshtml"; } <h2>administration</h2> @html.antiforgerytoken() @using(var p = html.bootstrap().begin(new panel())) { using (p.beginbody()) { @html.bootstrap().button().text("register new administrator").id("btnreg") @html.bootstrap().button().text("list administrators").id("btnlist") @html.bootstrap().button().text("search administrator").id("btnseek") using (var ip = html.bootstrap().begin(new panel())) { using (ip.beginbody()) { <div id="partials"> </div> } } } }

and proper jquery coded:

$(document).ready( function () { $('#btnreg').click(function () { $.get('@url.action("partialregadmin", "superuser")', function (data) { $('#partials').replacewith(data); }); }); $('#btnlist').click(function () { $.get('@url.action("partiallistadmin", "superuser")', function (data) { $('#partials').replacewith(data); }); }); $('#btnseek').click(function () { $.get('@url.action("partialseekadmin", "superuser")', function (data) { $('#partials').replacewith(data); }); }); });

and works fine on first click of of 3 buttons, but, after clicking one, other 2 won't work anymore. i've read posts here sying caching problem, tried using $.ajax({cache: false}), tried using [outputcache(duration = 0)], tried creating next attribute:

public class nocacheattribute : actionfilterattribute { public override void onactionexecuted(actionexecutedcontext filtercontext) { filtercontext.httpcontext.response.cache.setmaxage(new timespan(0, 0, 0, 0)); filtercontext.httpcontext.response.cache.setcacheability(httpcacheability.nocache); } }

all no use... has thought of wrong?

edit: requested code partial partialregadmin view:

@model pedidosonlinemvc.models.administrador @using (var f = html.bootstrap().begin(new form())) { @f.formgroup().customcontrols(html.antiforgerytoken()) @f.formgroup().textboxfor(model=>model.nome) @f.formgroup().textboxfor(model=>model.cpf).data(new {mask="999.999.999-99"}) @f.formgroup().textboxfor(model=>model.telefone) @f.formgroup().textboxfor(model=>model.login) @f.formgroup().passwordfor(model=>model.senha) @f.formgroup().customcontrols(@html.bootstrap().submitbutton().text("cadastrar")) }

you want

$('#partials').html(data);

instead of

$('#partials').replacewith(data);

basically when click first time, #partials on page replaced whatever html returned server. partialview contains no element id partials, consequent calls $('#partials') find nothing, nil replaced.

html on other hand replace content, leaving partials on page farther usage.

asp.net-mvc model-view-controller twitter-bootstrap-3 partial-views

Game Development - where to start to create powerful 3D applications -



Game Development - where to start to create powerful 3D applications -

http://www.youtube.com/watch?v=aef1zva2ieq

i'm interested in how same? ready start scratch basics. direct. give thanks you.

(there not tag game development, if there was, have been selected post.)

your question vague, there 1000000 directions go (which reason downwards voted question earlier) but, here ideas:

first pick language. i c, c++, java,... (and many more) good. (the list big , distinguished). if 1 available, classroom course of study thought ever language choose, not absolutely necessary. next, pick development environment/compiler. eclipse , mingw, there many others. next pick graphics tool. i opengl because open source, , documented. others include asymptote, and lot more.

once master (or become proficient with) variation of language, development environment, , fundamental graphics, should venture out into game specific tools. again, list long. around on google more.

these suggestions not intended point downwards specific path, started first step. links suggested offer technology open, free utilize , plenty of tutorials. good luck, hope best you.

3d

c# - Native images generated against multiple versions of assembly System.Net.Http -



c# - Native images generated against multiple versions of assembly System.Net.Http -

i have windows phone silverlight 8.1 application using backgroundtask project wns , timer tasks. i`m getting next error on calling method backgroundtask project:

error: native images generated against multiple versions of assembly system.net.http.

does have thought can problem?

i found problem:

i have windows phone silverlight 8.1 main project (converted wp8 ibackgroundtask support) referenced dal project (wp silverlight 8.1). have background task project (wp8.1) referenced dal project (wp 8.1). both dal projects (linking classes) using system.http classes.

error occurs when main wp silverlight 8.1 project calls method of background task wp8.1 using features of dal wp8.1 project. @ moment environment loads dal wp8.1 dll reference different version of system.http library.

solution: moved functionality background task project dal project , not phone call methods of background task project in main wp silverlight 8.1 application.

c# .net windows-phone-8.1 background-task

How to stop other processes or finish processes in Python / Tkinter program -



How to stop other processes or finish processes in Python / Tkinter program -

i have been drawing graphics python / tkinter program. programme has main menu menu items drawing different figures. works quite came against problem. if programme part way through drawing 1 figure , user clicks draw sec figure programme draws sec figure, when has finished drawing sec figure goes , finishes drawing first figure. want stop drawing first figure , not go drawing first figure when sec figure has finished drawing. created simpler illustration programme demonstrate scenario. see problem in programme click "draw -> red" , click "draw -> blue" before reddish has finished drawing. how programme abort previous drawing? here illustration program:

tkinter import * import random import math def line(canvas, w, h, p, i): x0 = random.randrange(0, w) y0 = random.randrange(0, h) x1 = random.randrange(0, w) y1 = random.randrange(0, h) canvas.create_line(x0, y0, x1, y1, fill=p.col(i)) class color: def __init__(self, r, g, b): self.red = r self.gre = g self.blu = b def hexval(self, v): homecoming (hex(v)[2:]).zfill(2) def str(self): homecoming "#" + self.hexval(self.red) + self.hexval(self.gre) + self.hexval(self.blu) class palette: def __init__(self, n0, y): self.colors = [] self.n = n0 self.m = 0 if y == "red": self.red() elif y == "blue": self.blue() def add(self, c): self.colors.append(c) self.m += 1 def red(self): self.add(color(127, 0, 0)) self.add(color(255, 127, 0)) def blue(self): self.add(color(0, 0, 127)) self.add(color(0, 127, 255)) def col(self, i): k = % (self.n*self.m) z = k // self.n j = k % self.n c0 = self.colors[z] c1 = self.colors[(z + 1) % self.m] t0 = (self.n - j)/self.n t1 = j/self.n r = int(math.floor(c0.red*t0 + c1.red*t1)) g = int(math.floor(c0.gre*t0 + c1.gre*t1)) b = int(math.floor(c0.blu*t0 + c1.blu*t1)) c = color(r, g, b) homecoming c.str() def upd(canvas): try: canvas.update() homecoming true except tclerror: homecoming false def tryline(canvas, w, h, p, i, d): try: line(canvas, w, h, p, i) if % d == 0: upd(canvas) homecoming true except tclerror: homecoming false class menuframe(frame): def __init__(self, parent): frame.__init__(self, parent) self.parent = parent self.initui() def initui(self): self.width = 800 self.height = 800 self.canvas = canvas(self.parent, width=self.width, height=self.height) self.pack(side=bottom) self.canvas.pack(side=top, fill=both, expand=1) self.parent.title("line test") menubar = menu(self.parent) self.parent.config(menu=menubar) self.parent.protocol('wm_delete_window', self.onexit) menu = menu(menubar) menu.add_command(label="red", command=self.onred) menu.add_command(label="blue", command=self.onblue) menu.add_command(label="exit", command=self.onexit) menubar.add_cascade(label="draw", menu=menu) self.pred = palette(256, "red") self.pblue = palette(256, "blue") def onred(self): # how abort here processes running? self.canvas.delete("all") in range(0, 7000): tryline(self.canvas, self.width, self.height, self.pred, i, 100) upd(self.canvas) def onblue(self): # how abort here processes running? self.canvas.delete("all") in range(0, 7000): tryline(self.canvas, self.width, self.height, self.pblue, i, 100) upd(self.canvas) def onexit(self): self.canvas.delete("all") self.parent.destroy() def main(): root = tk() frame = menuframe(root) root.mainloop() if __name__ == '__main__': main()

that's simple example? ;)

you can add together variable tracks selected method, check if variable exists before completing for loop. here's simpler example:

class example(frame): def __init__(self, parent): frame.__init__(self, parent) button(self, text='task a', command=self._a).pack() button(self, text='task b', command=self._b).pack() self.current_task = none # var hold current task (red, blue, etc) def _a(self): self.current_task = 'a' # set current task in range(1000): if self.current_task == 'a': # go on loop if current task print('a') self.update() def _b(self): self.current_task = 'b' in range(1000): if self.current_task == 'b': print('b') self.update() root = tk() example(root).pack() root.mainloop()

let me know if doesn't create sense or doesn't work out you.

python tkinter