copying a list to a new list More efficient Best Practice Ask Question 4 What is the appropriate way of copying a list to a new list And What is the most efficient way of copying a list to a new list By efficient not code efficiency more in the behind the scenes framework sense List String List2 List ToList Or List String List2 new List String foreach string item in List List2 Add item Update What about more efficient IL code c improve this question asked Jul 10 13 at 1315 webdad3 4170 23 97 191 2 Well your first example needlessly initializes List2 then throws that initialization away It should be just ListString List2 ListToList Chris Sinclair Jul 10 13 at 1321 Why do you not write a test and share the result with us Peter Jul 10 13 at 1324 4 Honestly the performance difference between the two is going to be so small I doubt you will notice Do with whichever one makes your code easier to read cadrell0 Jul 10 13 at 1326 3 How big is your list How often is it copied per second Anything but extreme answers to those questions means that the difference between any of the given answers is trivial If you do have extreme answers for either of those you may want to consider a different design or container other than ListT EDIT the only modification I might suggest would be to presupply the list size in your second example to avoid array resizing but again only really has a measurable effect for lists of relatively large size or massively frequently copying Chris Sinclair Jul 10 13 at 1328 6 Answers oldest 6 What ToList does shortened public static List TSource ToList TSource this IEnumerable TSource source return new List TSource source What List ctor does shortened public List IEnumerable T collection ICollection T collection2 collection as ICollection T int count collection2 Count this _items new T count collection2 CopyTo this _items 0 this _size count So the ToList is much more efficient it does allocate the space first and then copy all items in one step answered Jul 10 13 at 1324 Ondrej Svejdar 152k 3 37 62 Because it already allocates the new list in size to hold all items While the second approach puts them one by one ListT isnt dynamic once there are more items that its capacity its being reallocated which is costly operation Ondrej Svejdar 1 actually my bad I thought you were comparing ToList and the ctor here but youre not Sorry MooJuice Jul 10 13 at 1330 13 Given that ListT has an IEnumerableT constructor I would prefer this form List string newList new List string otherList And as Ondrej points out in the decompiled code below the constructor of ListT preallocates the size of the array and copies the contents over This is going to be much quicker than creating a new list and then iterating over the other list adding items individually especially as in your 2nd example youre not specifying how many items to preallocate edited Sep 18 17 at 1057 David Leon 746 6 19 answered Jul 10 13 at 1321 MooJuice 32k 8 58 114 1 If you look at the decompiled source that is what ToList does cadrell0 Jul 10 13 at 1323 Why is this the best performance webdad3 Jul 10 13 at 1323 I guess its because you dont need to iterate through the content jAC Jul 10 13 at 1323 Out of performance does this constructor automatically initialize the new List to be of the proper length or does it do the dynamic resizing as it transfers elements over Chris Sinclair Jul 10 13 at 1326 1 Casperah in the List constructor it casts the IEnumerableT to an ICollectionT and thereby knows the size ahead of time MooJuice Jul 10 13 at 1334 show 5 more comments 5 You can use ListT constructor that takes IEnumerableT List string list1 new List string fill list1 List string list2 new List string list1 answered Jul 10 13 at 1322 oleksii 276k 8 64 128 If you look at the decompiled source that is what ToList does cadrell0 Jul 10 13 at 1323 You dont want to look at decompiled code all the time do you I think this is what people would use for readability purpose oleksii Jul 10 13 at 1324 In this particular case I am looking beyond code readability webdad3 Jul 10 13 at 1327 oleksii But ToList seems quite straightforward I think all cadrell0 is saying is that in terms of efficiency there will be no difference given that ToList is doing the same thing you are Mansfield Jul 10 13 at 1327 2 In terms of efficiency the first is going to be faster ListT s underlying implementation is an ArrayList so theres a chance youll have to resize the underlying array when you call Add On the other hand ToList can determine the correct initial size of the new List and avoid the reallocation operation that the foreach technique suffers from With this in mind Id recommend ToList Less code and it will be faster Heres a simple program you can run to verify that ToList is indeed faster void Main List int items new List int items Enumerable Range 0 1000000 ToList CopyWithToList items CopyWithForeach items public void CopyWithToList T List T list var sw Stopwatch StartNew List T copy list ToList sw Stop Console WriteLine CopyWithToList 0 sw Elapsed public void CopyWithForeach T List T list var sw Stopwatch StartNew List T copy new List T foreach T item in list copy Add item sw Stop Console WriteLine CopyWithForeach 0 sw Elapsed edited Jul 10 13 at 1331 answered Jul 10 13 at 1324 Andrew Whitaker 107k 24 245 270 Even if you supply the list with initial size to preallocate it still slower I suspect that really comes from the fact that the constructor call which ToList uses essentially performs an array copy whereas the foreach performs all the additional overhead of checking of the collection changed grabbing the iterator iterating checking when calling Add if the underlying array is long enough etc Chris Sinclair Jul 10 13 at 1338 1 I believe that the two examples are identical the ToList implements probably the later The best performance would be something like this List String list2 new List String list Count foreach String item in list list2 Add item The important part is to create list2 with enough capacity to hold its content If you dont need to modify the either list afterwards the a reference copy is all you need List String list2 list answered Jul 10 13 at 1320 Casperah 3821 13 13 There are better ways to achieve this James Johnson Jul 10 13 at 1322 Why is this the best performance webdad3 Jul 10 13 at 1323 It is important to allocate enough space for the list by specifying a capacity in its constructor This way the list does not need to reallocate the list while adding items Casperah Jul 10 13 at 1329 1 Tests shows that the best perfomance have the ToList method for a list with 21474836 elements it runs in about 48 ms on a laptop Core i5 CPU Every other method is slower and the method using Add is the worst while talking about perfomance Here is some test code class Program static void Main var list new List int for int i 0 i int MaxValue 100 i list Add i TimeItAccurate ListCopy_1 list 10 TimeItAccurate ListCopy_2 list 10 TimeItAccurate ListCopy_3 list 10 TimeItAccurate ListCopy_4 list 10 TimeItAccurate ListCopy_5 list 10 private static List int ListCopy_1 List int list var newList list ToList return newList private static List int ListCopy_2 List int list var newList new List int list Count foreach var i in list newList Add i return newList private static List int ListCopy_3 List int list var newList new List int list ToArray return newList private static List int ListCopy_4 List int list var newList new List int list Count newList AddRange list return newList private static List int ListCopy_5 List int list var newList new List int list return newList public static void TimeItAccurate TIn TResult Func TIn TResult func TIn argument int iterationsCount region Preheat for int i 0 i 10 i var t func Invoke argument endregion var stopwatch new Stopwatch var result default TResult stopwatch Start for int i 0 i iterationsCount i result func Invoke argument stopwatch Stop Console WriteLine Resultn4 0nn1 iterations done in 2 msnAverage time 3f5 ms result iterationsCount stopwatch ElapsedMilliseconds stopwatch ElapsedMilliseconds double iterationsCount func Method Name And the results Result ToList ListCopy_1 System Collections Generic List 1 System Int32 10 iterations done in 474 ms Average time 4740000 ms Result for cycle with Add ListCopy_2 System Collections Generic List 1 System Int32 10 iterations done in 1896 ms Average time 18960000 ms Result ctor with ToArray ListCopy_3 System Collections Generic List 1 System Int32 10 iterations done in 981 ms Average time 9810000 ms Result AddRange ListCopy_4 System Collections Generic List 1 System Int32 10 iterations done in 959 ms Average time 9590000 ms Result new List int list ListCopy_5 System Collections Generic List 1 System Int32 10 iterations done in 480 ms Average time 4800000 ms edited Jul 10 13 at 1541 answered Jul 10 13 at 1349 utter_step 344 4 14 Your 3rd test is flawed Why are you calling ToArray just pass the list directly MooJuice Jul 10 13 at 1352 Just passing the list will be just the same as we know from this answer I just wanted to show some range of variants how to do that copy operation utter_step Jul 10 13 at 1355 then perhaps you can consider adding a straight to ctor as a 5th test for completeness MooJuice Jul 10 13 at 1446 That would be sensible thank you for advice utter_step Jul 10 13 at 1453 I wonder why ToList averages out as a second faster when it itself uses the ctor version inside MooJuice Jul 10 13 at 1500 show 3 more comments Not the answer youre looking for Browse other questions tagged c or ask your own question asked 5 years 6 months ago viewed 2973 times active 1 year 3 months ago Blog Adios to Winter Bash 2018 Hot Network Questions Why have all negatives been exposed to one frame Preparing in case ATMdebit cards might go missing during a long trip Why is angle of incidence equal to angle of reflection The magical map how to stop it being too powerful Explanation needed on how I can repeat a character in POSIX shell Repair tiny holescratch in copper pipe Theorem 58 Baby Rudin Some questions Reviewer signs name on review Should the editor censor Using Tweets as a Random seed Why would a previously spacefaring civilization become unable to build another interstellar ship Scifi short story about overpopulation time travel and battle of the sexes Do all songs have to be in a major or minor scale Can a song have random notes that dont belong to any major or minor scale draw two boxes on a slanted plane in a mechanical illustration How close could another solar system be without adversely affecting our own Examples of words that are monomorphemic in English but polymorphemic in other languages Does the Absorb Elements spell combine with a sorcerers Distant Spell metamagic option Word for Significant enough to make a difference What kind of tool will loosen this nut holding a chainwheel on a one piece crank Thevenin Equivalent Voltage why ignore the 3kΩ resistor How could a planet have a sky without stars at night People in a rollercoaster or falling elevator feel the rapid descent so why dont pilots in the cockpit Chebyshevs biasconjecture and the Riemann Hypothesis Quote at the beginning of a chapter is it advisable for fiction novels Is this projected return from Wealthify too low question feed

B O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


multi core and parallel processing Ask Question 1 3 what is the difference between parallel processing and multi core processing cpu improve this question asked Dec 17 09 at 1521 ikram ul haq 6 1 1 2 3 Answers active oldest votes 7 Parallel and multicore processing both refer to the same thing the ability to execute code at the same time in more than one coreCPUmachine So in this sense multicore is just a means to do parallel processing On the other hand concurrency which is probably what you mean by parallel processing refers to having multiple units of execution threads or processes that are interleaved This can also happen in either in a single core CPU or in many coresCPUs or even in many machines clusters Summing up multicore is a subset of parallel and concurrency can occur with or without parallelism The field that studies this is distributed systems or distributed computing edited Mar 19 12 at 001 answered Dec 17 09 at 1525 Vinko Vrsalovic 203k 43 297 347 2 Actually Concurrency is when you have multiple threads of execution that are interleaved NOT parallelism One of the misconceptions about concurrency is people often confuse concurrency and parallelism Concurrency is a programming model that lets you express things that are independent as independent executions and parallelism is about running two things at the same time They are not the same idea and a lot of people confuse them they think they are the same thing but concurrency and parallelism are best thought of as a different idea Rob Pike Wes Mar 18 12 at 2046 Yes I remember thinking about this when I was learning threading back in the days where CPUs where single core and machines with multiple CPUs were rare and thus the divergence between concurrency and parallelism more evident Vinko Vrsalovic Mar 18 12 at 2354 Yes the two concepts have become blurred due to multicore CPUs Wes Mar 19 12 at 053 4 Parallel processing just refers to a program running more than 1 part simultaneously usually with the different parts communicating in some way This might be on multiple cores multiple threads on one core which is really simulated parallel processing multiple CPUs or even multiple machines Multicore processing is usually a subset of parallel processing Multicore processing means code working on more than one core of a single CPU chip A core is like a little processor within a processor So making code work for multicore processing will nearly always be talking about the parallelization aspect though would also include removing any core specific assumptions which you shouldnt normally have anyway As far as an algorithm design goes if it is correct in a parallel processing point of view it will be correct multicore However if you need to optimise your code to get it to run as fast as possible in parallel then the differences between multicore multicpu multimachine or vectorised will make a big difference answered Dec 17 09 at 1532 Nick Fortescue 31k 23 93 128 Well said and all of this is a subset of the Distributed systems area of CS Vinko Vrsalovic Dec 17 09 at 1537 And Id say the difference between multicore and multicpu is very thin optimization wise if were talking about the same architecture Vinko Vrsalovic Dec 17 09 at 1540 True but there can be differences especially if you get down to cache size based optimisations which you occasionally do for example in intense crypto applications Nick Fortescue Dec 17 09 at 1544 3 Parallel processing can be done inside a single core with multiple threads MultiCore processing means distributing those threads to make use of the multiple cores in a CPU answered Dec 17 09 at 1524 Justin Niessner 208k 30 359 490 Strictly speaking isnt the single core multithreaded application still doing things in a sequence on the hardware level Matti Lyra Dec 17 09 at 1526 3 yes but the synchronization techniques used are the same techniques you would use if you had really many cores Vinko Vrsalovic Dec 17 09 at 1528 Not the answer youre looking for Browse other questions tagged cpu or ask your own question asked 9 years ago viewed 14203 times active 1 year 10 months ago 66 People Chatting SO Close Vote Reviewers 1 hour ago Michael Dodd PHP 1 hour ago Wes question feed

B I O B I O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Unable

to

import

praw

module

after

install

Ask

Question

Edit

Before

you

start

deletingmodifying

installs

please

glance

over

StvnWs

answersummary

to

make

sure

you

are

applying

the

solution

that

is

appropriate

for

you

Ive

installed

python

and

pip

edit

mac

OSX

Mountain

Lion

Ive

run

pip

install

praw

in

terminal

All

good

When

I

run

python

and

run

import

praw

I

get

python

Python

May

GCC

Apple

Inc

build

dot

on

darwin

Type

help

copyright

credits

or

license

for

more

information

import

praw

Traceback

most

recent

call

last

File

stdin

line

in

module

ImportError

No

module

named

praw

same

ImportError

from

a

script

when

I

install

praw

I

get

this

pip

install

praw

Downloading

unpacking

praw

Downloading

praw

gz

downloaded

Running

setup

py

for

package

praw

Requirement

already

satisfied

use

upgrade

to

upgrade

requests

in

usr

local

lib

site

packages

from

praw

Requirement

already

satisfied

use

upgrade

to

upgrade

six

in

usr

local

lib

site

packages

from

praw

Requirement

already

satisfied

use

upgrade

to

upgrade

update

checker

in

usr

local

lib

site

packages

from

praw

Requirement

already

satisfied

use

upgrade

to

upgrade

setuptools

in

usr

local

lib

site

packages

setuptools

from

update

checker

praw

Installing

collected

packages

praw

Running

setup

py

install

for

praw

Installing

praw

multiprocess

script

to

usr

local

bin

Successfully

installed

praw

Cleaning

up

In

python

if

I

run

helpmodules

it

isnt

there

Relatively

new

to

python

and

I

havent

been

able

to

sort

this

out

with

google

search

Any

hints

would

be

much

appreciated

Edit

SitRep

Ive

uninstalled

uninstalled

praw

and

uninstalled

homebrew

pip

I

ran

python

and

it

couldnt

find

the

module

as

you

would

suspect

I

then

reinstalled

pip

with

and

now

is

finding

praw

but

giving

this

error

python

Python

May

GCC

Apple

Inc

build

dot

on

darwin

Type

help

copyright

credits

or

license

for

more

information

import

praw

Traceback

most

recent

call

last

File

stdin

line

in

module

File

line

in

module

from

import

File

line

in

module

from

import

as

V

ImportError

No

module

named

Thanks

for

the

help

so

far

the

spurious

install

was

the

root

of

problem

The

solution

to

the

final

problem

can

be

found

here

No

module

named

I

wish

there

were

some

way

to

summarize

this

for

future

readers

but

Ive

done

so

many

things

that

I

no

longer

recall

what

addressed

what

I

basically

uninstalled

everything

python

praw

pip

reinstalled

from

httppythonorgdownload

reinstalled

pip

with

and

sudo

command

instead

of

homebrew

reinstalled

praw

with

sudo

command

and

followed

the

directions

for

the

subsequent

module

error

in

the

link

above

Hope

that

helps

python

improve

this

question

Community

asked

Oct

at

Dean

Solecki

wierd

If

it

is

windows

just

exit

and

repeat

it

again

dont

know

if

that

would

fix

the

issue

though

karthikr

Oct

at

How

did

you

install

pip

If

you

import

sys

print

syspath

is

included

Wooble

Oct

at

Not

quite

EditThese

are

the

only

references

to

sitepackages

Dean

Solecki

Oct

at

Answers

oldest

The

OS

X

system

versions

of

Python

live

in

SystemLibraryFrameworksPythonFrameworkverson

each

of

which

links

to

LibraryPythonversionsitepackages

Seems

like

you

have

installed

another

version

of

python

andor

pip

to

usrlocal

but

when

you

invoke

python

you

are

still

getting

the

system

version

Try

this

usr

local

bin

python

import

praw

Id

also

recommend

looking

into

tools

like

pyenv

and

virtualenv

if

you

are

going

to

do

any

amount

of

work

with

Python

Pyenv

lets

you

easily

manage

and

switch

between

multiple

versions

including

micro

versions

etc

Virtualenv

lets

you

create

isolated

Python

environments

where

you

can

pin

down

versions

of

sitepackages

specific

to

a

particular

project

Edit

summarizing

sudo

pip

will

install

pip

under

SystemLibraryPythonversion

Calling

that

pip

will

install

packages

to

LibraryPythonversionsitepackages

brew

install

python

will

install

a

second

version

of

python

including

pip

under

usrlocal

That

pip

will

put

packages

in

usrlocallibpythonversionsitepackages

One

version

may

not

see

packages

installed

to

the

other

which

python

and

which

pip

are

helpful

for

troubleshooting

Deans

final

solution

above

results

in

user

packages

being

installed

to

the

system

sitepackages

Despite

Deans

choice

to

update

the

system

Python

many

would

advocate

instead

using

brew

pyenv

and

virtualenv

to

isolate

oneself

from

the

system

Python

answered

Oct

at

StvnW

usrlocalbinpython

Python

May

GCC

Apple

Inc

build

dot

on

darwin

Type

help

copyright

credits

or

license

for

more

information

import

praw

Traceback

most

recent

call

last

File

stdin

line

in

module

File

line

in

module

from

import

File

line

in

module

from

import

as

V

ImportError

No

module

named

Dean

Solecki

Oct

at

Oh

it

didnt

respect

the

formatting

That

was

what

it

spit

out

I

reinstalled

praw

with

and

pip

and

reinstalled

pip

with

and

homebrew

and

I

am

getting

different

errors

depending

on

which

route

I

take

That

is

kind

of

like

progress

Dean

Solecki

Oct

at

sudo

pip

will

install

pip

under

LibraryPython

whereas

brew

install

python

will

install

python

and

pip

under

usrlocal

ImportError

No

module

named

is

because

you

are

missing

setuptools

Youll

need

to

pip

install

setuptools

StvnW

Oct

at

StvnW

basically

summarized

the

issue

mixing

pip

and

brew

messed

up

locations

but

and

pip

played

nice

The

python

download

from

pythonorgdownload

replaced

the

default

install

seamlessly

Dean

Solecki

Oct

at

I

would

recommend

taking

the

other

path

leaving

the

system

install

alone

and

dealing

instead

exclusively

with

pyenv

and

virtualenv

StvnW

Oct

at

Its

strange

I

am

suspecting

you

have

another

version

of

on

your

mac

os

answered

Oct

at

demob

and

Dean

Solecki

Oct

at

Please

try

to

run

and

import

praw

demob

Oct

at

python

doesnt

let

you

determine

only

as

far

as

I

can

tell

I

can

run

either

or

but

not

specify

or

Dean

Solecki

Oct

at

If

you

are

using

a

mac

Check

the

version

of

python

on

your

shells

path

using

which

python

Then

make

sure

that

the

shebang

line

in

the

script

you

are

trying

to

run

uses

the

same

version

of

python

In

my

terminal

I

typed

which

python

and

got

the

output

usrlocalbinpython

I

went

to

the

script

I

was

trying

to

run

and

added

the

following

to

the

first

line

usrlocalbinpython

Then

I

went

back

to

my

terminal

Checked

that

I

was

in

the

same

directory

as

the

script

I

wanted

to

run

and

typed

If

you

dont

see

any

output

at

this

point

make

sure

that

you

have

execution

permission

enabled

for

your

script

by

typing

chmod

x

in

ther

terminal

Then

try

running

the

script

again

using

answered

Jul

at

Luke

Murray

Your

Answer

By

clicking

Post

Your

Answer

you

acknowledge

that

you

have

read

our

updated

terms

of

service

and

cookie

policy

and

that

your

continued

use

of

the

website

is

subject

to

these

policies

Not

the

answer

youre

looking

for

Browse

other

questions

tagged

python

or

ask

your

own

question

asked

years

months

ago

viewed

times

active

year

month

ago

Blog

Adios

to

Winter

Bash

question

feed

O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O B O O O O O B O O B O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O B O B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


How do I use typedef and typedef enum in C Ask Question 41 19 Consider define MAXROW 20 define MAXCOL 60 typedef State Grid MAXROW 2 MAXCOL 2 typedef enum state DEAD ALIVE State How do I use typedef and typedef enum in C What does this part of the code do c typedef improve this question Peter Mortensen 135k 19 83 111 asked Dec 6 13 at 1444 user39555 306 1 3 6 3 Welcome to SO The question is a bit too basic and most likely has already been asked on SO What material are you using to learn C You should find a better material which answers that question or else you will get bogged down too much by questions Look for best C tutorials on Google and SO Ciro Santilli 新疆改造中心 六四事件 法轮功 Dec 6 13 at 1451 Actually i know basic C but that grid statement is what i am not clearly getting user39555 Dec 6 13 at 1455 asked 5 years 1 month ago viewed 206355 times active yesterday Blog Adios to Winter Bash 2018 Hot Network Questions question feed

O O O O B O B B O O O O O O O O O O O O O B O O O O O O B B O O O O O O O O B O B B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Concrete

Javascript

Regex

for

Accented

Characters

Diacritics

Ask

Question

Ive

looked

on

Stack

Overflow

replacing

characters

eh

how

JavaScript

doesnt

follow

the

Unicode

standard

concerning

RegExp

etc

and

havent

really

found

a

concrete

answer

to

the

question

How

can

JavaScript

match

for

accented

characters

those

with

diacritical

marks

Im

forcing

a

field

in

a

UI

to

match

the

format

last

comma

space

first

and

I

want

to

provide

support

for

diacritics

but

evidently

in

JavaScript

its

a

bit

more

difficult

than

other

languagesplatforms

This

was

my

original

version

until

I

wanted

to

add

diacritic

support

azAZsazAZ

Currently

Im

debating

one

of

three

methods

to

add

support

all

of

which

I

have

tested

and

work

at

least

to

some

extent

I

dont

really

know

what

the

extent

is

of

the

second

approach

Here

they

are

Explicitly

listing

all

accented

characters

that

I

would

want

to

accept

as

valid

lame

and

overlycomplicated

var

accentedCharacters

Build

the

full

regex

var

regex

azAZ

accentedCharacters

sazAZ

accentedCharacters

Create

a

RegExp

from

the

string

version

regexCompiled

new

RegExp

regex

regexCompiled

azAZàèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœsazAZàèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸçÇßØøÅåÆæœ

This

correctly

matches

a

lastfirst

name

with

any

of

the

supported

accented

characters

in

accentedCharacters

My

other

approach

was

to

use

the

character

class

to

have

a

simpler

expression

var

regex

s

This

would

match

for

just

about

anything

at

least

in

the

form

of

something

something

Thats

alright

I

suppose

The

last

approach

which

I

just

found

might

be

simpler

It

matches

a

range

of

unicode

characters

tested

and

working

though

I

didnt

try

anything

crazy

just

the

normal

stuff

I

see

in

our

language

department

for

faculty

member

names

Here

are

my

concerns

The

first

solution

is

far

too

limiting

and

sloppy

and

convoluted

at

that

It

would

need

to

be

changed

if

I

forgot

a

character

or

two

and

thats

just

not

very

practical

The

second

solution

is

better

concise

but

it

probably

matches

far

more

than

it

actually

should

I

couldnt

find

any

real

documentation

on

exactly

what

matches

just

the

generalization

of

any

character

except

the

newline

character

from

a

table

on

the

MDN

The

third

solution

seems

the

be

the

most

precise

but

are

there

any

gotchas

Im

not

very

familiar

with

Unicode

at

least

in

practice

but

looking

at

a

code

table

continuation

of

that

table

seems

to

be

pretty

solid

at

least

for

my

expected

input

Faculty

wont

be

submitting

forms

with

their

names

in

their

native

language

eg

Arabic

Chinese

Japanese

etc

so

I

dont

have

to

worry

about

outofLatincharacterset

characters

So

the

real

questions

Which

of

these

three

approaches

is

most

suited

for

the

task

Or

are

there

better

solutions

javascript

regex

unicode

improve

this

question

edited

May

at

Community

asked

Dec

at

Chris

Cirefice

There

seems

to

be

no

particular

reason

to

use

the

more

complicated

regexps

Only

thing

about

the

most

simple

solution

is

it

will

also

match

something

something

something

You

could

use

something

like

regex

s

to

prevent

that

Dec

at

At

a

glance

the

first

one

wont

match

the

common

name

ODonnell

Chris

nor

compound

last

names

with

a

hyphen

nor

multiple

last

names

etc

See

Falsehoods

Programmers

Believe

About

Names

for

just

about

every

possible

pitfalls

Dec

at

the

atom

matches

anything

except

newlines

actually

is

quite

exact

Bergi

Dec

at

If

it

is

possible

for

you

to

use

an

additional

library

you

can

have

a

look

at

my

answer

here

stema

Dec

at

Jongware

I

actually

just

read

that

article

while

I

was

browsing

SO

for

an

answer

to

my

question

I

also

completely

forgot

about

hyphens

and

apostrophes

and

the

like

I

was

more

concerned

with

making

it

international

first

P

Im

glad

you

brought

it

up

though

And

Stema

I

actually

looked

at

that

library

and

I

avoid

incorporating

libraries

because

this

is

all

on

Google

Apps

Script

incorporating

external

libraries

would

be

a

nightmare

and

I

would

only

be

using

it

in

this

case

for

one

particular

field

kind

of

overkill

P

Chris

Cirefice

Dec

at

Answers

oldest

Which

of

these

three

approaches

is

most

suited

for

the

task

Depends

on

the

task

To

match

exactly

all

Latin

characters

and

their

accented

versions

the

Unicode

ranges

probably

provide

the

best

solution

They

might

be

extended

to

all

nonwhitespace

characters

which

could

be

done

using

the

S

character

class

Im

forcing

a

field

in

a

UI

to

match

the

format

last

comma

space

first

The

most

basic

problem

Im

seeing

here

are

not

diacritics

but

whitespaces

There

are

a

few

names

that

consist

of

multiple

words

eg

for

titles

So

you

should

go

with

the

most

generic

that

is

allowing

everything

but

the

comma

that

distinguishes

first

from

last

name

s

But

your

second

solution

with

the

character

class

is

just

as

fine

you

only

might

need

to

care

about

multiple

commata

then

edited

May

at

dylankb

answered

Dec

at

Bergi

Hm

maybe

youre

right

I

probably

overcomplicated

it

Could

you

explain

the

regex

you

provided

Ive

been

working

with

regex

for

a

little

while

now

but

only

basic

stuff

and

really

I

dont

have

a

clue

what

yours

actually

does

Ha

Chris

Cirefice

Dec

at

Its

a

negated

character

class

meaning

anything

besides

the

comma

Bergi

Dec

at

Ah

so

it

reads

more

like

Thats

what

I

thought

when

I

first

read

it

I

got

kind

of

confused

when

I

saw

three

commas

in

there

Chris

Cirefice

Dec

at

Yes

exactly

Sorry

for

the

confusion

with

the

missing

s

for

the

whitespace

Bergi

Dec

at

MateoTibaquirá

You

can

simplify

s

to

S

Bergi

Aug

at

show

more

comments

The

easier

way

to

accept

all

accents

is

this

A

z

Àú

accepts

lowercase

and

uppercase

characters

A

z

Àÿ

as

above

but

including

letters

with

an

umlaut

includes

A

Za

z

Àÿ

as

above

but

not

including

A

Za

z

ÀÖØöøÿ

as

above

but

not

including

See

httpsunicodetablecomen

for

characters

listed

in

numeric

order

improve

this

answer

gigawatts

answered

Nov

at

Maycow

Moura

This

needs

to

be

AzÀÿ

to

accept

letters

with

an

umlaut

einnocent

Jun

at

It

works

nicely

but

could

you

elaborate

why

it

works

Pierre

Henry

Jun

at

PierreHenry

the

defines

a

range

and

this

technique

exploits

the

ordering

of

characters

in

the

charset

to

define

a

continuous

range

making

for

a

super

concise

solution

to

the

problem

Angad

Jun

at

wont

this

match

underscores

and

the

other

nonword

characters

between

Z

and

a

jcuenod

Aug

at

This

matches

at

least

the

characters

and

of

which

should

be

included

Nate

Dec

at

show

more

comments

The

accented

Latin

range

was

not

quite

enough

for

my

database

of

names

so

I

extended

the

regex

to

a

zA

Zu

u

a

zA

Zu

u

u

u

includes

even

more

Latin

chars

I

added

these

code

blocks

includes

three

adjacent

blocks

at

once

Supplement

Latin

ExtendedA

Latin

ExtendedB

Latin

Extended

Additional

If

you

need

more

code

points

you

can

find

more

ranges

on

Wikipedias

List

of

Unicode

characters

For

example

you

could

also

add

Latin

ExtendedC

D

and

E

but

I

left

them

out

because

only

historians

seem

interested

in

them

now

and

the

D

and

E

sets

dont

even

render

correctly

in

my

browser

The

original

regex

stopping

at

borked

on

the

name

Șenol

According

to

FontSpaces

Unicode

Analyzer

that

first

character

is

LATIN

CAPITAL

LETTER

S

WITH

COMMA

BELOW

Yeah

its

usually

spelled

with

a

cedillaS

Şenol

But

Im

not

flying

to

Turkey

to

go

tell

him

Youre

spelling

your

name

wrong

improve

this

answer

edited

Dec

at

answered

Aug

at

Chaim

Leib

Halbert

This

should

be

the

answer

marked

as

correct

Renan

Apr

at

Having

a

look

at

the

unicode

table

latin

block

I

think

you

should

also

include

so

Im

doing

cprcrack

Aug

at

Thanks

cprcrack

done

Chaim

Leib

Halbert

hours

ago

The

XRegExp

library

has

a

plugin

named

Unicode

that

helps

solve

tasks

like

this

script

src

xregexpjs

script

script

src

addonsunicodeunicodebasejs

script

script

var

unicodeWord

XRegExp

pL

unicodeWord

test

Русский

true

unicodeWord

test

日本語

true

unicodeWord

test

العربية

true

script

Its

mentioned

in

the

comments

to

the

question

but

its

easy

to

miss

Ive

noticed

it

only

after

I

submitted

this

answer

improve

this

answer

edited

Jan

at

answered

Jan

at

thorn

Nice

turns

out

that

I

didnt

actually

need

to

regex

on

unicode

but

rather

on

the

pattern

anything

anything

This

will

be

useful

for

future

readers

Chris

Cirefice

Jan

at

How

about

this

azAZÀÖØöøÿ

improve

this

answer

answered

Jul

at

alchn

Shorter

and

more

efficient

solution

pojda

Jan

at

from

this

wiki

httpsenwikipediaorgwikiList_of_Unicode_charactersBasic_Latin

for

latin

letters

I

use

AzÀÖØöøÿ

it

avoids

hyphens

and

specials

chars

improve

this

answer

answered

Apr

at

fdsfdsfdsfds

This

matches

and

JLRishe

May

at

What

about

this

a

zA

Z

àúÀÚ

It

will

match

every

word

with

accented

characters

or

not

improve

this

answer

edited

Dec

at

answered

Dec

at

Javier

Pallarés

But

OP

wants

to

allow

accented

characters

barbsan

Dec

at

Sorry

Ive

just

edited

my

answer

Javier

Pallarés

Dec

at

Not

the

answer

youre

looking

for

Browse

other

questions

tagged

javascript

regex

unicode

or

ask

your

own

question

asked

years

ago

viewed

times

active

days

ago

question

feed

O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O


ASPNET

Gridview

rowdatabound

Stackoverflow

exception

Ask

Question

I

have

a

gridview

being

filled

from

a

SQL

data

source

Whenever

I

open

the

page

I

get

a

stackoverflow

exception

in

the

gridview

rowdatabound

What

is

causing

the

problem

Searchaspx

aspGridView

runatserver

AllowPagingTrue

AllowSortingTrue

AutoGenerateColumnsFalse

DataSourceIDConsultsSQLDataSource

GridLinesNone

AlternatingRowStyle

BackColorWhite

Columns

aspBoundField

DataFieldDATA

HeaderTextData

SortExpressionDATA

aspBoundField

DataFieldLOCAL

HeaderTextLocal

SortExpressionLOCAL

aspBoundField

DataFieldURGENCIA

HeaderTextUrgencia

SortExpressionURGENCIA

aspBoundField

DataFieldESTADO

HeaderTextEstado

SortExpressionESTADO

aspHyperLinkField

HeaderTextPagamento

NavigateUrla

TextLink

VisibleFalse

aspBoundField

DataFieldIDPAGAMENTO

SortExpressionIDPAGAMENTO

VisibleFalse

Columns

aspGridView

CodeBehind

protected

void

sender

GridViewRowEventArgs

e

if

eRowRowType

DataControlRowTypeDataRow

string

value

switchvalue

case

Waiting

Payment

HyperLinkField

hp

true

true

hpNavigateUrl

AccountPaymentsPaymentPaymentID

Exception

occurs

here

hpText

Pay

true

break

c

aspnet

gridview

stackoverflow

improve

this

question

Jason

Aller

asked

May

at

xRed

The

only

information

Im

getting

is

An

unhandled

exception

of

type

SystemStackOverflowException

occurred

in

SystemDatadll

xRed

May

at

Yes

i

get

the

values

from

correctly

from

xRed

May

at

does

it

change

anything

if

you

following

hpNavigateUrl

qamar

May

at

Just

Put

a

Debugger

on

your

method

and

see

on

which

line

it

is

giving

error

Sunny

Sandeep

May

at

Answer

oldest

Ive

noticed

that

if

you

assign

NavigateUrl

and

Text

to

hyperlink

by

referencing

HyperLinkFiled

like

you

do

it

isnt

assigned

to

current

row

but

to

the

next

row

which

doesnt

seem

to

be

what

you

expect

Rebuild

your

RowDataBound

method

like

that

protected

void

sender

GridViewRowEventArgs

e

if

eRowRowType

DataControlRowTypeDataRow

string

value

switch

value

case

Waiting

Payment

HyperLink

hp

as

HyperLink

hpNavigateUrl

AccountPaymentsPaymentPaymentID

hpText

Pay

break

and

remove

visiblefalse

from

HyperLinkField

and

last

BoundField

in

grid

markup

You

can

remove

Text

and

NavigateUrl

properties

from

HyperLinkField

so

you

only

show

content

in

the

cell

if

there

is

correct

link

Try

it

and

see

if

you

still

getting

error

answered

May

at

PrzemG

Your

Answer

By

clicking

Post

Your

Answer

you

acknowledge

that

you

have

read

our

updated

terms

of

service

and

cookie

policy

and

that

your

continued

use

of

the

website

is

subject

to

these

policies

Not

the

answer

youre

looking

for

Browse

other

questions

tagged

c

aspnet

gridview

stackoverflow

or

ask

your

own

question

asked

years

months

ago

viewed

times

active

years

months

ago

Blog

Adios

to

Winter

Bash

question

feed

O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O


The

client

application

has

requested

access

to

resource

This

request

has

failed

favorite

I

am

trying

to

test

the

sample

code

from

API

I

could

login

to

my

account

but

after

that

i

would

always

get

this

exception

AuthenticationFailedException

was

caught

The

client

application

has

requested

access

to

resource

This

request

has

failed

because

the

client

has

not

specified

this

resource

in

its

requiredResourceAccess

list

Trace

ID

Correlation

ID

Timestamp

This

is

the

code

that

I

have

been

testing

this

code

is

generated

by

the

API

Authenticator

authenticator

new

Authenticator

var

authInfo

await

please

help

me

or

pointout

what

Im

doing

wrong

this

is

my

first

time

developing

in

please

help

and

thank

you

c

outlook

improve

this

question

edited

Sep

at

pnuts

asked

Jul

at

Answers

active

oldest

votes

I

just

came

across

your

question

having

run

into

the

same

error

so

since

nobody

ever

answered

I

figured

I

would

post

the

answer

I

found

This

error

is

related

to

the

permissions

set

to

be

requested

on

the

app

in

the

Azure

dashboard

at

httpsmanagewindowsazurecom

If

you

go

into

your

app

configuration

page

and

scroll

to

the

bottom

you

just

need

to

add

the

corresponding

items

under

the

delegated

permissions

dropdown

answered

Jul

at

I

did

this

But

still

facing

the

same

issue

Can

you

suggest

any

other

troubleshooting

steps

too

Amogh

Natu

Apr

at

Same

here

also

posted

here

about

our

similar

issue

chrisb

Apr

at

I

got

the

same

error

This

is

what

fixed

it

for

me

Go

to

httpsmanagewindowsazurecom

Go

to

the

corresponding

app

configuration

page

Scroll

to

the

bottom

to

permissions

to

other

applications

Add

Windows

Azure

Active

Directory

application

if

it

is

not

already

there

Under

delegated

permissions

check

Enabled

Signon

and

read

users

profiles

edited

Mar

at

twernt

answered

Mar

at

Adam

Franicsco

The

consent

framework

associated

with

requesting

authorization

requires

that

your

client

application

is

configured

with

a

static

set

of

permissions

to

the

resources

APIs

that

it

will

call

For

example

if

your

app

needs

to

read

the

signed

in

users

mail

and

read

and

write

to

their

calendar

you

need

to

select

Office

Exchange

Online

as

a

resource

and

pick

the

Read

mail

and

Read

and

write

calendar

permissions

This

app

configuration

can

be

done

in

a

couple

of

ways

one

way

is

through

your

dev

environment

like

Visual

Studio

and

up

have

a

connector

that

allows

you

and

the

following

sections

which

show

how

register

apps

through

Azure

Management

Portal

and

through

Visual

Studio

Also

which

sample

are

you

trying

here

The

sample

should

contain

instructions

including

the

instructions

to

set

the

resource

and

permission

scopes

your

application

needs

answered

May

at

Dan

Kershaw

MSFT

Not

the

answer

youre

looking

for

Browse

other

questions

tagged

c

outlook

or

ask

your

own

question

O O O O O O O O O O O O O O O O O O O O O O O O O B B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O


Solving

using

DFS

Ask

Question

I

am

looking

for

code

in

java

that

implement

DFS

and

BFS

for

the

game

by

given

initial

state

and

Goal

state

I

need

to

print

the

solution

path

from

initial

to

goal

state

Not

done

yet

This

is

the

code

I

have

So

far

I

have

only

been

able

to

implement

DFS

What

my

program

does

so

far

is

it

outputs

SUCCESS

once

it

finds

the

goal

state

However

it

never

gets

to

this

point

Can

someone

tell

me

where

I

am

going

wrong

java

artificialintelligence

statespace

improve

this

question

asked

Aug

at

What

is

an

meriton

Aug

at

Hes

talking

about

that

but

in

version

It

is

called

Taquin

in

french

Dici

Aug

at

Answers

oldest

Ok

so

your

program

is

taking

longer

than

expected

First

well

want

to

find

out

if

it

is

stuck

in

an

infinite

loop

or

just

slow

To

do

that

lets

have

the

program

print

its

progress

by

adding

the

following

to

the

main

loop

int

statesVisited

while

OPEN

empty

false

STATE

false

statesVisited

System

out

println

statesVisited

We

then

see

that

the

program

visited

a

couple

thousand

states

per

second

Since

our

processor

executes

several

billion

instructions

per

second

this

implies

processing

a

state

takes

about

a

million

cpu

instructions

It

shouldnt

be

that

high

should

it

So

what

could

be

causing

this

Generally

speaking

wed

now

use

a

profiler

to

measure

just

what

part

of

the

code

all

this

time

is

spent

in

but

since

the

program

is

so

short

we

can

try

guessing

first

My

first

guess

is

that

printing

every

state

we

visit

could

be

quite

expensive

To

verify

this

lets

print

only

every

state

while

OPEN

empty

false

STATE

false

statesVisited

if

statesVisited

System

out

println

statesVisited

We

that

change

in

place

we

notice

that

the

first

states

are

visited

in

under

second

so

printing

was

indeed

significant

We

also

notice

something

curious

While

the

first

states

are

visited

in

under

a

second

for

some

reason

the

program

seems

to

get

slower

and

slower

At

states

visited

it

takes

about

a

second

to

visit

states

and

it

keeps

getting

worse

This

is

unexpected

as

processing

a

state

should

not

get

more

and

more

expensive

So

we

know

some

operation

in

our

loop

is

getting

increasingly

more

expensive

Lets

review

our

code

to

identify

Pushing

and

popping

takes

constant

time

regardless

of

the

size

of

the

collection

But

you

also

use

Stacksearch

and

LinkedListcontains

Both

these

operations

are

documented

to

require

iterating

over

the

entire

stack

or

list

So

lets

output

the

sizes

of

these

collections

if

statesVisited

System

out

println

statesVisited

System

out

println

OPEN

size

System

out

println

CLOSED

size

System

out

println

After

waiting

a

little

while

we

see

So

OPEN

contains

elements

and

CLOSED

nearly

That

explains

why

processing

a

state

keeps

getting

slower

and

slower

Well

therefore

want

to

choose

data

structures

with

a

more

efficient

contains

operation

such

as

a

javautilHashSet

or

javautilLinkedHashSet

which

is

a

hybrid

between

a

hash

set

and

a

linked

list

permitting

us

the

retrieve

elements

in

the

order

they

were

added

Doing

this

we

get

public

static

LinkedHashSet

String

OPEN

new

LinkedHashSet

String

public

static

HashSet

String

CLOSED

new

HashSet

String

public

static

boolean

STATE

false

public

static

void

main

String

args

int

statesVisited

String

start

String

goal

String

X

String

temp

OPEN

add

start

while

OPEN

isEmpty

false

STATE

false

X

OPEN

iterator

next

OPEN

remove

X

int

pos

X

indexOf

get

position

of

ZERO

or

EMPTY

SPACE

if

X

equals

goal

System

out

println

SUCCESS

STATE

true

else

generate

children

CLOSED

add

X

temp

up

X

pos

if

temp

equals

OPEN

add

temp

temp

left

X

pos

if

temp

equals

OPEN

add

temp

temp

down

X

pos

if

temp

equals

OPEN

add

temp

temp

right

X

pos

if

temp

equals

OPEN

add

temp

MOVEMENT

UP

public

static

String

up

String

s

int

p

String

str

s

if

p

char

a

str

charAt

p

String

newS

str

substring

p

a

str

substring

p

str

newS

substring

p

newS

substring

p

Eliminates

child

of

X

if

its

on

OPEN

or

CLOSED

if

OPEN

contains

str

CLOSED

contains

str

false

return

str

else

return

MOVEMENT

DOWN

public

static

String

down

String

s

int

p

String

str

s

if

p

char

a

str

charAt

p

String

newS

str

substring

p

a

str

substring

p

str

newS

substring

p

newS

substring

p

Eliminates

child

of

X

if

its

on

OPEN

or

CLOSED

if

OPEN

contains

str

CLOSED

contains

str

false

return

str

else

return

MOVEMENT

LEFT

public

static

String

left

String

s

int

p

String

str

s

if

p

p

p

char

a

str

charAt

p

String

newS

str

substring

p

a

str

substring

p

str

newS

substring

p

newS

substring

p

Eliminates

child

of

X

if

its

on

OPEN

or

CLOSED

if

OPEN

contains

str

CLOSED

contains

str

false

return

str

else

return

MOVEMENT

RIGHT

public

static

String

right

String

s

int

p

String

str

s

if

p

p

p

char

a

str

charAt

p

String

newS

str

substring

p

a

str

substring

p

str

newS

substring

p

newS

substring

p

Eliminates

child

of

X

if

its

on

OPEN

or

CLOSED

if

OPEN

contains

str

CLOSED

contains

str

false

return

str

else

return

public

static

void

print

String

s

System

out

println

s

substring

System

out

println

s

substring

System

out

println

s

substring

System

out

println

which

prints

SUCCESS

nearly

instantly

answered

Aug

at

meriton

I

have

really

learnt

alot

from

your

explanation

Thanks

so

much

Aug

at

I

was

just

wondering

how

would

I

use

the

LinkedHashSet

as

a

stack

So

basically

LIFO

In

the

code

you

presented

its

FIFO

Aug

at

I

dont

know

of

a

LIFO

map

in

the

JDK

so

Id

use

two

data

structures

A

stack

for

keeping

track

of

the

order

and

a

HashSet

for

efficient

membership

testing

meriton

Aug

at

There

is

an

error

in

the

left

method

p

should

not

be

or

Not

Ron

Apr

at

I

would

suggest

you

to

use

the

Hipster

library

to

solve

the

easily

using

BFS

DFS

A

IDA

etc

There

is

a

full

example

here

it

may

help

you

to

design

your

search

strategy

If

you

are

interested

the

basic

steps

to

solve

the

problem

are

first

define

the

functions

that

allow

you

to

traverse

the

statespace

search

problem

and

then

pick

up

one

algorithm

to

search

over

the

statespace

problem

In

order

to

create

a

search

problem

you

can

use

the

ProblemBuilder

class

SearchProblem

p

ProblemBuilder

create

initialState

Arrays

asList

defineProblemWithExplicitActions

useActionFunction

new

ActionFunction

Action

List

Integer

Override

public

Iterable

Action

actionsFor

List

Integer

state

Here

we

compute

the

valid

movements

for

the

state

return

validMovementsFor

state

useTransitionFunction

new

ActionStateTransitionFunction

Action

List

Integer

Override

public

List

Integer

apply

Action

action

List

Integer

state

Here

we

compute

the

state

that

results

from

doing

an

action

A

to

the

current

state

return

applyActionToState

action

state

useCostFunction

new

CostFunction

Action

List

Integer

Double

Override

public

Double

evaluate

Transition

Action

List

Integer

transition

Every

movement

has

the

same

cost

return

build

Once

you

have

your

problem

definition

you

can

select

any

algorithm

to

solve

it

System

out

println

Hipster

createDijkstra

p

search

Arrays

asList

You

can

read

more

details

about

the

problem

and

how

to

solve

it

with

Hipster

in

this

presentation

httpsspeakerdeckcompablormierhipsteranopensourcejavalibraryforheuristicsearch

edited

Aug

at

answered

Aug

at

Pablo

R

Mier

You

shouldnt

push

in

your

open

Stack

combinations

that

were

already

added

to

it

Plus

an

ArrayDeque

would

be

better

Stack

is

an

old

class

see

he

javadoc

A

more

complete

and

consistent

set

of

LIFO

stack

operations

is

provided

by

the

Deque

interface

and

its

implementations

which

should

be

used

in

preference

to

this

class

For

example

Deque

stack

new

ArrayDeque

To

avoid

exploring

countless

times

the

same

states

you

must

use

a

Set

as

your

closed

list

and

verify

that

the

state

you

are

trying

to

add

in

the

open

list

were

never

added

to

the

closed

list

Also

you

might

be

more

comfortable

using

byte

arrays

not

int

to

save

memory

rather

than

strings

to

perform

your

operations

To

sum

up

you

could

structure

your

code

like

that

public

class

Taquin

private

byte

state

new

byte

public

Taquin

String

s

public

List

Taquin

successors

public

boolean

isSolvable

Taquin

goal

Necessary

to

use

the

Set

public

int

hashCode

public

boolean

equals

Object

o

public

String

toString

state

public

void

solve

Taquin

goal

if

isSolvable

goal

Deque

Taquin

open

new

ArrayDeque

Set

Taquin

closed

new

HashSet

closed

add

this

open

add

this

Taquin

current

this

if

isSolvable

is

correct

you

should

never

encounter

openisEmpty

but

for

safety

test

it

while

current

equals

goal

open

isEmpty

current

open

pop

System

out

println

current

for

Taquin

succ

current

successors

we

only

add

to

the

open

list

the

elements

which

were

never

seen

if

closed

add

succ

open

add

succ

System

out

println

Success

else

System

out

println

No

solution

This

has

the

advantage

of

being

generic

for

any

kind

of

search

in

a

graph

If

you

wanted

to

solve

another

puzzle

you

would

just

modify

the

method

I

didnt

implement

which

are

actually

part

of

a

Node

interface

If

you

wanted

to

change

the

algorithm

for

example

A

star

which

is

often

used

for

the

you

would

just

change

the

solve

method

I

hope

this

sample

of

code

will

help

you

edited

Aug

at

answered

Aug

at

Dici

Not

the

answer

youre

looking

for

Browse

other

questions

tagged

java

artificialintelligence

statespace

or

ask

your

own

question

asked

years

months

ago

viewed

times

active

years

months

ago

Blog

Adios

to

Winter

Bash

question

feed

O O O B O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Running msi package from Command line in Silent Mode isnt working in WINDOW 8 1 favorite I have built an msi package from InstallShield and name it Dell Printer Hubmsi I run it from Command Line in Window 7 as below Dpackagemsiexec i Dell Printer Hubmsi qn Its working in window 7 But when I run this Command Line in window 8 its not working at all I have tried qb qr qf and they worked fine I also have tried quiet but its not worked in window 8 How can i run msi package from Command Line as silent mode in window 8 Please help command windowsinstaller installshield silent improve this question asked Aug 13 14 at 1006 vinhdq91 16 1 4 2 Answers active votes 2 accepted You should add lv installlog and the read the results to see why it isnt working Odds are UAC is enabled and you are invoking this from a standard user command prompt There could also be a design defect in the MSI that doesnt like Windows 8 andor missing prereqs answered Aug 13 14 at 1347 Christopher Painter 473k 6 48 83 Thanks for your answer I will add this command and reply my result for you Any idea vinhdq91 Aug 13 14 at 1548 2 Are you sure that you launched the Command Prompt using the Run as administrator option answered Aug 13 14 at 1401 EuSebyU 89 6 No I didnt launch the Command Prompt as administrator I will try this Thanks vinhdq91 Aug 13 14 at 1547 As mentioned in my answer above Christopher Painter Aug 13 14 at 1559 Your Answer By clicking Post Your Answer you acknowledge that you have read our updated terms of service and cookie policy and that your continued use of the website is subject to these policies Not the answer youre looking for Browse other questions tagged command windowsinstaller installshield silent or ask your own question

O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


Sorting a text file alphabetically Python Ask Question 8 2 I would like to sort the file shoppingtxt in alphabetical order shopping open shoppingtxt line shopping readline while len line 0 print line end line shopping readline for eachline in myFile printeachline shopping python sorting improve this question asked Nov 25 14 at 936 Bocui 57 1 1 10 add a comment 3 Answers active oldest votes 23 Just to show something different instead of doing this in python you can do this from a command line in Unix systems sort shopping txt o shopping txt and your file is sorted Of course if you really want python for this solution proposed by a lot of other people with reading file and sorting works fine answered Nov 25 14 at 942 Salvador Dali 111k 81 485 579 add a comment 17 An easy way to do this is using the sort or sorted functions lines shopping readlines lines sort Alternatively lines sorted shopping readlines The disadvantage is that you have to read the whole file into memory though If thats not a problem you can use this simple code edited Dec 15 15 at 1253 Mad Physicist 34k 15 68 95 answered Nov 25 14 at 941 Mezgrman 541 2 10 add a comment 6 Use sorted function with open shoppingtxt r as r for line in sorted r print line end answered Nov 25 14 at 940 Avinash Raj 142k 14 114 161 1 Could you please let me know whether this would take all lines in memory How would this work Does this read input lazily Akshay Hazari Mar 30 16 at 726 1 AkshayHazari sorted loads all lines in memory To avoid loading all the lines you could call the external sort command or implement it in Python jfs Feb 23 17 at 842 add a comment protected by Community Mar 30 17 at 824 Thank you for your interest in this question Because it has attracted lowquality or spam answers that had to be removed posting an answer now requires 10 reputation on this site the association bonus does not count Would you like to answer one of these unanswered questions instead Not the answer youre looking for Browse other questions tagged python sorting or ask your own question asked 4 years 1 month ago viewed 44537 times active 1 year 9 months ago Blog Adios to Winter Bash 2018 question feed

O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


SystemUnauthorizedAccessException

Access

to

the

path

is

denied

Ask

Question

I

am

getting

following

error

while

running

my

aspnet

web

application

through

Error

SystemUnauthorizedAccessException

Access

to

the

path

ASPNET

is

denied

FYI

I

was

getting

some

error

earlier

and

to

resolve

that

error

I

deleted

all

files

inside

Temporary

ASPNET

Filesroot

folder

which

caused

above

error

I

tried

following

Restarted

using

admin

privilege

Added

full

permissions

on

my

web

app

folder

Added

full

permissions

on

my

aspnet

temp

folder

ASPNET

Filesroot

Please

help

aspnet

improve

this

question

asked

Jan

at

Chirag

You

probably

shouldnt

delete

that

folder

Its

explained

at

Understanding

ASPNET

Dynamic

Compilation

Can

you

create

a

new

project

and

copy

all

your

files

to

that

project

perhaps

Patrick

Jan

at

Answers

active

oldest

votes

Are

any

of

the

dlls

in

your

solution

marked

as

readonly

Have

they

been

checked

out

from

source

control

Did

you

reboot

after

changing

the

permissions

What

is

the

identity

of

the

Application

Pool

User

do

they

have

access

to

the

temp

folder

Is

your

web

app

impersonating

another

user

at

all

Is

your

App

doing

anything

on

bootup

that

could

cause

this

Use

SysInternals

FileMon

to

see

if

another

process

is

using

it

edited

Jan

at

answered

Jan

at

Ralph

Willgoss

Thanks

ralphwillgoss

of

the

assemblies

are

marked

readonly

I

rebooted

the

system

and

the

error

is

gone

However

I

got

my

original

error

back

Compiler

Error

Message

The

type

NorthwindAppDALCategories

exists

in

both

ASPNET

and

ASPNET

Chirag

Jan

at

Thanks

again

ralphwillgoss

please

create

an

answer

and

will

mark

as

resolved

for

now

Chirag

Jan

at

One

of

the

important

fact

why

I

was

struggling

with

the

kind

of

errors

was

because

I

was

using

folder

in

my

Web

Application

Project

Please

note

that

folder

can

only

be

used

in

Website

projects

not

Web

App

projects

So

if

you

want

to

put

some

class

files

and

compile

them

you

will

need

to

create

a

folder

other

than

even

AppCode

without

underscore

character

should

work

Very

good

article

by

Vishal

folder

doesnt

work

with

Web

Application

Projects

WAPs

Chirag

Jan

at

For

me

the

problem

was

caused

by

the

Exception

Settings

Debug

Windows

Exception

Settings

In

the

window

that

is

shown

uncheck

Common

Language

Runtime

Exceptions

I

turn

it

on

from

time

to

time

to

break

on

all

errors

including

handled

ones

and

had

left

it

on

Then

when

debugging

my

ASPNet

MVC

app

it

then

halts

on

the

access

denied

errors

on

start

My

guess

is

it

tries

to

write

temp

files

to

Location

A

gets

an

access

denied

error

then

uses

Location

B

answered

Mar

at

John

Petrak

Exact

same

scenario

The

thought

never

crossed

my

mind

that

fiddling

with

my

exception

settings

affected

core

functioning

Microsoft

code

this

way

bkwdesign

May

at

bkwdesign

It

only

does

if

you

have

Just

My

Code

disabled

Normally

VS

is

supposed

to

see

that

the

exception

wasnt

in

your

code

and

so

the

firstchance

exception

handling

logic

isnt

applied

whether

you

have

it

enabled

or

not

Roman

Starkov

Feb

at

If

you

also

have

just

my

code

disabled

and

you

want

it

that

way

you

can

stop

this

error

from

occurring

by

running

VS

as

administrator

Ewoud

Feb

at

My

issue

was

that

exceptions

werent

being

caught

by

MSVC

found

this

whilst

trying

to

understand

why

Turning

on

exceptions

caught

the

exceptions

but

it

was

quite

worrying

when

this

exception

and

others

were

caught

Selecting

Just

My

Code

see

seemed

to

filter

the

exceptions

to

show

issues

in

my

code

only

and

not

with

the

NET

framework

Anthony

Jan

at

I

solved

this

issue

by

adding

read

write

permissions

for

IUSR

to

the

Temporary

ASPNET

Files

folder

The

didnt

seem

to

work

for

some

odd

reason

answered

Aug

at

Reflamer

Worked

for

me

Windows

Visual

Studio

Malgaur

May

at

Not

the

answer

youre

looking

for

Browse

other

questions

tagged

aspnet

or

ask

your

own

question

asked

years

ago

viewed

times

active

years

months

ago

Blog

Adios

to

Winter

Bash

Linked

How

can

I

debug

a

Internal

Server

Error

when

calling

a

WebApi

from

ajax

Hot

Network

Questions

Transpose

function

Seven

segment

display

with

TikZ

What

is

happening

in

I

have

no

idea

about

the

return

type

Mismatching

word

gender

in

Spanish

Identifying

the

writing

inside

TChallas

shoes

in

this

scene

How

to

parse

As

for

the

philosophical

content

explicitly

picks

over

in

the

films

dialogue

Identically

distributed

vs

PX

Y

PY

X

The

magical

map

how

to

stop

it

being

too

powerful

How

does

everyone

know

Jacks

name

as

Jack

Sparrow

What

is

the

mathematical

meaning

of

this

question

Employee

refuses

to

sit

at

desk

with

rest

of

team

sits

in

common

area

instead

How

do

I

take

off

these

plastic

buttons

that

are

attaching

the

shroud

to

my

car

How

does

a

shutdown

end

if

an

agreement

is

never

reached

Why

does

an

interrupted

dd

process

result

in

disk

partitions

Through

what

logic

are

Republicans

able

to

say

that

the

current

American

government

shutdown

is

the

Democrats

fault

Interviewing

spouse

of

a

fired

employee

Pattern

recognition

using

a

b

c

d

and

e

Can

someone

read

my

EMail

if

I

lose

ownership

of

my

domain

How

to

calculate

the

width

of

an

onedimensional

interval

defined

by

an

inequality

Difference

between

Quittung

and

Beleg

What

is

the

german

word

for

receipt

Word

for

Significant

enough

to

make

a

difference

What

importantcrucial

realworld

applications

use

blockchain

How

is

rabbit

allowed

to

stream

anime

Super

hard

system

of

equations

question

feed

O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O


BMP File line padding issue Ask Question 4 So Im trying to export a bmp file in C code and I have it working except for one major thing line padding Im not 100 sure on how line padding works but I know I need it My algorithm works except for the padding I manually added padding in a hex editor to my exported image and it worked But how do I add padding Here is what I have Size of the file in bytes int fileSize 54 3 width height The sections of the file unsigned char generalHeader 14 B M 0 0 0 0 0 0 0 0 54 0 0 0 unsigned char DIBHeader 40 40 0 0 0 0 0 0 0 0 0 0 0 1 0 24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 unsigned char pixelArray 1000000 unsigned char bmpPad 3 0 0 0 Set the binary portion of the generalHeader mainly just file size generalHeader 2 unsigned char fileSize generalHeader 3 unsigned char fileSize 8 generalHeader 4 unsigned char fileSize 16 generalHeader 5 unsigned char fileSize 24 The binary variable portion of the DIB header DIBHeader 4 unsigned char width DIBHeader 5 unsigned char width 8 DIBHeader 6 unsigned char width 16 DIBHeader 7 unsigned char width 24 DIBHeader 8 unsigned char height DIBHeader 9 unsigned char height 8 DIBHeader 10 unsigned char height 16 DIBHeader 11 unsigned char height 24 Loop through all width and height places to add all pixels int counter 0 for short j height j 0 j for short i 0 i width i Add all 3 RGB values pixelArray counter pixelColour i j red pixelArray counter pixelColour i j green pixelArray counter pixelColour i j blue counter Open it ofstream fileWorking fileName Write the sections fileWorking write const char generalHeader 14 fileWorking write const char DIBHeader 40 fileWorking write const char pixelArray 3 width height NO MEMORY LEAKS 4 ME fileWorking close pixelColour is of struct data type with the 3 colours all type unsigned char Any help is greatly appreciated c binaryfiles bmp improve this question asked Apr 3 15 at 2245 null 162 3 11 1 Answer oldest 5 In your case each row must be a multiple of 4 bytes 32 bits int pad 0 Set pad byte count per row to zero by default Each row needs to be a multiple of 4 bytes if width 3 4 0 pad 4 width 3 4 4 remainderwidth 3 4 Padding values can contain pretty much anything but it is best to set them to 0 When you reach the end of writing each row just write an additional pad number of zeroes bytes before writing the next row for short j height j 0 j for short i 0 i width i Add all 3 RGB values pixelArray counter pixelColour i j red Need to advance counter pixelArray counter pixelColour i j green pixelArray counter pixelColour i j blue for int padVal 0 padVal pad padVal pixelArray counter 0 Pad Finally you need to write a larger file size fileWorking write const char pixelArray 3 width pad height answered Apr 3 15 at 2307 Steven Hansen 3037 2 12 12 Thanks so much m8 I really appreciate the help null Apr 3 15 at 2327 Your Answer By clicking Post Your Answer you acknowledge that you have read our updated terms of service and cookie policy and that your continued use of the website is subject to these policies Not the answer youre looking for Browse other questions tagged c binaryfiles bmp or ask your own question asked 3 years 9 months ago viewed 2959 times active 3 years 9 months ago question feed

B I O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O