Sunday, 15 March 2015

c# - How to use descending with ascending in linq? -



c# - How to use descending with ascending in linq? -

i have query

select * fellow member order d_no.member desc, datebirth asc

i thinking how can in linq? have list<member>

i used this

var result = member.orderbydescending(s => s.d_no).orderby(y => y.datebirth ).tolist();

is not working, idea?

orderbydescending returns instance of type iorderedenumerable<tsource>. can phone call thenby or thenbydescending apply sec (or third) ordering constraint.

var result = member.orderbydescending(s => s.d_no) .thenby(y => y.datebirth ) .tolist();

c# linq

Java Simple EchoServer won't work -



Java Simple EchoServer won't work -

i read through lot , found many examples doing trying do. can't find issue in code @ all. may need fresh set of eyes @ code. risk of beingness flagged duplicate thread here goes. have simple java code. opens port. connects socket that. gets inputstream , outputstream. puts text output stream , inputstream tries read text. when mehtod readline executed not homecoming code. keeps running , never comes main method.

import java.net.*; import java.io.*; import java.io.objectinputstream.getfield; public class echoserver { public static void main(string[] args) { // todo auto-generated method stub string hostname = "127.0.0.1"; // inetaddress.getlocalhost() int portnumber = 5000; serversocket ss = null; socket echosocket = null; seek { ss = new serversocket(portnumber); echosocket = new socket(hostname, portnumber); // echosocket = ss.accept(); system.out.println("open"); system.out.println(echosocket.isbound()); printwriter author = new printwriter(echosocket.getoutputstream()); (int = 0; < 100; i++) { writer.print("test string"); } writer.flush(); // writer.close(); system.out.println("inputstream read"); datainputstream = new datainputstream(echosocket.getinputstream()); string fromstream = is.readline(); system.out.println(fromstream); system.out.println("bufferreader read"); bufferedreader reader = new bufferedreader(new inputstreamreader(echosocket.getinputstream())); string fromreader = reader.readline(); system.out.println(fromreader); } grab (unknownhostexception ex1) { // todo auto-generated grab block system.out.println("ex1"); ex1.printstacktrace(); } grab (ioexception ex2) { // todo: handle exception system.out.println("ex2"); ex2.printstacktrace(); } { seek { echosocket.close(); ss.close(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } } } }

edit : updated code below... issue in code while loop in server.run never ends. looked other attributes (i remember istextavailable) not find it. thought behind code convert chat client. needless struggle !

edit 2: found the issue. never closed socket author end listner kept on listening ! help !

clientsocket.close();

added 1 line , worked!

import java.net.*; import java.io.*; import java.io.objectinputstream.getfield; import java.util.*; public class echoserver { static echoserver echo; public static class client implements runnable { socket clientsocket; string hostname = "127.0.0.1"; int portnumber = 5000; static int onesleep = 0; public void run(){ system.out.println("client run " + new date()); seek { clientsocket = new socket(hostname,portnumber); printwriter author = new printwriter(clientsocket.getoutputstream()); (int = 0; < 10; i++) { writer.println("test string " + ); } writer.flush(); clientsocket.close(); } grab (unknownhostexception e) { // todo auto-generated grab block e.printstacktrace(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } } } public class server implements runnable { public void run(){ system.out.println("server run" + new date()); int portnumber = 5000; serversocket ss = null; socket serversocket = null; inputstreamreader streamreader; seek { ss = new serversocket(portnumber); serversocket = ss.accept(); system.out.println("bufferreader read " + new date()); streamreader = new inputstreamreader(serversocket.getinputstream()); bufferedreader reader = new bufferedreader(streamreader); string fromreader; system.out.println(reader.ready()); system.out.println(reader.readline()); while ((fromreader = reader.readline()) != null) { system.out.println(fromreader); } system.out.println("after while in server run"); } grab (ioexception ex_server) { // todo auto-generated grab block system.out.println("server run error " + new date()); ex_server.printstacktrace(); } { seek { serversocket.close(); ss.close(); } grab (ioexception e) { // todo auto-generated grab block e.printstacktrace(); } } system.out.println("open" + new date()); system.out.println(serversocket.isbound()); } } public void go(){ server server = new server(); thread serverthread = new thread(server); serverthread.start(); client client = new client(); thread clientthread = new thread(client); clientthread.start(); } public static void main(string[] args) { // todo auto-generated method stub echo = new echoserver(); echo.go(); } }

i had prepared version of post earlier, based on lastly comment in other answer, seems have figured out. i'll posting anyways, in case of help.

the broad reply class, have it, represents both client-side , server-side portions within same thread / process. you've seen, you're able write info outbound (or client-side) socket, server-side component never gets chance hear incoming connections.

consequently, when effort read info inbound (or server-side) socket's input stream, nil exists because nil received. readline() method blocks until info available, why programme seems hold @ point. additionally, haifzhan said, creating new socket using new socket(...) doesn't found connection, have socket nil in stream.

the serversocket#accept method need utilize in order hear connections. method create socket you, can effort read stream. haifzhan said, method blocks until connection established, why cannot function in single-threaded environment.

to within same application, you'll need separate components , run them in separate threads. seek following:

public class echoclient { public static void main(string[] args) throws interruptedexception { new thread(new echoserver()).start(); // start server thread string hostname = "localhost"; int portnumber = 5000; seek { socket outboundsocket = new socket(hostname, portnumber); system.out.println("echo client send info server..."); printwriter author = new printwriter(outboundsocket.getoutputstream()); (int = 0; < 100; i++) { writer.print("test string"); } system.out.println("data has been sent"); writer.flush(); outboundsocket.close(); } grab (unknownhostexception e) { e.printstacktrace(); } grab (ioexception e) { e.printstacktrace(); } } }

and server component, operates separate thread:

public class echoserver implements runnable { public void run(){ seek { serversocket ss = new serversocket(5000); system.out.println("waiting connection..."); socket inboundsocket = ss.accept(); system.out.println("inputstream read"); datainputstream = new datainputstream(inboundsocket.getinputstream()); bufferedreader reader = new bufferedreader(new inputstreamreader(is)); string fromstream = reader.readline(); system.out.println(fromstream); system.out.println("bufferreader read"); ss.close(); } grab (ioexception e) { e.printstacktrace(); } } }

java

OpenFileDialog.FileName to upload an image using vb.net to SQL Server 2008 -



OpenFileDialog.FileName to upload an image using vb.net to SQL Server 2008 -

i have code uploading photo in vb.net sql server. on openfiledialog need imagename, it's location in text field.

dim bmap image dim info idataobject dim fd openfiledialog = new openfiledialog() fd.title = "select image." fd.initialdirectory = my.settings.imagedefect fd.filter = "all files|*.*|bitmaps|*.bmp|gifs|*.gif|jpegs|*.jpg|pngs|*.png" fd.restoredirectory = false if fd.showdialog() = dialogresult.ok picturebox.imagelocation = fd.filename **txtimagefile.text = fd.filename**

in text field, have c:\users\susi\pictures\capture.png

how can capture.png in text field? please help me, give thanks you.

use static methods of path class (path.getfilename)

txtimagefile.text = = path.getfilename(fd.filename)

vb.net sql-server-2008 image-uploading

Android string values formatting -



Android string values formatting -

my name <b>%1$s</b> <string name="funky_format">my name &lt;b&gt;%1$s&lt;/b&gt;</string>

what lastly formatting mean?

the reason string looks funky it's doing both formatting , html. here's description of documentation, states:

sometimes may want create styled text resource used format string. normally, won't work because string.format(string, object...) method strip style info string. work-around write html tags escaped entities.

android

jquery - SyntaxError: missing ; before statement Getting this error when trying to call google place search api -



jquery - SyntaxError: missing ; before statement Getting this error when trying to call google place search api -

getting 'syntaxerror: missing ; before statement' error when trying run ajax code fetch atm within 1 km range.

var url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json"; jquery.ajax({ url: url, datatype: 'jsonp', data: { 'location': '-33.8670522,151.1957362', 'radius': 1000, 'types': 'atm', 'name': '', 'sensor': false, 'key': api_key }, success: function(response) { alert('success'); } });

i have searched many articles didnt found solution. if remove 'p' 'jsonp' there no response cause cross domain. how can solve issue?

there no syntax-error in code, error comes via response.

the places-webservice doesn't back upwards jsonp, can't request service via $.ajax

use methods of places-library of maps-javascript-api: https://developers.google.com/maps/documentation/javascript/places#place_search_requests

jquery json google-maps-api-3 google-places-api

Clojure.contrib.sql: How do I retrieve the results of a select statement into a vector that can be accessed anytime? -



Clojure.contrib.sql: How do I retrieve the results of a select statement into a vector that can be accessed anytime? -

for example, in query:

(clojure.contrib.sql/with-query-results rows ["select count(*) tablename"] (doseq [record rows] (println (vals record))))

it seems record , rows don't exist outside scope want exist anytime me access.

update: tried next lines of code

(def asdf []) (sql/with-connection db (sql/with-query-results rows ["select * tablename"] (doseq [record rows] (def asdf (conj asdf record))))) (println asdf)

why print statement of asdf above homecoming empty when added rows in sql statement?

you seem lack basic understanding of clojure's underlying principles, in particular immutable info structures. conj phone call doesn't modify var asdf -- var not variable. next (untested)

(def asdf (sql/with-connection db (doall (sql/with-query-results rows ["select * tablename"]))))

to store result straight value of asdf, not want. familiar clojure's take on functional programming instead.

sql clojure

heroku - Rails not connecting to Redis (RedisToGo) -



heroku - Rails not connecting to Redis (RedisToGo) -

i've been trying deploy rails 4 app heroku, still getting same error:

error connecting redis on 127.0.0.1:6379 (econnrefused) (redis::cannotconnecterror)

i'm using redistogo , did configuration steps showed here. environment variable correctly set up.

when trying connect redis (as shown in documentation) locally works fine.

i resolve adding redis_url environment variable instead of redistogo_url or redis_provider. sidekiq official documentation advices utilize provider_url, though couldn't create work.

ruby-on-rails heroku redistogo

forms - Embedded resource and adding images -



forms - Embedded resource and adding images -

i developing form application monodevelop. i'm using gtk#.

i need add together image widget in form. trying create image embedded resource well, before including in form.

so far have:

hbox characterpic = new hbox(); image legionnairepic = new image('somehow load embedded resource image here'); characterpic.packstart (legionnairepic);

in 'solution' section left, have added .jpeg files , changed 'build action' 'embedded resource'. however, cannot access/load them onto form them so:

image legionnairepic = new image(<namespace>.<resource>);

how add together image resource form? adding resource correctly?

i believe have access embedded files next method:

// string resource_id resource id of file in sidebar “properties” system.reflection.assembly.getexecutingassembly().getmanifestresourcestream(resource_id);

this returns resource file stream.

if helped, give thanks that guy did :)

image forms resources gtk

c# - Visual Studio 2013 DB creation error : a network related or instance specific error occurred while establishing connection with sqlserver -



c# - Visual Studio 2013 DB creation error : a network related or instance specific error occurred while establishing connection with sqlserver -

first of all, allow me tell have tried every damn thing googling overcome error , have not done typo error either. but, none of google results helped. allow me tell scenario... installed visual studio ultimate 2013 (and nil else, no separate sqlexpress, nothing). non-db apps working fine. but, 1 project, when tried create new database connection (by right clicking 'data connections' or clicking 'connect database' icon creating localdb), got error:

"a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name right , sql server configured allow remote connections. (provider: sqlnetwork interfaces, error 26- error locating server/instance specified)"

then, usual, tried google it. of answers related sqlexpress (which didn't installed separately). 1 reply "sqlserver configuration manager" , enabling sqlservices , called surface area.... but, "sqlserver configuration manager" not there in 'all programs' on windows 8 (64x) machine, downloaded sqlexpress , sqlserver management studio too. item named "surface area manager...." not there. enabled sqlservices, tcp/ip ports. shut downwards firewall. still getting same error.

note: dont have connection string in webconfig till because going create new db. the reply editing conn string doesn't mattered me.

note: not case visual studio 2012. on vs2012 (and nil else) installation, worked fine creating dbs , other things. so, what's wrong vs2013??

server \ instance name must reachable client, creation of connection string seek verify connected ok. seek workstation:

sqlcmd -sservername\instance_or_ipaddress_of_sql_server -e -q"select @@version"

until proper server name or instance, not able create db connection.

c# asp.net sql-server windows-8 visual-studio-2013

java - Table Per Locale -



java - Table Per Locale -

i have table has next schema : & , mapping java class urlnameentry has 2 values urlname , creatorname. class can straight mapped hibernate , there no issues that.

now problem have different locales deal us, uk, de etc. , planning create separate table each of these locales table_us, table_uk, table_de , there more locales coming in future. how java entity map different table based on locale ?

i thinking in way : create base of operations abstract class urlnameentry , implement usurlnameentry, ukurlnameentry... etc subclasses , utilize table per class strategy solve problem. right approach ?

don't utilize table per locale; introduce sorts of headaches code, , different entries different kinds of things anyway. utilize locale column in single table instead.

java hibernate

excel - VBA: Macro to loop through rows and Autofill -



excel - VBA: Macro to loop through rows and Autofill -

edit: if instead wanted autofill these cells, next code work?

sub bc_edit() ' define width , height of table dim datasetwidth, datasetheight integer ' find values width , height of table datasetwidth = range("a1").end(xltoright).column datasetheight = range("a1").end(xldown).row ' loop on each column x = 1 datasetwidth set sourcerange = cells(2,x) set fillrange = range(cells(3, x), cells(datasetheight, x)) sourcerange.autofill destination:=fillrange next end sub

i'm working couple of extremely big datasets - each approximately 3000 rows 4000 columns. while excel may not best tool job, have built important amount of infrastructure around info , cannot move different framework. i'm using excel 2007.

in particular worksheet, when seek autofill using formula have inputted entire sec column b (3000 x 1) via re-create , paste of column remaining 3000 3998 selection, or part of selection, excel gives me memory/resources error. instead loop through each row , autofill across columns. (in other words, i'd utilize a2 autofill a3:a4000, b2 autofill b3:b4000, , on.) perhaps help memory issue. how go writing macro accomplish this?

i'd appreciate advice on issue, , perhaps help appropriate vba code, if possible.

here pretty basic illustration of macro set columns below 2 formula of column 2. best have attached button or similar rather running every time open sheet.

sub button_click() ' define width , height of table dim datasetwidth, datasetheight integer ' find values width , height of table datasetwidth = range("a1").end(xltoright).column datasetheight = range("a1").end(xldown).row ' loop on each column x = 1 datasetwidth ' row 3 height of data, set formula of cells ' formula contained in row 2 of column range(cells(3, x), cells(datasetheight, x)).formula = cells(2, x).formula next end sub

excel vba

javascript - Angular 1.2.5 animation classes are not removed in iOS6 -



javascript - Angular 1.2.5 animation classes are not removed in iOS6 -

i have animation, box slides , down. works on web, ios , android phonegap app , mobile safari (all tested). works on iphone5 ios6, have problems because supporting classes, such ng-hide-add, ng-hide-remove not deleted after animation completes. eperienced similar issues?

edit: appears animation doesn't work on ios6. classes added, never removed.

update: issue seems happen when animation time less 0.5s

i did tests , looks in application caused animation classes on ios6 sticky if animation under 0.5 seconds. able solve issue in hacky way, deleting classes manually upon animation finish event.

if(ios6) { $('.element').on('webkittransitionend otransitionend otransitionend mstransitionend transitionend', function() { $('.element').removeclass("ng-animate ng-hide-add ng-animate-start ng-animate-active ng-hide-add-active ng-hide-remove ng-hide-remove-active"); }); }

javascript angularjs animation

javascript - Make my script not to refresh the page -



javascript - Make my script not to refresh the page -

how can alter script in order not refresh page when utilize show_reply() , hide_reply() functions created? here script:

function show_reply($id){ document.getelementbyid($id).style.display = "initial"; } function hide_reply($id){ document.getelementbyid($id).style.display = "none"; }

forgot metion i`m calling these fuction this

<a href="#" title="reply" onclick="show_reply('<?php echo $row['id']; ?>')"> reply</a>

working fiddle : fiddle

you should prevent action goto other page. //html

<a href="#" title="reply" class="classhref" onclick="show_reply('<?php echo $row['id']; ?>')"> reply</a>

//script

$('.classhref').click(function(event){ event.preventdefault(); }

javascript jquery html

React-rails: Component with { prerender: true } in options hash gives a V8:Error - Unexpected token < -



React-rails: Component with { prerender: true } in options hash gives a V8:Error - Unexpected token < -

i'm using react-rails gem in project.

whenever pass in prerender: true alternative options hash of react_component helper method, error: v8::error - unexpected token <. component works fine when remove prerender: true options hash.

gemfile:

gem 'rails', '4.1.1' gem 'execjs' gem 'therubyracer', platforms: :ruby gem 'react-rails', github: 'reactjs/react-rails'

the view:

= react_component("assignmentwindowprogressbar", { assignment: @assignment_json }, { prerender: true })

coffee file:

###* @jsx react.dom ### @assignmentwindowprogressbar = react.createclass render: -> `<div>hi world.</div>` # located in file: # ./apps/assets/javascripts/components/assignments/assignmentwindows.js.jsx.coffee

stack trace:

v8::error - unexpected token < @ <eval>:19037:15: therubyracer (0.12.1) lib/v8/error.rb:86:in `block in try' therubyracer (0.12.1) lib/v8/error.rb:83:in `try' therubyracer (0.12.1) lib/v8/context.rb:95:in `block in eval' therubyracer (0.12.1) lib/v8/context.rb:248:in `block (2 levels) in lock_scope_and_enter' therubyracer (0.12.1) lib/v8/context.rb:245:in `block in lock_scope_and_enter' therubyracer (0.12.1) lib/v8/context.rb:244:in `lock_scope_and_enter' therubyracer (0.12.1) lib/v8/context.rb:204:in `enter' therubyracer (0.12.1) lib/v8/context.rb:94:in `eval' execjs (2.2.0) lib/execjs/ruby_racer_runtime.rb:11:in `block in initialize' execjs (2.2.0) lib/execjs/ruby_racer_runtime.rb:78:in `block in lock' execjs (2.2.0) lib/execjs/ruby_racer_runtime.rb:76:in `lock' execjs (2.2.0) lib/execjs/ruby_racer_runtime.rb:9:in `initialize' execjs (2.2.0) lib/execjs/runtime.rb:44:in `compile' execjs (2.2.0) lib/execjs/module.rb:27:in `compile' ... end of execjs errors ...

thanks , help guys!

copied reply https://github.com/reactjs/react-rails#jsx

to transform jsx js, create .js.jsx files. these files transformed on request, or precompiled part of assets:precompile task.

coffeescript files can used, creating .js.jsx.coffee files. need embed jsx within backticks coffeescript ignores syntax doesn't understand. here's example:

component = react.createclass render: -> `<examplecomponent videos={this.props.videos} />`

notice file extension.

ruby-on-rails ruby-on-rails-4 v8 reactjs execjs

R-package missing functions, but has documentation -



R-package missing functions, but has documentation -

my problem when build bundle using devtools, or r cmd install -build bundle builds, when install resulting .zip (when i've tried binary builds) or .tar.gz functions in bundle don't show up. can see functions in .tar.gz when unzip , files sufficiently big not empty. help appreciated.

what i'm using: rstudio, r v 3.1.0

>install.packages("e:/r/rpackage_meadq/meadq_1.0.4.tar.gz", repos = null, type = "source") '\\aa.ad.epa.gov\ord\rtp\users\a-d\dhall05\net mydocuments' cmd.exe started above path current directory. unc paths not supported. defaulting windows directory. * installing *source* bundle 'meadq' ... ** r ** info ** inst ** preparing bundle lazy loading ** help *** installing help indices ** building bundle indices ** testing if installed bundle can loaded *** arch - i386 *** arch - x64 * done (meadq) >installed.packages() ... meadq "3.1.0" > library('meadq') >ls('package:meadq') character(0) ## take illustration function within bundle > create_ont_csv() error: not find function "create_ont_csv" >?create_ont_csv

this pulls function documentation create_ont_csv that's in package

when @ "meadq_1.0.4.tar.gz" using winzip, can see functions. i've tried building in binary , same thing happens functions missing, documentation there.

i've tried re-building lot code , r cmd install -build ... :

> library('devtools') attaching package: ‘devtools’ next objects masked ‘package:utils’: ?, help next object masked ‘package:base’: system.file > build("e:/r/rpackage_meadq/meadq") "c:/progra~1/r/r-31~1.0/bin/x64/r" --vanilla cmd build "e:\r\rpackage_meadq\meadq" \ --no-manual --no-resave-data * checking file 'e:\r\rpackage_meadq\meadq/description' ... ok * preparing 'meadq': * checking description meta-information ... ok * checking lf line-endings in source , create files * checking empty or unneeded directories * looking see if 'data/datalist' file should added * building 'meadq_1.0.4.tar.gz' [1] "e:/r/rpackage_meadq/meadq_1.0.4.tar.gz"

r

java - Trying to regex match a line in a log file that contains my "app" variable without file extension -



java - Trying to regex match a line in a log file that contains my "app" variable without file extension -

i apologise new groovy but,

there line in log file:

[info] uploading: //blah/client_website-versionnumber.war

i have variable established sql statement "apps" is: client_website.war

my problem can't work out how form if statement find "client_website.war" in log file, because there "-versionnumber" right in middle of variable in between client-website , .war. there way match half of apps variable or something? help appreciated.

you utilize character class define collection/range of allowed characters version number. example,

client_website[0-9.-]*\.war

would match client_website, followed 0 or more (*) characters collection "any ascii digit (0-9), dot (.) or dash (-)", followed \.war.

this match nonsensical values client_website.....war or client_website-.-.-.-.war, if don't need exclude such values, regex should fine.

if decide extend character class, create sure dash remains @ end of class; otherwise interpreted range indicator (as in 0-9!).

java regex groovy

html - How do i make the content of the division appear when I scroll down -



html - How do i make the content of the division appear when I scroll down -

i take website example

http://paultrifa.com/envato/themeforest/scrolled/

i learning how create contents appear fading in when scroll down. can utilize animate.css help me fading in effects can't create load when scroll down.

everything loaded before scroll down. can please enlighten me on this? keen larn this.

what bind method window.scroll event, , when scroll hits specific values you'll trigger specific animations functions either animate contents on screen via jquery, or add together classes predefined css animations attached.

step 1, this)

$(document).ready(function() { var firstaniwaiting = true, secondaniwaiting = true, thirdaniwaiting = true, checkscroll = function() { var currentscroll = $(window).scrolltop(); if (currentscroll > 200 && firstaniwaiting) { firstaniwaiting = false; domyfirstani(); } else if (currentscroll > 1000 && secondaniwaiting) { secondaniwaiting = false; domysecondani(); } else if (currentscroll > 1500 && thirdaniwaiting) { thirdaniwaiting = false; domythirdani(); $(window).unbind(); } }; $(window).scroll(checkscroll); }

step 2, set css position values elements in pre-animated states (i.e. hidden, or whatever). if you're using classes to css3 animations, create sure include 'transition' value on native class (meaning, class on object , not class gets added later). sorta like:

.thingtoani1 { position: relative; top: -500px; left: 0; transition: top 0.5s; } .thingtoani1moveit { // class gets added later top: 0; }

step 3, create classes have position values post-animated states. (or) step 3, this)

var domyfirstani = function() { $('.thingtoanimate1').animate({ top: '20px', left: '100px' }, 200); $('.thingtoanimate2').animate({ top: '20px', left: '300px' }, 200); }

that's super rough, that'll started.

also, didn't double check myself if there's screwed up, leave comment , i'll update dumbness.

html css website transition fadein

Django: Nested templates such as {{ foo.{{ bar.baz }} }} -



Django: Nested templates such as {{ foo.{{ bar.baz }} }} -

i have django template calls object’s field, such object.dictionary.key.

the thing is, value of key want given other_variable.other_field.

is {% object.dictionary.{{ other_variable.other_field }} %} legal? there workaround?

i've been poking around answers django nested-template questions, none of them seem asking this.

if it's dictionary, next should work:

{{ object.dictionary.other_variable.other_field }}

django django-templates nested

c++ - From constant object reference to pointer -



c++ - From constant object reference to pointer -

in c++ programme i've base of operations class b , derived classes d1, d2, etc.. i've function taking parameter derived class d1, passed const reference improve performance, instead of passing copy:

void appendderived(const d1& derived) { listofderived.append(d1); }

listofderived list of derived classed, append method following:

void append(base* base) { if (!base) return; m_mylist.append(base->clone()); //clone function defined each derived , does: homecoming new d1(*this); }

because of appendderived takes argument const reference, compiler gives error in append method, because there's no matching function append. solutions i've found following:

change appendderived function to:

void appendderived(d1 derived) { listofderived.append(&derived); }

so passing argument value, performance penalty.

change appendderived function to:

void appendderived(d1* derived) { listofderived.append(derived); }

so passing argument pointer, meaning i've alter function calls appendderived in whole code, drawbacks don't want list here...

create intermediate variable before append:

void appendderived(const d1& derived) { d1 derived_temp = derived; listofderived.append(&derived_temp); }

but seems dirty solution...

do have improve idea?

is broken because passing address of local variable. seems ok, alter function take pointer rather reference. has effect on caller side. is broken in same way 1. is.

so, may utilize solution 2, can pass non-const reference:

void appendderived(d1& derived) { listofderived.append(&d1); }

a few things think about:

append() takes pointer. create sense appendderived() take reference? which 1 of append or appendderived need parameter pointer/reference const? need const in both places, rather non-const suggested above. in other words, alter append to

.

void append(const base* base) { if (!base) return; m_mylist.append(base->clone()); //clone needs const, should be. }

this needs clone() const:

virtual base* clone() const; ^^^^^

c++

c# - Saving score into MS SQL database from Unity3D Android game -



c# - Saving score into MS SQL database from Unity3D Android game -

i'm trying save score ms sql database.

i've created asp.net mvc web application , when seek phone call specific url:

www.mydomain.com/controller/action?

whit specific parameters:

name=somename&score=somescore

score saved.

in unity c# script used www api. here code:

using unityengine; using system.collections; public class showscore : monobehaviour { public string addscoreurl = "http://www.mydomain.com/controller/action?"; string score=somestaticclass.score; void start () { string name=systeminfo.devicename+"_"+systeminfo.devicemodel; startcoroutine(postscores(name,score)); } ienumerator postscores(string name, int score) { string post_url = addscoreurl + "name=" + www.escapeurl(name) + "&score=" + score ; www hs_post = new www(post_url); yield homecoming hs_post; // wait until download done if (hs_post.error != null) { print("there error posting high score: " + hs_post.error.toupper()); } }

for testing build application windows, web , android. working fine windows , web android app not save score database.

what can problem?

abit late reply using problem database speed

c# android sql-server asp.net-mvc-4 unity3d

c# - Tips and Tricks for managing design View -



c# - Tips and Tricks for managing design View -

currently working on project in combo box determines panel shown. gets messy since panels on top of each other , becomes hard determine what.

i wondering if there can help me in visual studio 2013 solve this.

you utilize document outline window provides outline view of elements nowadays on form.

on view menu in visual studio, click other windows, , click document outline. document outline window open.

there link explains how to: layer objects on windows forms.

by layering manipulate z-order of command @ design view. there alternative alter order of command either send back or bring front.

msdn reference explains how manipulate ordering programmatically.

c# winforms visual-studio-2013

css - Cannot set z-index on Angular UI dropdown-menu inside ng-grid -



css - Cannot set z-index on Angular UI dropdown-menu inside ng-grid -

the problem cannot dropdown menu show on top of ng-grid. i've tried manually setting z-index property on every element via firebug still cannot work.

i'm hoping similar experience can help..

here's plunker sample

it kinda works if set:

.ngviewport { overflow:visible; }

in style.css. not nice. may take forked plunker base of operations farther experiments.

css angularjs angular-ui-bootstrap ng-grid

sql - Poor performance on Amazon Redshift queries based on VARCHAR size -



sql - Poor performance on Amazon Redshift queries based on VARCHAR size -

i'm building amazon redshift info warehouse, , experiencing unexpected performance impacts based on defined size of varchar column. details follows. 3 of columns shown pg_table_def:

schemaname | tablename | column | type | encoding | distkey | sortkey | notnull ------------+-----------+-----------------+-----------------------------+-----------+---------+---------+--------- public | logs | log_timestamp | timestamp without time zone | delta32k | f | 1 | t public | logs | event | character varying(256) | lzo | f | 0 | f public | logs | message | character varying(65535) | lzo | f | 0 | f

i've run vacuum , analyze, have 100 1000000 rows in database, , i'm seeing different performance depending on columns include.

query 1: instance, next query takes 3 seconds:

select log_timestamp logs order log_timestamp desc limit 5;

query 2: similar query asking more info runs in 8 seconds:

select log_timestamp, event logs order log_timestamp desc limit 5;

query 3: however, query, similar previous, takes 8 minutes run!

select log_timestamp, message logs order log_timestamp desc limit 5;

query 4: finally, query, identical slow 1 explicit range limits, fast (~3s):

select log_timestamp, message logs log_timestamp > '2014-06-18' order log_timestamp desc limit 5;

the message column defined able hold larger messages, in practice doesn't hold much data: average length of message field 16 charachters (std_dev 10). average length of event field 5 charachters (std_dev 2). distinction can see max length of varchar field, wouldn't think should have order of magnitude impact on time simple query takes return!

any insight appreciated. while isn't typical utilize case tool (we'll aggregating far more we'll inspecting individual logs), i'd understand subtle or not-so-subtle affects of table design.

thanks!

dave

redshift "true columnar" database , reads columns specified in query. so, when specify 2 little columns, 2 columns have read @ all. when add together in 3rd big column work redshift has dramatically increases.

this different "row store" database (sql server, mysql, postgres, etc.) entire row stored together. in row store adding/removing query columns not create much difference in response time because database has read whole row anyway.

finally reason lastly query fast because you've told redshift can skip big portion of data. redshift stores each column in "blocks" , these blocks sorted according sort key specified. redshift keeps record of min/max of each block , can skip on blocks not contain info returned.

the limit clause doesn't cut down work has done because you've told redshift must first order all log_timestamp descending. the problem order … desc has executed on entire potential result set before info can returned or discarded. when columns little that's fast, when they're big it's slow.

sql amazon-redshift

ruby - How to run/debug dashing dashboards on a client PC with Eclipse -



ruby - How to run/debug dashing dashboards on a client PC with Eclipse -

i trying create dashboard work via dashing. have opensuse server set (command-line only, no x server), , dashing running on successfully. want able utilize work windows 7 pc configure ruby-based jobs scripts, etc. have eclipse set ruby, installed ruby on windows , have debugger configured in eclipse. git set on server, dashing folder. have 2 questions methods:

question 1: now, can configure breakpoints in ruby jobs , debug variables, etc., debugger throws error when reaches scheduler part (see code pasted below) stating "uninitialised constant". i'm guessing eclipse doesn't understand how run/debug specific dashing code; apparently dashing uses rufus-scheduler. how can eclipse run and/or debug dashing dashboards?

example of ruby job in dashing, rufus-scheduler, dashing website:

# :first_in sets how long takes before job first run. in case, run scheduler.every '1m', :first_in => 0 |job| send_event('karma', { current: rand(1000) }) end

question 2: way move code windows pc opensuse, via git. means when want test alter (simple or complicated) must commit git on client, force git branch on server. means commit history going filled test changes. there improve way this? (i'm guessing way around this, create test web server on client pc)

thanks help can provide.

try "dashing job job_name auth_token". auth_token stored in config.ru.

dennis

me@host:~/projects/my-dashing$ dashing --help tasks: dashing generate (widget/dashboard/job) name # creates new widget, dashboard, or job. dashing help [task] # describe available tasks or 1 specific task dashing install gist_id # installs new widget gist. dashing job job_name auth_token(optional) # runs specified job. create sure supply auth token if have 1 set. dashing new project_name # sets things needed dashboard project. dashing start # starts server in style! me@host:~/projects/my-dashing$

ruby eclipse git rufus-scheduler dashing

gcc - Fastcall name decoration in Windows does not port easily -



gcc - Fastcall name decoration in Windows does not port easily -

i'm using mingw in windows compile code in c , assembly, several functions in have fastcall calling convention (as microsoft defines it). if utilize __fastcall in declaration, mingw windows , name decorates:

an @ sign (@) prefixed names; @ sign followed number of bytes (in decimal) in parameter list suffixed names

this works fine. have labels in assembly in form:

.global @myfunction@4 @myfunction@4: ....code....

but proves big problem when port linux (x86, 32 bit). gcc not __fastcall (or __cdecl matter) , not @ in labels @ all. i'm not sure how can unify 2 issues - either gcc in linux @ or mingw in windows not add together @.

also: can utilize __attribute__(__cdecl__) in place of __cdecl i'm puzzled goes. assumed before function name see people putting after declaration , before semicolon. can either?

related answer: adding leading underscores assembly symbols gcc on win32?

name decoration appears mutual theme when porting between operating systems, platforms , processors on same platform (ia32 ia64 illustration loses underscore).

the way solved remove @ decoration function used didn't need export them other testing. other functions redefined function _function using macros (that's macro assemblers after all).

in case renamed assembly code .s .sx (windows platform) , uses gcc preprocessor check _win32 , redefine export global symbols have leading underscores. same calls _calloc , _free.

gcc mingw fastcall

How to use PHP in Javascript? -



How to use PHP in Javascript? -

i have script:

<script type="text/javascript"> $(function(){ $(".scratchcard").rabidscratchcard({ foregroundimage:"images/cards/card-prev.png", backggroundimage:"images/cards/card1-3-8.png", revealradius:7 }); }); </script>

the next want is, alter line of foregroundimage to:

foregroundimage:"<?php echo $path . $img ?>",

do have utilize ajax in javascript? or how work?

assuming script tag embedded within .php page (or file containing php has mime type webserver has been configured execute), can interpolate php within page so:

<script type="text/javascript"> $(function(){ $(".scratchcard").rabidscratchcard({ foregroundimage: "<?php echo $path . $img ?>", backggroundimage:"images/cards/card1-3-8.png", revealradius:7 }); }); </script>

javascript php

flex - How to cancel a browse dialog in AIR for Android? -



flex - How to cancel a browse dialog in AIR for Android? -

i have app here allowing user upload images. pick image open native browser var file:file = new file; file.browse();

i encounter unusual problem when user cancels upload. in fact there 2 ways can done:

a) user clicks on "back" button on device or:

b) user clicks on empty space on (native) browse dialog window.

in first case, air fire event.cancel event , fine.

in sec case no event fire, still browse dialog quit, leaving app in state of still waiting upload. deal this, added button ui fire event , phone call file.cancel(); file = null manually.

unfortunately, doesn't work expected. when seek open browse dialog again, error error #2041: 1 file browsing session may performed @ time. cancel ignored.

does have thought how workaround problem?

p.s. tested on air 13 , android 4.1 / android 4.3

android flex mobile air

c# - Validation for ViewModels different from the page ViewModel -



c# - Validation for ViewModels different from the page ViewModel -

assume have page (view) takes viewmodel:

@model ienumerable<myproject.viewmodels.myviewmodel>

in page, have form posts info through viewmodel (let's phone call postmodel):

@using (html.beginform("order", "order", formmethod.post, new { @class = "form-horizontal", role = "form" })) { @html.antiforgerytoken() <h4>give order info</h4> <hr /> @html.validationsummary() <div class="form-group"> <label for="order.name" class="col-md-2 control-label">name:</label> <div class="col-md-10"> @html.textbox("order.name", null, new { @class = "form-control" }) @html.validationmessage("order.name") </div> </div> ... }

this processed on controller in order httppost action method takes argument of postmodel's type.

i can display validation messages in style have above. question is, how (if possible) can create typed postmodel? like:

@html.textbox<mypostmodel>(t => t.order.name, ...) @html.validationmessagefor<mypostmodel>(t => t.order.name)

is @ possible, without changing viewmodel of page?

you can utilize different partial-view form , in partial-view can specify of type want, in case, see in code example, order

lets have model called order next definition

public class order { public string name { get; set; } }

and partial-view called _mypostpartialview.cshtml definition

@model order @using (html.beginform("order", "order", formmethod.post, new { @class = "form-horizontal", role = "form" })) { @html.antiforgerytoken() <h4>give order info</h4> <hr /> @html.validationsummary() <div class="form-group"> @html.label(m => m.name, "name:") <div class="col-md-10"> @html.textbox(m => m.name, null, new { @class = "form-control" }) @html.validationmessage(m => m.name) </div> </div> ... }

and you're done!

c# asp.net-mvc validation asp.net-mvc-5

regex - find and get particular word using regular expression -



regex - find and get particular word using regular expression -

am trying find , particular word info returnd

while executing partiular command console.log(stdout) prints below data

commit e6c4236951634c67218172d742 author:ttpn <testuser@gmail.com> date: mon jun 9 10:18:04 2014 -0700 prepare dersk reset .......... ...........

my code

var getemail = function (callback) { var command = "git show ec6c4236951634c67218172d742"; exec(command, function (error, stdout, stderr) { if (error !== null) { console.log(error) callback(error, null); } else { console.log(stdout) // prints above info } })

; }

from how can email id testuser@gmail.com using regular look possible?

this regex capture info want groups 1 , 2 (on demo, @ capture groups in right pane):

commit (\s+)[\r\n]*author:[^<]*<([^>]*)>

here how utilize in js:

var regex = /commit (\s+)[\r\n]*author:[^<]*<([^>]*)>/; var match = regex.exec(string); if (match != null) { theid = match[1]; theemail = match[2]; }

explaining regex

commit # 'commit ' ( # grouping , capture \1: \s+ # non-whitespace (all \n, \r, \t, \f, # , " ") (1 or more times (matching # amount possible)) ) # end of \1 [\r\n]* # character of: '\r' (carriage return), # '\n' (newline) (0 or more times (matching # amount possible)) author: # 'author:' [^<]* # character except: '<' (0 or more times # (matching amount possible)) < # '<' ( # grouping , capture \2: [^>]* # character except: '>' (0 or more # times (matching amount # possible)) ) # end of \2 > # '>'

regex node.js shell

linux - Run PHP crone multiple time in a timeframe -



linux - Run PHP crone multiple time in a timeframe -

i have php cron job , need run on 10 times in between 10pm 11pm possible in server

/usr/local/bin/php -q /home/geniusgr/public_html/cron.php

you can utilize cron:

*/6 22 * * * /usr/local/bin/php -q /home/geniusgr/public_html/cron.php

it run every 6 minutes @ 22 (10pm):

22.00 - 1st 22.06 - 2nd 22.12 - 3rd 22.18 - 4th 22.24 - 5th 22.30 - 6th 22.36 - 7th 22.42 - 8th 22.48 - 9th 22.54 - 10th

php linux cron

embed - PHP code either is commented out or Produces Internal Server Error 500 -



embed - PHP code either is commented out or Produces Internal Server Error 500 -

<div class="thumb_container centered"> <?php foreach (glob("../images/*.{jpg,png}") $filename) { echo '<img src="' . $filename . '">'; } ?> </div>

this snippet not work embedded within of html document. if save file .php extension, errors out , gives internal server error 500. if save .html, script commented out , prints ';}?> within div. have set permissions 755, still no go.

how have script run?

there maybe problem permissions on ../images/ and/or it's files. seek set permissions readable webserver user.

the file extension .php of course of study right 1 files parsed php.

you can check error log, located in /var/log/.

php embed

Type declaration using reals in ACSL/Frama-C -



Type declaration using reals in ACSL/Frama-C -

i have issues acsl specification lastly frama-c version. tried lot of things declare pair of reals, none of them worked. here tiny illustration illustrating problem :

/*@ type real_pair = (real, real); */

which gives :

[kernel] user error: unexpected token '('

at end, want have code near :

/*@ axiomatic realpairs { type real_pair = (real, real); logic real norm ( real_pair p ) = \let (x,y) = p; \sqrt(x*x + y*y); } */

does see error ? found acsl documentation vague on type declarations...

thank much answers.

best regards,

nilexys.

what have written right respect acsl manual. however, can see in acsl implementation manual (http://frama-c.com/download/frama-c-acsl-implementation.pdf), pairs not supported in current implementation of acsl in frama-c. in fact, thing partially supported in area of acsl sum types. more precisely, can define sum types, \match construction not supported frama-c, means have resort axiomatics. in current state of affairs, next should accepted frama-c (not tested though):

/*@ type real_pair = rpcons(real, real); */ /*@ axiomatic real_pair { logic real rp_fst(real_pair p); logic real rp_snd(real_pair p); axiom rp_fst_def: \forall real x, y; rp_fst(rpcons(x,y)) == x; axiom rp_snd_def: \forall real x,y; rp_snd(rpcons(x,y)) == y; */

c frama-c

javascript - form is not stopping when i run onsubmit -



javascript - form is not stopping when i run onsubmit -

i have .tpl file form connected js file suppost stop page doing if form 1 of folloowing:

not filled in correctly not right email fomate or matching formate if no first or lastly name

but seems skip , run signup page

here js code

function registervalidation() { var emailone = document.getelementbyid("emailone").value; var emailtwo = document.getelementbyid("checkemail").value; var firstname = document.getelementbyid("firstname").value; var lastname = document.getelementbyid("lastname").value; if(firstname == null || firstname == "") { document.getelementbyid("firstname").classlist.add("warning"); homecoming false; } if(lastname == null || lastname == "") { document.getelementbyid("lastname").classlist.add("warning"); homecoming false; } if (emailtwo == null || emailtwo == "" ) { document.getelementbyid("emailtwo").classlist.add("warning"); homecoming false; } if(emailone !== emailtwo) { document.getelementbyid("emailtwo").classlist.add("warning"); homecoming false; } if(validateemail(document.getelementbyid('emailone').value)){ }else{document.getelementbyid("emailone").classlist.add("warning"); homecoming false;} if(validateemail(document.getelementbyid('emailtwo').value)){ }else{document.getelementbyid("emailtwo").classlist.add("warning"); homecoming false;} }

and form

<script src="//<?=siteurl;?>/template/main/js/registervalidation.js"></script> <div class="grid-cell u-size35of4"> <div class="internal"> <h1 class="hevetics">sign up</h1> <p class="signuptext">it's free , be.</p> <form action="/signup" name="register" method="post" class="ipetsignup" enctype="multipart/form-data" onsubmit="return registervalidation();"> <label> <span><input id="firstname" type="text" name="firstname" placeholder="first name" class="half" onchange="name();"/></span><input id="lastname" id="name" type="text" name="lastname" onchange="name();" placeholder="last name" class="half right" /> </label> <label> <input id="emailone" type="email" name="email" placeholder="your email" onchange="checkemails();" /> </label> <label> <input id="emailtwo" type="email" name="checkemail" placeholder="re-enter email" onchange="checkemailtwo();" /> </label> <label> <input id="password" type="password" name="password" placeholder="new password" /> </label> <label> <input id="signup" type="submit" class="button" value="sign up" /> </label> </form> </div> </div>

javascript forms return submit onsubmit

security - Silverstripe Cron Job Admin Actions -



security - Silverstripe Cron Job Admin Actions -

i have controller function permission set admin needs executed form cron job, unfortuntly calling php or php-cgi says actipn not permitted on controller. i've temporarily removed admin check, it's resource intensive it's possible ddos vector

you can utilize custom permission check in controller check if phone call made cli:

class foocontroller extends controller { private static $allowed_actions = array( 'mysecureaction' => '->mysecuritycheck' ); public function mysecureaction() { // here } /** * if method returns true, action executed * more information, view docs at: http://doc.silverstripe.org/framework/en/topics/controller#access-control */ public function mysecuritycheck() { homecoming director::is_cli() || permission::check('admin'); } }

security cron silverstripe

amazon ec2 - Cassandra 2.0.6 won't startup on CentOS 6.5 EC2 micro instance -



amazon ec2 - Cassandra 2.0.6 won't startup on CentOS 6.5 EC2 micro instance -

i have fresh install , followed install steps datastax. reason, when seek start, get... non-informative "killed" message.

bash-4.1$ cassandra -f info 02:24:13,374 logging initialized info 02:24:13,464 loading settings file:/etc/cassandra/default.conf/cassandra.yaml info 02:24:14,409 info files directories: [/var/lib/cassandra/data] info 02:24:14,411 commit log directory: /var/lib/cassandra/commitlog info 02:24:14,411 diskaccessmode 'auto' determined mmap, indexaccessmode mmap info 02:24:14,411 disk_failure_policy stop info 02:24:14,412 commit_failure_policy stop info 02:24:14,427 global memtable threshold enabled @ 72mb info 02:24:14,727 not using multi-threaded compaction info 02:24:15,260 jvm vendor/version: java hotspot(tm) 64-bit server vm/1.7.0_60 info 02:24:15,261 heap size: 301727744/302776320 info 02:24:15,262 code cache non-heap memory: init = 2555904(2496k) used = 647168(632k) committed = 2555904(2496k) max = 50331648(49152k) info 02:24:15,262 eden space heap memory: init = 61341696(59904k) used = 48067200(46940k) committed = 61341696(59904k) max = 61341696(59904k) info 02:24:15,262 survivor space heap memory: init = 7602176(7424k) used = 0(0k) committed = 7602176(7424k) max = 7602176(7424k) info 02:24:15,263 cms old gen heap memory: init = 232783872(227328k) used = 0(0k) committed = 232783872(227328k) max = 233832448(228352k) info 02:24:15,263 cms perm gen non-heap memory: init = 21757952(21248k) used = 14299016(13963k) committed = 21757952(21248k) max = 85983232(83968k) info 02:24:15,271 classpath: /etc/cassandra/conf:/usr/share/cassandra/lib/antlr-3.2.jar:/usr/share/cassandra/lib/apache-cassandra-2.0.8.jar:/usr/share/cassandra/lib/apache-cassandra-clientutil-2.0.8.jar:/usr/share/cassandra/lib/apache-cassandra-thrift-2.0.8.jar:/usr/share/cassandra/lib/commons-cli-1.1.jar:/usr/share/cassandra/lib/commons-codec-1.2.jar:/usr/share/cassandra/lib/commons-lang3-3.1.jar:/usr/share/cassandra/lib/compress-lzf-0.8.4.jar:/usr/share/cassandra/lib/concurrentlinkedhashmap-lru-1.3.jar:/usr/share/cassandra/lib/disruptor-3.0.1.jar:/usr/share/cassandra/lib/guava-15.0.jar:/usr/share/cassandra/lib/high-scale-lib-1.1.2.jar:/usr/share/cassandra/lib/jackson-core-asl-1.9.2.jar:/usr/share/cassandra/lib/jackson-mapper-asl-1.9.2.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar:/usr/share/cassandra/lib/jbcrypt-0.3m.jar:/usr/share/cassandra/lib/jline-1.0.jar:/usr/share/cassandra/lib/jna.jar:/usr/share/cassandra/lib/json-simple-1.1.jar:/usr/share/cassandra/lib/libthrift-0.9.1.jar:/usr/share/cassandra/lib/log4j-1.2.16.jar:/usr/share/cassandra/lib/lz4-1.2.0.jar:/usr/share/cassandra/lib/metrics-core-2.2.0.jar:/usr/share/cassandra/lib/netty-3.6.6.final.jar:/usr/share/cassandra/lib/reporter-config-2.1.0.jar:/usr/share/cassandra/lib/servlet-api-2.5-20081211.jar:/usr/share/cassandra/lib/slf4j-api-1.7.2.jar:/usr/share/cassandra/lib/slf4j-log4j12-1.7.2.jar:/usr/share/cassandra/lib/snakeyaml-1.11.jar:/usr/share/cassandra/lib/snappy-java-1.0.5.jar:/usr/share/cassandra/lib/snaptree-0.1.jar:/usr/share/cassandra/lib/stress.jar:/usr/share/cassandra/lib/super-csv-2.1.0.jar:/usr/share/cassandra/lib/thrift-server-internal-only-0.3.3.jar:/usr/share/cassandra/lib/jamm-0.2.5.jar killed

i tried setting ip address in /etc/hosts file reviewing /etc/cassandra/conf/cassandra.yaml file. seems normal.

amazon-ec2 cassandra centos

add custom section in admin sales order view in Magento -



add custom section in admin sales order view in Magento -

i stuck in custom code. want add together custom info section on sales order view page in admin business relationship information', 'billing address', 'shipping address'. don't want edit core file phtml, xml etc.

here attaching screen-shot more clear me.

please help me resolve issue.

thanks in advance!

magento order

python - Getting the unicode characters of a string -



python - Getting the unicode characters of a string -

i'm getting string qt widget, , i'm trying convert non ascii characters (eg. €) hex unicode characters (eg. x20ac)

currently i'm doing see unicode character this:

currenttext = self.rich_text_edit.toplaintext() # string € symbol print("unicode char is: {0}".format(unicode_text))

this provides me error:

unicodeencodeerror: 'ascii' codec can't encode character u'\u20ac' in position 0: ordinal not in range(128)

that's want, right there, 20ac.

how @ that?

if this:

unicode_text = str(unicode_text).encode('string_escape') print unicode_text #returns \xe2\x82\xac

it returns 3 characters, of them wrong, i'm going round in circles :)

i know it's basic question, i've never had worry unicode before.

many in advance, ian

\xe2\x82\xac utf-8 encoding of unicode \x20ac.

think of follows, unicode 1 1 mapping between integer number , character similar ascii, except unicode goes much much higher in number of integer character mappings.

your symbol has integer value of 8364 (or \x20ac in hex), far big fit 8-bit value of 256 - , \x20ac broken downwards 3 individual bytes of \xe2\x82\xac. high level overview, i'd recommend take @ first-class explanation scott hanselman:

why #askobama tweet garbled on screen.

as question, can

>>> print "unicode code point is: {0}".format(hex(ord(unicode_text))) unicode code point is: 0x20ac

python unicode pyside

jquery ui resizable on click of buttons -



jquery ui resizable on click of buttons -

i trying resizable command on click of button.

i have used resizable plugin in jquery ui resize image.

but need image increment or descrese size using plus , minus buttons.

do know how it??

i don't think want utilize jquery ui this. provides standard set of features end-user interact with. if want mess height , width of div, straight this...

<div id="less" class="button">-</div> <div id="more" class="button">+</div> <div class="box"></div> $("#more").click(function() { var h = $('.box').height(); h = h + 20; $('.box').css({height: h, width: h}); }); $("#less").click(function() { var h = $('.box').height(); h = h - 20; $('.box').css({height: h, width: h}); });

working fiddle here... http://jsfiddle.net/tuwv2/

jquery jquery-ui

pyramid - Syntax error in a Python library, and I'm not sure how to proceed -



pyramid - Syntax error in a Python library, and I'm not sure how to proceed -

i'm using pyramid 1.5.1 , python 3.2, , added quite bit of code , couple libraries project.

on running development.ini, i'm getting error below.

if had take wild guess, particular library (looks markupsafe?) isn't compatible python3...but project page seems indicate is. problem is, i'm not calling library directly, it's beingness used library hard replace.

i'm new python programming, , wondering options here or best way debug is?

(finance-env)user1@finance1:/var/www/finance/corefinance/corefinance$ /var/www/finance/finance-env/bin/pserve /var/www/finance/corefinance/development.ini --reload starting subprocess file monitor traceback (most recent phone call last): file "/var/www/finance/finance-env/bin/pserve", line 9, in <module> load_entry_point('pyramid==1.5.1', 'console_scripts', 'pserve')() file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 51, in main homecoming command.run() file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 316, in run global_conf=vars) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/scripts/pserve.py", line 340, in loadapp homecoming loadapp(app_spec, name=name, relative_to=relative_to, **kw) file "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp homecoming loadobj(app, uri, name=name, **kw) file "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj homecoming context.create() file "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 710, in create homecoming self.object_type.invoke(self) file "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke homecoming fix_call(context.object, context.global_conf, **context.local_conf) file "/var/www/finance/finance-env/lib/python3.2/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(*args, **kw) file "/var/www/finance/corefinance/corefinance/__init__.py", line 35, in main session_factory=session_factory file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 301, in __init__ exceptionresponse_view=exceptionresponse_view, file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 412, in setup_registry self.include(inc) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 755, in include c(configurator) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid_debugtoolbar-2.1-py3.2.egg/pyramid_debugtoolbar/__init__.py", line 113, in includeme config.include('pyramid_mako') file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 727, in include c = self.maybe_dotted(callable) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/config/__init__.py", line 825, in maybe_dotted homecoming self.name_resolver.maybe_resolve(dotted) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/path.py", line 320, in maybe_resolve homecoming self._resolve(dotted, package) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/path.py", line 327, in _resolve homecoming self._zope_dottedname_style(dotted, package) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid/path.py", line 370, in _zope_dottedname_style found = __import__(used) file "/var/www/finance/finance-env/lib/python3.2/site-packages/pyramid_mako-1.0.2-py3.2.egg/pyramid_mako/__init__.py", line 18, in <module> mako.lookup import templatelookup file "/var/www/finance/finance-env/lib/python3.2/site-packages/mako-1.0.0-py3.2.egg/mako/lookup.py", line 9, in <module> mako.template import template file "/var/www/finance/finance-env/lib/python3.2/site-packages/mako-1.0.0-py3.2.egg/mako/template.py", line 10, in <module> mako.lexer import lexer file "/var/www/finance/finance-env/lib/python3.2/site-packages/mako-1.0.0-py3.2.egg/mako/lexer.py", line 11, in <module> mako import parsetree, exceptions, compat file "/var/www/finance/finance-env/lib/python3.2/site-packages/mako-1.0.0-py3.2.egg/mako/parsetree.py", line 9, in <module> mako import exceptions, ast, util, filters, compat file "/var/www/finance/finance-env/lib/python3.2/site-packages/mako-1.0.0-py3.2.egg/mako/filters.py", line 38, in <module> import markupsafe file "/var/www/finance/finance-env/lib/python3.2/site-packages/markupsafe-0.23-py3.2-linux-x86_64.egg/markupsafe/__init__.py", line 70 def __new__(cls, base=u'', encoding=none, errors='strict'): ^ syntaxerror: invalid syntax

the markupsafe bundle uses syntax supported python 3.3 , up. python 3.2 not supported anymore of version 0.16.

the u'unicode' literal syntax introduced in pep 414 create easier create library code can back upwards both python 2 , 3.

either upgrade python 3.3 (or 3.4 even), or downgrade markupsafe 0.15, lastly version back upwards python 3.2.

i see mako removes markupsafe dependency when using python 3.2; if nil else depends on perhaps safe remove bundle altogether. mako.filter source code fall local implementation if bundle not installed.

python pyramid

javascript - inspecting jquery in chrome -



javascript - inspecting jquery in chrome -

getting head around inspecting jquery/javascript in browser (chrome)

i can see can inspect attached scripts source tab, wondering scripts sat on actual page hardcoded in - can inspect same in source tab somehow ? in inspect variable values, step in etc.

thanks

you can inspect inline scripts in source tab in same way. navigate html file , can view source , place breakpoints usual.

for example, see inline source script used create exploding canvas video!

http://i.stack.imgur.com/3uytg.jpg

javascript jquery google-chrome

jquery - Checking HTML 5 validation is successful or not -



jquery - Checking HTML 5 validation is successful or not -

i need check whether html 5 native validation successful or not. based on need phone call ajax function.

an illustration code here. http://jsfiddle.net/indiscover/4pbcp/

also providing illustration code below.

<!doctype html> <html> <head> <title>jquery ui dialog: open dialog on clicksssssssssss</title> <link rel="stylesheet" href="../css/jquery-ui.css" /> <link rel="stylesheet" href="../css/style.css" /> <script type="text/javascript" src="../scripts/jquery.js"></script> <script type="text/javascript" src="../scripts/jquery-ui.js"></script> <script type="text/javascript" src="../scripts/jquery.validate.js"></script> <script type="text/javascript"> $(function(){ $("#pop_submit").click(function() { alert("am here"); //return false; }); }); </script> </head> <body> <div id="popup" style="display:block"> <form action="" name="pop_up_form" id="pop_up_form" method="post"> <input class="pop_up_textbox" type="text" name="acct_nmbr" id="acct_nmbr" required maxlength="19" value=""/> <input type="submit" name="pop_submit" id="pop_submit" style="display:block;" /> </form> </div> </body> </html>

here in jquery code have set alert while submitting button. need show alert after successful html 5 native validation. if 1 can point me out how can accomplish can phone call ajax function instead of alert message after successful html 5 native validation.

i know can utilize jquery validator validate form using valid() method don't wanna go in way. need know whether html 5 native validation successful , if need logic.

the checkvalidity() method (part of html5 validation api) should need. tutorial helpful in explaining native html5 form validation methods: http://www.html5rocks.com/en/tutorials/forms/constraintvalidation/.

jquery html5 jquery-ui

java - LinkedBlockingQueue program does not terminate -



java - LinkedBlockingQueue program does not terminate -

if run next program, jvm not terminate after execution. however, if uncomment line (// newfixedthreadpool.execute(new producer3());) code, programme terminates after execution. aware because of blocking nature of queue programme not terminate. in context of below code part of code blocks termination of jvm?

public class linkedblockingqueueexample { public static void main(string[] args) { final blockingqueue<string> blockingqueue = new linkedblockingqueue<string>(5); final class producer implements runnable { @override public void run() { seek { blockingqueue.put("joshua"); blockingqueue.put("bloch"); system.out.println("put joshua in queue"); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } } } final class producer1 implements runnable { @override public void run() { seek { blockingqueue.put("martin"); blockingqueue.put("fowler"); system.out.println("put mr fowler in queue"); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } } } final class producer3 implements runnable { @override public void run() { seek { blockingqueue.put("malcom"); blockingqueue.put("gladwell"); system.out.println("put outlier in queue"); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } } } final class consumer implements runnable { @override public void run() { seek { system.out.println(getclass() + " " + blockingqueue.take()); system.out.println(getclass() + " " + blockingqueue.take()); system.out.println(getclass() + " " + blockingqueue.take()); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } } } final class consumer1 implements runnable { @override public void run() { seek { system.out.println(getclass() + " " + blockingqueue.take()); system.out.println(getclass() + " " + blockingqueue.take()); system.out.println(getclass() + " " + blockingqueue.take()); } grab (interruptedexception e) { // todo auto-generated grab block e.printstacktrace(); } } } executorservice newfixedthreadpool = executors.newfixedthreadpool(5); newfixedthreadpool.execute(new producer()); newfixedthreadpool.execute(new producer1()); // newfixedthreadpool.execute(new producer3()); newfixedthreadpool.execute(new consumer()); newfixedthreadpool.execute(new consumer1()); newfixedthreadpool.shutdown(); } }

take() phone call blocking till elements become available.. if don't want block user poll()

poll() retrieves , removes head of queue, or returns null if queue empty.

reference : http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/linkedblockingqueue.html#poll()

java collections blockingqueue

Passing an image from C++ to Python 3.4 -



Passing an image from C++ to Python 3.4 -

i using python interpreter embedded in c++ programme generate reports. part of report, python script grabs image info c++ programme , building pil image follows:

width = getimagewidth () height = getimageheight () pixels = getimagepixels () piltile = image.frombuffer ('rgb', (width, height), pixels, 'raw', 'rgb', 0, -1)

on c++ side of things, i've been returning image pixels buffer using boost.python:

object getimagepixels () { glubyte *buf = getimage () ; size_t size = getsize () ; object obj = object ((handle<>(borrowed (pybuffer_frommemory ( (char *) buf, size, pybuf_read))))) ; homecoming obj ; }

the problem is, python 3.x eliminates pybuffer_frommemory interface. i've tried replacing pymemoryview_frommemory, pil doesn't seem able utilize memoryviews.

what best way replace pybuffer_frommemory here?

thanks help!

python python-3.x python-imaging-library boost-python

ibm midrange - IBM i RPG Code to procedure -



ibm midrange - IBM i RPG Code to procedure -

i looking @ rpg program. there subroutines this: there tools create procedure, used in separate process?

c eval finqty# = 0 c eval odcom# = ohcom# c eval odord# = ohord# c odkey setll oeord1 c odkey reade oeord1 c dow %eof = *off * c if odprt# = odals# , c %subst(odprt#:1:3) <> 'frt' c eval finqty# += odqty# c endif * c odkey reade oeord1 c enddo *

yes

i'm particularly fond of linoma's rpg wizard http://www.linomasoftware.com/products/rpgtoolbox/rpgwizard

arcad has tool, has more functionality , more $$$. http://www.arcadsoftware.com/products/arcad-transformer-ibm-i-refactoring-tools/

note linoma convert syntax internal subroutine internal procedure; it'd manual process move procedure externally.

whereas believe arcard's toolset can build external procedure.

ibm-midrange db2400 rpgle

java - Return Statements in a Finite State Machine -



java - Return Statements in a Finite State Machine -

could tell me purpose homecoming statement in finite state machine's state serves? illustration have code soccer player's state:

public class chaseball extends state<fieldplayer> { private static chaseball instance = new chaseball(); private chaseball() { } //this singleton public static chaseball instance() { homecoming instance; } @override public void enter(fieldplayer player) { player.steering().seekon(); } } @override public void execute(fieldplayer player) { //if ball within kicking range player changes state kickball. if (player.ballwithinkickingrange() && player.isreadyfornextkick()) { player.getfsm().changestate(kickball.instance()); return; } //if player closest player ball should maintain //chasing if (player.isclosestteammembertoball()) { player.steering().settarget(player.ball().pos()); return; } //if player not closest ball anymore, should homecoming //to home part , wait chance player.getfsm().changestate(returntohomeregion.instance()); } @override public void exit(fieldplayer player) { player.steering().seekoff(); } }

i wondering if explain purpose the homecoming keywords in first 2 if statements of execute() method serve? thanks

in case it's formatting alternative series of else if clauses. logically equivalent to

if (<condition>) { <code> } else if (<condition>) { <code> } else { <code> }

java return finite-state-machine

android - Regenerate Keystore from SHA1 fingerprint -



android - Regenerate Keystore from SHA1 fingerprint -

i've forgot password of 1 of keystore , couldn't update existing app. i've tried using brute-force method password without success. wondering if it's possible regenerate keystore, if have sha1 fingerprint?

i assume keystore consist of private keys , if have private keys can regenerate keystore different password.

ps: have keystore file, not keystore password. both keystore , alias password kept same.

the fingerprint derived key via one-way hashing algorithm. there no way reverse engineer key fingerprint (and thing, or got key fingerprint have key). if can't crack password (i have no advice on that) think you'll have generate new key. think problem you're trying avoid app installed have uninstall first in order install new version, don't think there's way around it.

android android-keystore

lisp - CLOS slot accessors: read but not write -



lisp - CLOS slot accessors: read but not write -

i have list of names of slots of clos object:

(defclass trial-data (standard-object) ((a-datum :accessor a-datum :initarg :a-datum :initform nil) (both-data :accessor both-data :initarg :both-data :initform 0) (cumulative-data :accessor cumulative-data :initarg :cumulative-data :initform nil) (name :accessor name :initarg :name :initform value))) (let* ((td (make-instance 'trial-data)) (slot-lst (mapcar #'slot-definition-name (class-slots (class-of td)))))

i can read values of these slots:

(let* ((td (make-instance 'trial-data)) (slot-lst (mapcar #'slot-definition-name (class-slots (class-of td))))) (funcall (symbol-function (nth 0 slot-lst)) td))

==> nil

but why can not write new values these slots? shouldn't class definition of trial-data have created accessor function each slot?

;; should set first slot, a-datum's, value 42 (let* ((td (make-instance 'trial-data)) (slot-lst (mapcar #'slot-definition-name (class-slots (class-of td))))) (setf (funcall (symbol-function (nth 0 slot-lst)) td) 42))

==>

;compiler warnings "/users/frank/documents/nrl/error/patrolbot/patrol construction notes & testing.lisp" : ; in anonymous lambda form @ position 123: undefined function (setf funcall) > error: undefined function (setf funcall) called arguments (42 #<standard-generic-function a-datum #x302001d1c5df> #<trial-data #x30200200d95d>) . > while executing: #<anonymous function #x30200200eb7f>, in process listener-2(5).

rainer joswigs's answer addresses issue of why can't set code have now. however, it's of import note there's no reason reader, writer, or accessor name has same slot name, if you've got slot name, should utilize (setf slot-value) it. e.g.,

(defclass foo () ((bar :accessor getbar :initform 42))) (defparameter *foo* (make-instance 'foo)) ;; neither of these work (setf (bar *foo*) 34) (funcall #'(setf bar) 34 *foo*) (slot-value *foo* 'bar) ;=> 42 (setf (slot-value *foo* 'bar) 36) ;=> 26 (slot-value *foo* 'bar) ;=> 36

lisp common-lisp accessor slot clos

javascript - what is difference between factory, service and provider? -



javascript - what is difference between factory, service and provider? -

first of want clear new angularjs. might find question duplicate angular.js: service vs provider vs factory? trying understand thing me confused. changing value in 1 controller affected in other controller well.

as per reply question service object created angular self still shared between controller.

angular js

var myapp = angular.module('demo', []); // mill implementation myapp.factory('myfactory', function () { var service = {}; service.testdata = 'this default info factory'; homecoming service; }); // service implementation myapp.service('myservice', function () { this.testdata = 'this service'; }); // first controller myapp.controller('myfirstcontroller', function ($scope, myfactory, myservice,myprovider) { $scope.providerdata = myprovider; $scope.mydata = myfactory; $scope.servicedata = myservice; $scope.testfun = function () { $scope.mydata.testdata = 'this new info factory'; $scope.servicedata.testdata = 'new service data'; $scope.providerdata.thingonconfig = 'new thing first controller'; } }); // sec controller myapp.controller('mysecondcontroller', function ($scope, myfactory, myservice,myprovider) { $scope.providerdata = myprovider; $scope.mydata = myfactory; $scope.servicedata = myservice; }); myapp.provider('myprovider', function () { this.testdata = 'this provider'; this.$get = function () { var = this; homecoming { thingonconfig: that.testdata } } }); myapp.config(function (myproviderprovider) { myproviderprovider.testdata = 'this new config of provider'; });

html

<div class="row" ng-app="demo" ng-cloak> <div class="row" ng-controller="myfirstcontroller"> <div class="row"> {{mydata.testdata}} <br /> {{servicedata.testdata}} <br /> {{providerdata.thingonconfig}} </div> <div class="row"> <input type="button" value='click here update' ng-click="testfun()" /> </div> </div> <div class="row" ng-controller="mysecondcontroller"> <div class="row"> {{mydata.testdata}} <br /> {{servicedata.testdata}} <br /> {{providerdata.thingonconfig}} </div> </div> </div>

fiddle link: http://jsfiddle.net/8cg2s/

why there 3 diffrent terminolology identical thing? if there vital difference that?

the fiddle demonstrates expected behaviour. don't understand confuses you.

regarding question: "why there diffrent terminolology 3 identical things ?"

if used exact same name 3 identical things, how distinguish between them ? reasonable utilize differnt names different things (even if similar).

i suppose real question not "why different terminology", "why have 3 different functions (factory, service, provider) same purpose (declaring angular service)".

you might dissapointed larn there not 3 5 ways declare angular service: constant , value 2 missing functions.

in fact there 1 concept, angular service, , 1 way declare one: provider.

anything achieved other 4 functions (constant, factory, service, value) can achieved provider, more code. provider flexible (allowing configurability), verbose. thus, other 4 functions shortcuts commonly used types of angular services.

btw, quite explained in the docs:

factory [...] short registering service provider consists of $get property, given service mill function.

service [...] short registering service provider's $get property service constructor function used instantiate service instance.

etc

javascript angularjs

BeanCreationException error happend on spring when I try to seperate the springMVC context with the root context bean scan -



BeanCreationException error happend on spring when I try to seperate the springMVC context with the root context bean scan -

i define 2 spring context files application, springmvc-config.xml springmvc , han-config.xml root application context. want utilize springmvc-config.xml scan @controller beans , han-config.xml scan @component, @repository, , @service beans

my problem if utilize <context:component-scan base-package="com.leo.han" / > in springmvc-config.xml application run , no errors during deployment. if want utilize <context:component-scan base-package="com.leo.han.controllers" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.stereotype.controller" /> </context:component-scan> in springmvc-config.xml scan controllers , utilize <context:component-scan base-package="com.leo.han" use-default-filters="false"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.controller" /> </context:component-scan> in han-config.xml scan @component, @repository, , @service beans recommended approach in spring forum. terrible errors org.springframework.beans.factory.beancreationexception: error creating bean name 'logincontroller': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.leo.han.services.userservice com.leo.han.controllers.logincontroller.userservice; nested exception org.springframework.beans.factory.nosuchbeandefinitionexception: no qualifying bean of type [com.leo.han.services.userservice] found dependency: expected @ to the lowest degree 1 bean qualifies autowire candidate dependency. dependency annotations: {@org.springframework.beans.factory.annotation.autowired(required=true)} seems userservice bean never created reason can help me on bundle construction is: com.leo.han.controllers (all controllers annotated @controller) com.leo.han.services (all service annotated @service) com.leo.han.dao (all das annotated @repository) here sample code @controller public class logincontroller { @autowired private userservice userservice; @requestmapping(value = "/login", method = requestmethod.get) public string showlogin() { homecoming "login"; } @requestmapping(value = "/newaccount", method = requestmethod.post) public string newaccountpost(model model, user user) throws exception { user.setenabled(true); user.setauthority("app_view"); userservice.adduser(user); homecoming "accountcreated"; } } @service("userservice") public class userservice { @autowired private userdao userdao; public list<user> getallusers() { homecoming userdao.searchall(); } public void adduser(user user) { userdao.createuser(user); } public boolean isuserexist(user user) { homecoming userdao.isuserexist(user); } } web.xml <context-param> <param-name>contextconfiglocation</param-name> <param-value> /web-inf/config/han-config.xml </param-value> </context-param> <filter> <display-name>springsecurityfilterchain</display-name> <filter-name>springsecurityfilterchain</filter-name> <filter-class>org.springframework.web.filter.delegatingfilterproxy</filter-class> </filter> <filter-mapping> <filter-name>springsecurityfilterchain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/config/springmvc-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>springmvc</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> springmvc-config.xml (springmvc context config file) <context:component-scan base-package="com.leo.han.controllers" /> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:annotation-driven></mvc:annotation-driven> <bean id="viewresolver" class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix"> <value>/web-inf/jsps/</value> </property> <property name="suffix"> <value>.jsp</value> </property> <property name="order" value="1"></property> </bean> <bean id="viewtileresolver" class="org.springframework.web.servlet.view.tiles2.tilesviewresolver"> <property name="order" value="0"></property> </bean> <bean class="org.springframework.web.servlet.view.tiles2.tilesconfigurer" id="tilesconfigurer"> <property name="definitions"> <list> <value>/web-inf/layouts/layout.xml</value> </list> </property> </bean> <bean id="messagesource" class="org.springframework.context.support.reloadableresourcebundlemessagesource"> <property name="basename" value="classpath:i18n/message" /> <property name="defaultencoding" value="utf-8" /> </bean> <bean id="localeresolver" class="org.springframework.web.servlet.i18n.sessionlocaleresolver"> <property name="defaultlocale" value="en"></property> </bean> <mvc:interceptors> <bean class="org.springframework.web.servlet.i18n.localechangeinterceptor"> <property name="paramname" value="language"></property> </bean> </mvc:interceptors> han-config.xml (my root applicationcontext file) <context:component-scan base-package="com.leo.han" use-default-filters="false"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.controller" /> </context:component-scan> <import resource="persistence-config.xml" /> <import resource="security-config.xml" /> please help, have search around here 2 days in order find solution case, solution seems not work case. give thanks

i using similar configuration base of operations bundle same "a.b" in both cases , 1 contains exclusion controllers ( root context) , other consists of inclusion ( mvc context) , works fine. can seek that.

now you'd love spring - if want programmatically determine candidate beans in classpath base of operations package, can write simple test programme below list candidate components.

public class testcomponentscanner { public static void main(string[] args) { classpathscanningcandidatecomponentprovider provider = new classpathscanningcandidatecomponentprovider(true); string basepackage = "com/leo"; provider.addexcludefilter(new annotationtypefilter(controller.class, true)); set<beandefinition> filteredcomponents = provider.findcandidatecomponents(basepackage); system.out.println("no of components :"+filteredcomponents.size()); (beandefinition component : filteredcomponents) { system.out.println("component:"+ component.getbeanclassname()); } provider.resetfilters(true); provider.addincludefilter(new annotationtypefilter(controller.class, true)); filteredcomponents = provider.findcandidatecomponents(basepackage); system.out.println("no of components :"+filteredcomponents.size()); (beandefinition component : filteredcomponents) { system.out.println("component:"+ component.getbeanclassname()); } }

spring-mvc

php - Who creates a session and how does cookie and any role in it? -



php - Who creates a session and how does cookie and any role in it? -

who creates session , how cookie , role in it? asked question in company's interview process , didn't know answer. to know side creates sessions i.e whether client side or server side , cookie has role in it.

also how server understands session provided client , user of client if multiple users logged in?

what’s difference between cookie , session in php?

php sessions improve upon cookies because allow web applications store , retrieve more info cookies. php sessions utilize cookies, add together more functionality , security.

sessions store info on server, not on browser cookies

the main difference between session , cookie session info stored on server, whereas cookies store info in visitor’s browser. sessions utilize session identifier locate particular user’s session data. session identifier stored in user’s web browser in cookie, sensitive info needs more secure — user’s id, name, etc. — remain on server.

sessions more secure cookies

so, why should utilize sessions when cookies work fine? well, mentioned, sessions more secure because relevant info stored on server , not sent , forth between client , server. sec reason users either turn off cookies or reject them. in scenario, sessions, while designed work cookie, can work without cookies workaround, can read here: can php sessions work without cookies?.

sessions need space, unlike cookies

php sessions, unlike cookies stored on user’s browser, need temporary directory on server php can store session data. servers running unix isn’t problem @ all, because /tmp directory meant used things this. but, if server running windows , version of php before 4.3.6, server need configured – here do: create new folder on windows server – can phone call c:\temp. want sure every user can read , write folder. then, need edit php.ini file, , set value of session.save_path point folder created on windows server (in case, folder under c:\temp). , finally, need restart web server changes in php.ini file take effect.

sessions must utilize session_start function

a of import thing remember when using sessions each page utilize session must begin calling session_start() function. session_start() function tells php either start brand new session or access existing one.

how session_start in php uses cookies

the first time session_start() function used, seek send cookie name of phpsessid , value of looks a30f8670baa8e10a44c878df89a2044b – session identifier contains 32 hexadecimal letters. because cookies must sent before info sent browser, means session_start must called before info sent web browser.

link-1

link-2

link-3

link-4

php session cookies