Posts

Exception Occurs While Opening a Downloaded Excel Sheet(.xls) In Asp.Net -

Image
i download excel sheet using following code. the above code starting code of logic.after downloaded, open excel sheet.it shows warning this because of warning,when im trying upload same page mysql database using asp.net.it shows exception "page not in correct format". this entire logic downloading excel sheet protected void download_click(object sender, eventargs e) { exporttoexcel(sqldatasource1, "studentmarks"); } public void exporttoexcel(sqldatasource datasrc, string filename) { //add response header response.clear(); response.addheader("content-disposition", string.format("attachment;filename={0}.xls", filename)); response.charset = ""; response.contenttype = "application/ms-excel"; //get data database mysqlconnection cn = new mysqlconnection(datasrc.connectionstring); // string query = datasrc.selectcommand.replace("\r\n", " ").re...

asp.net - check if form was submitted from my website -

i have signin form on website inside page users can search stuff after signing in. there third party mobile application letting users signin through submitting form on signin.aspx page website. my question how can tell if form being submitted third party , not website? as claudio stated, can not reliably use "referer" value. value can spoofed. safer approach employ csrf token, or akin that. for example, include asp.net session id in hidden form element. then, when form submitted, compare value of form element user's session id. if not match, form submission didn't come website.

python - Discrete density plot in matplotlib -

Image
i have 2d numpy array , want create discrete density plot using it. discrete in sense @ each point (i,j) on plot dot should placed color should correspond value of (i,j) th element of 2d array. not want use imshow because not want interpolation , want control size dots placed. have tried imshow interpolation='nearest' ? close want? import matplotlib.pyplot plt import numpy np data = np.arange(100).reshape(10, 10) fig, ax = plt.subplots() ax.imshow(data, interpolation='nearest') plt.show()

version control - Migrating from Mercurial to Git -

Image
i know question asked before several times , marked "possible duplicate", none of them seems working correct. tried fast-export , gives error. how migrate mercurial git? need history. appreciated if listed step step. update: i tried fast export: cd ~ git clone git://repo.or.cz/fast-export.git git init git_repo cd git_repo ~/fast-export/hg-fast-export.sh -r /path/to/old/mercurial_repo **[i error in line]** git checkout head this gives error: ..... hg-fast-export.sh: line 79: python: command not found thanks help! add hg-git mercurial push hg-repo git-target step-by-step guide a clone hg-git extension it's repository local path\to\hg-git b enable extension in (global mercurial.ini or repository's-specific .hgrc) [extensions] bookmarks = ... hggit = path\to\hg-git bookmark added long time ago, when extension wasn't part of tortoisehg|mercurial, not sure today's configuration c create new git-repository read|write access ...

sql server - How to convert a group of xls 2 tab delimited files using ssis? -

how convert group of xls files tab delimited files using ssis ? got script doing on google search.please sugest me how achieve using ssis dim objfso, objfile, objfiletsv dim strline, strnewline, strnewtext dim filenamelength, linelength, newfilename, linepos, quote, quotecount, totalfilesconverted objfso = createobject("scripting.filesystemobject") strcurpath = objfso.getabsolutepathname(".") totalfilesconverted = 0 each objfile in objfso.getfolder(strcurpath).files if ucase(right(objfile.name, 4)) = ".csv" filenamelength = len(objfile.name) - 4 newfilename = left(objfile.name, filenamelength) & ".tsv" objfile = objfso.opentextfile(objfile, 1) until objfile.atendofstream strline = objfile.readline linelength = len(strline) linepos = 1 strnewline = "" quote = fa...

optimization - Division of high numbers in assembly -

i tried find location of crusor array of 1896(becomes whole console in 2d, 79*24). took location , divided 79. mov ax, [y-16h] dec ax mov bx, 79 div bx mov z, dl add z, dh mov dl, z mov z, al add z, ah mov dh, z i overflow error. can tell me doing wrong please? maybe suggest solution? div bx divides 32-bit number formed dx (high word) , ax (low word) bx . therefore need clear dx (e.g. xor dx,dx ) prior division avoid overflow. by way, sure don't want divide 80? i've never heard of 79-column console, although i'm no expert on such matters

c++ - what does it mean for `new` to be no-throw guaranteed when bad_alloc is not thrown -

from documentation of new : the first version (1) throws bad_alloc if fails allocate storage. otherwise, throws no exceptions (no-throw guarantee). to me, should mean code #include <new> struct a{ a(){ throw 0; } }; int main(){ try{ a* = new a; } catch(std::bad_alloc&){} } is fine. however, when compiling gcc (see here ), program terminates after throwing int . that's documentation of operator new , not same new expression. new expression calls operator new obtain memory and then calls constructor requested on memory. operator new not throw other std::bad_alloc , later call constructor can throw whatever user code wants. compare new expression operator new .