Posts

Showing posts from January, 2013

visual c++ - What is the difference between dllexport and dllimport? -

i'm looking simple, concise explanation of difference between these two. msdn doesn't go hell of lot of detail here. __declspec(dllexport) tells linker want object made available other dll's import. used when creating dll others can link to. __declspec(dllimport) imports implementation dll application can use it. i'm novice c/c++ developer, perhaps someone's got better explanation i.

.net - Databinding an enum property to a ComboBox in WPF -

as example take following code: public enum exampleenum { foobar, barfoo } public class exampleclass : inotifypropertychanged { private exampleenum example; public exampleenum exampleproperty { { return example; } { /* set , notify */; } } } i want databind property exampleproperty combobox, shows options "foobar" , "barfoo" , works in mode twoway. optimally want combobox definition this: <combobox itemssource="what goes here?" selecteditem="{binding path=exampleproperty}" /> currently have handlers combobox.selectionchanged , exampleclass.propertychanged events installed in window binding manually. is there better or kind of canonical way? use converters , how populate combobox right values? don't want started i18n right now. edit so 1 question answered: how populate combobox right values. retrieve enum values list of strings via objectdataprovider static enum.getvalues method: <window.resources...

Replacing plain text password for app -

we storing plain text passwords web app have. i keep advocating moving password hash developer said less secure -- more passwords match hash , dictionary/hash attack faster. is there truth argument? absolutely none. doesn't matter. i've posted similar response before: it's unfortunate, people, programmers, emotional swayed argument. once he's invested in position (and, if you're posting here, is) you're not convince him facts alone. need switch burden of proof. need him out looking data hopes convince you, , in doing learn truth. unfortunately, has benefit of status quo, you've got tough road there.

silverlight - How to change data context and re-render single RadGridRow -

after rendering full grid need change data context of selected row since "simple" objects filled data source , when single item selected (looking @ rowdetailsvisibilitychanged event), want change datacontext complex object, shows more info in details in collapsed row. using gridviewrowdetailseventargs.detailselement.datacontext seems trick details element expanded below row on selecting, header (columns) stay same , values not updated when changing gridviewrowdetailseventargs.detailselement.datacontext or gridviewrowdetailseventargs.row.datacontext . (imagine column of collapsed row bound name, name "john", , when expanding, row.datacontext changed to object property name "john dough", column still shows "john"). ok found solution , seems pretty simple. so ... hook event handler radgridview.rowdetailsvisibilitychanged , in event handler change item property of provided row: private void onrowdetailsvisibilitychanged(object se...

Paraview and Python on Mac OSX -

i've installed binary distribution of paraview on osx. when running can access python interpreter tools -> python shell. cannot figure out libraries need add pythonpath in order access vtk , paraview functionality directly python. of course compile source distribution myself, take lot of time. ideas? i basing answer on built paraview 3.9.0 cvs. should able access paraview directly regular python if add: <paraview-bld-directory>/utilities/vtkpythonwrapping/site-packages <paraview-bld-directory>/bin to pythonpath variable. did same approach fail work when tried binary distribution? sorry, wasn't sure how interpret comment working if build hand.

javascript - Is there a way to send form when element outside of form is clicked? -

as title says, there way send form when element outside of form clicked? plus, available without using form associated ( button / input etc.) elements? as example, can form submitted when div clicked? sure: <form name="myform" action="" method="post"> <!-- form inputs go here --> </form> <div id="formsubmit"></div> <script type="text/javascript"> var myform = document.forms['myform']; var formsubmit = document.getelementbyid('formsubmit'); formsubmit.onclick = function(){ myform.submit(); } </script>

c++ - RegQueryValueExW only brings back one value from registry -

i querying registry on windows ce. want pull dhcpdns value tcpip area of registry, works. what happens though, however, if there 2 values - displayed "x.x.x.x" "x.x.x.x" in ce registry editor - brings 1 of them. sure silly mistake unsure why happening. here code using std::string isapiconfig::gettcpipregsetting(const std::wstring &regentryname) { hkey hkey = 0; hkey root = hkey_local_machine; long retval = 0; wchar_t buffer[3000]; dword buffersize = 0; dword datatype = 0; std::string datastring = ""; //open ip regkey retval = regopenkeyexw(root, l"comm\\pci\\fetce6b1\\parms\\tcpip", 0, 0, &hkey); //pull out info need memset(buffer, 0, sizeof(buffer)); buffersize = sizeof(buffer); retval = regqueryvalueexw(hkey, regentryname.c_str(), 0, &datatype, reinterpret_cast<lpbyte>(buffer), &buffersize); unicode::unicodetoansi(buffer, datastring); return data...

security - Manage User and Roles -

in wpf desktop sample book store application want manage users , roles. multiple users want achieve below points 1) application should have multiple user 2) user has 3 categories a) admin b) manager c) employee 3) application can have multiple roles like, add books, sale books, update stocks, generate purchase order etc 4) user should able assign , remove roles of other user lower in herarchy. ideal user herarchy :- a) admin - top having full rights b) manager - having roles added , removed admin c) employee - having roles added , remover manager / admin. i need approach implenet it. approach should flexible in future roles , user addition / removal easy; without change of database structure , line of codes. higher manager can assign roles individual employee. first, refer "categories" "roles" , current "roles" "privileges" need following tables user, roles, privileges, userroles, , userprivileges. build app l...

printing - C++ alternative to perror() -

i know can use perror() in c print errors. wondering if there c++ alternative this, or whether have include (and therefore stdio.h) in program. trying avoid many c functions possible. thanks! you like: std::cerr << strerror(errno) << std::endl; that still ends calling strerror , you're substituting 1 c function another. otoh, let write via streams, instead of mixing c , c++ output, thing. @ least afaik, c++ doesn't add library act substitute strerror (other generating std::string , i'm not sure change strerror anyway).

Optimize SQL statement for android sqlite -

i'm developing application tracks user's current position , stores sqlite database. works fine, have problem when querying database track more 1000 records takes 1.5 minutes. on desktop takes 1 second. i know it's query many subselects wasn't able right result way. in opinion belongs aggregate functions avg() , sum(). here's query: cursor c = readabledb .rawquery( "select distinct t._id , title , strftime('%y-%m-%d' , starttime , 'unixepoch' , 'localtime') date , description, " + "round((select sum(disttoprev)/1000 positions p p.trackid=t._id) , 2) distance , " + "(select count(latitude) positions p p.trackid=t._id) waypoints, " + "(select (avg(speed)*3.6) positions p p.trackid=t._id) avgspeed, " + "(select (max(speed)*3.6) positions p p.trackid=t._id) maxspeed, " + "(select sum(altitudeup) positions p ...

iphone - how to add back ground image to navigation controller root view -

i want add bg image root view visible in views .... have uiimageview behind navigation controller. make background visible view controller of navigation controller transparent.

c++ - C++0x lambda, how can I pass as a parameter? -

please @ following c++0x lambda related code: typedef uint64_t (*weight_func)(void* param); typedef std::map<std::string, weight_func> callbacktable; callbacktable table; table["rand_weight"] = [](void* param) -> uint64_t { return (rand() % 100 + 1); }; i got error (in visual studio 2010) lambda couldn't converted type of weight_func . know answer: using std::function object : typedef std::function<uint64_t (void*)> weight_func; however, want know how can receive type of lambda without using std::function . type should be? the conversion function pointer relatively new: introduced n3043 on february 15, 2010. while e.g. gcc 4.5 implements it, visual studio 10 released on april 12, 2010 , didn't implement in time. james pointed out, will fixed in future releases. for moment have use 1 of alternative solutions provided here. technically following workaround work, without variadic templates no fun generalize (boost.pp rescu...

c++ - Merge sorted arrays - Efficient solution -

goal here merge multiple arrays sorted resultant array. i've written following solution , wondering if there way improve solution /* goal merge sorted arrays */ void mergeall(const vector< vector<int> >& listofintegers, vector<int>& result) { int totalnumbers = listofintegers.size(); vector<int> curpos; int currow = 0 , minelement , foundminat = 0; curpos.reserve(totalnumbers); // set current position travered 0 in array elements ( int = 0; < totalnumbers; ++i) { curpos.push_back(0); } ( ; ; ) { /* find first minimum first element in array hasn't been traversed */ ( currow = 0 ; currow < totalnumbers ; ++currow) { if ( curpos[currow] < listofintegers[currow].size() ) { minelement = listofintegers[currow][curpos[currow] ]; foundminat = currow; break; ...

asp.net mvc 2 - ASP MVC 2 in Sharepoint 2007 Security Exception -

i trying configure asp mvc 2 framework run within sharepoint 2007 install on iis 6.0. have managed 2 web.config setups together, , made gac , global.asax changes. when try access mvc application within sharepoint domain ( http://sharepoint.com/mvcapp ), security exception. **source error:** unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. **stack trace:** [securityexception: request permission of type 'system.web.aspnethostingpermission, system, version=2.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089' failed.] system.web.mvc.buildmanagerwrapper.system.web.mvc.ibuildmanager.getreferencedassemblies() +14 system.web.mvc.typecacheutil.filtertypesinassemblies(ibuildmanager buildmanager, predicate`1 predicate) +88 system.web.mvc.typecacheutil.getfilteredtypesfromassemblies(string cachename, predicate`1 predicate, ibuildmanager ...

date - DateTime Utility for ASP.net -

i wondering if suggest utility library has useful functions handling dates in asp.net taking away of leg work have when handling dates? subsonic sugar has nice functions: http://subsonichelp.com/html/1413bafa-b5aa-99aa-0478-10875abe82ec.htm http://subsonicproject.googlecode.com/svn/trunk/subsonic/sugar/ is there better out there? i wanting work out start(mon) , end(sun) dates of last 5 weeks. i thinking this: datetime = datetime.now; while(now.dayofweek != dayofweek.monday) { now.adddays(-1); } for(int i=0; i<5;i++) { addtodateslist(now, now.adddays(7)); now.adddays(-7); } but seems crappy? plus not want because need time of start date 00:00:00 , time of end date 23:59:59 is there specific problem trying handle dates? if existing date api in .net can handle problem cleanly, see no reason consider 3rd party library it. when in .net, had deal dates quite bit, , standard libraries provided fair amount of ...

xslt - Match conditionally upon current node value -

given following xml: <current> <login_name>jd</login_name> </current> <people> <person> <first>john</first> <last>doe</last> <login_name>jd</login_name> </preson> <person> <first>pierre</first> <last>spring</last> <login_name>ps</login_name> </preson> </people> how can "john doe" within current/login matcher? i tried following: <xsl:template match="current/login_name"> <xsl:value-of select="../people/first[login_name = .]"/> <xsl:text> </xsl:text> <xsl:value-of select="../people/last[login_name = .]"/> </xsl:template> i'd define key index people: <xsl:key name="people" match="person" use="login_name" /> using key here keeps code clean, might find helpful efficiency if you're...

php - Converting a multi-dimensional array (javascript) to JSON (or similar) for transport -

i'm generating multi-dimensional array in javascript looks (this json representation of javascript array, it's not in json format): "100": { "40": { "subtotal": "24.99", "turn-around": { "0": "2-4 business days", "1": "next business day (add $15.00)" }, "shipping": { "0": "ups ground - $0.00", "1": "ups 2nd day air - $14.73", "2": "ups 3 day select - $13.13" } }, "41": { "subtotal": "29.99", "turn-around": { "0": "2-4 business days", "1": "next business day (add $15.00)" }, "shipping": { "0": "ups ground - $0.00", "1": "ups 2nd day air - $14.73", "2": "ups...

nlp - Is there an algorithm that tells the semantic similarity of two phrases -

input: phrase 1, phrase 2 output: semantic similarity value (between 0 , 1), or probability these 2 phrases talking same thing you might want check out paper: sentence similarity based on semantic nets , corpus statistics (pdf) i've implemented algorithm described. our context general (effectively 2 english sentences) , found approach taken slow , results, while promising, not enough (or without considerable, extra, effort). you don't give lot of context can't recommend reading paper useful in understanding how tackle problem. regards, matt.

flex - How do I prevent Flash's URLRequest from escaping the url? -

i load xml servlet flex application this: _loader = new urlloader(); _loader.load(new urlrequest(_servleturl+"?do=load&id="+_id)); as can imagine _servleturl http://foo.bar/path/to/servlet in cases, url contains accented characters (long story). pass unescaped string urlrequest , seems flash escapes , calls escaped url, invalid. ideas? my friend luis figured out: you should use encodeuri utf8url encoding http://livedocs.adobe.com/flex/3/langref/package.html#encodeuri() but not unescape because unescapes ascii see http://livedocs.adobe.com/flex/3/langref/package.html#unescape() i think getting %e9 in url instead of expected %c3%a9. http://www.w3schools.com/tags/ref_urlencode.asp

svn - How do I move a file (or folder) from one folder to another in TortoiseSVN? -

i move file or folder 1 place within same repository without having use repo browser it, , without creating 2 independent add/delete operations. using repo browser works fine except code hanging in broken state until supporting changes checked in afterwards (like .csproj file example). update: people have suggested "move" command line. there tortoisesvn equivalent? to move file or set of files using tortoise svn , right-click-and-drag target files destination , release right mouse button. popup menu have svn move versioned files here option. note destination folder must have been added repository svn move versioned files here option appear.

asp.net - Shared/Static variable in Global.asax isolated per request? -

i have asp.net web services share common helper class need instantiate 1 instance of per server . it's used simple translation of data, spend time during start-up loading things web.config file, etc. the helper class 100% thread-safe. think of simple library of utility calls. i'd make methods shared on class, want load initial configuration web.config. we've deployed web services iis 6.0 , using application pool, web garden of 15 workers. i declared helper class private shared variable in global.asax, , added lazy load shared readonly property this: private shared _helper myhelperclass public shared readonly property helper() myhelperclass if _helper nothing _helper = new myhelperclass() end if return _helper end end property i have logging code in constructor myhelperclass() , , shows constructor running each request, on same thread. i'm sure i'm missing key detail of asp.net msdn hasn't been helpful. i...

javascript - Best Way to Organize an ExtJS Project -

i've started developing extjs application plan support lightweight json php service. other that, standalone. question is, best way organize files , classes inevitably come existence? have experience large extjs projects (several thousand lines). ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ i start here http://blog.extjs.eu/know-how/writing-a-big-application-in-ext/ this site gives introductory overview of how structure application. we using these ideas in 2 of our asp.net mvc / extjs applications.

android - How do I prevent TextView from stretching out it's parent LinearLayout? -

it seems textview inside linearlayout forces linearlayout larger. trying split screen top 50% , bottom 50% , bottom 50% split 3 parts. did weights 3 (for top), , 1, 1, 1 (for bottom) total of 6. here looks like. http://i.imgur.com/3fjsw.jpg as take out textview inside first linearlayout splits proper. moment put textview inside top linearlayout top linerlayout gets larger amount of the textview. here code: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:background="#cccccc" android:layout_weight="3"> <te...

delphi - How do I make the "show/hide desktop icons" setting take effect? -

the code below calls shgetsetsettings function hide desktop icons unchecked "show desktop icons" view menu. i called shchangenotify(shcne_assocchanged, shcnf_flushnowait, nil, nil); update desktop doesn't work? var lpss: shellstate; begin lpss.data := high(cardinal); lpss.data2 := low(cardinal); shgetsetsettings(lpss,ssf_hideicons,true); shchangenotify(shcne_assocchanged, shcnf_flushnowait, nil, nil); end; isa, refresh desktop can send f5 key progman (program manager) window postmessage(findwindow('progman', nil), wm_keydown, vk_f5, 3); another alternative hide desktop icons showwindow(findwindow('progman', nil),sw_hide); //hide icons desktop , refresh screen to show again showwindow(findwindow('progman', nil),sw_show); //show icons of desktop , refresh

python - mod_python/MySQL error on INSERT with a lot of data: "OperationalError: (2006, 'MySQL server has gone away')" -

when doing insert lot of data, ie: insert table (mediumtext_field) values ('...lots of text here: 2mb worth...') mysql returns "operationalerror: (2006, 'mysql server has gone away')" this happening within minute of starting script, not timeout issue. also, mediumtext_field should able hold ~16mb of data, shouldn't problem. any ideas causing error or how work around it? some relevant libraries being used: mod_python 3.3.1 , mysql 5.0.51 (on windows xp sp3, via xampp, details below) apachefriends xampp (basic package) version 1.6.5 apache 2.2.6 mysql 5.0.51 phpmyadmin 2.11.3 check max_packet setting in my.cnf file. determines largest amount of data can send mysql server in single statement. exceeding values results in error.

Best online resource to learn Python? -

i new scripting language. but, still worked on scripting bit tailoring other scripts work purpose. me, best online resource learn python? [response summary:] some online resources: http://docs.python.org/tut/tut.html - beginners http://diveintopython3.ep.io/ - intermediate http://www.pythonchallenge.com/ - expert skills http://docs.python.org/ - collection of knowledge some more: byte of python. python 2.5 quick reference python side bar a nice blog beginners think python: introduction software design if need learn python scratch - can start here: http://docs.python.org/tut/tut.html - begginers guide if need extend knowledge - continue here http://diveintopython3.ep.io/ - intermediate level book if need perfect skills - complete http://www.pythonchallenge.com/ - outstanding , interesting challenge and perfect source of knowledge http://docs.python.org/ - collection of knowledge

.net - How do I reference a local resource in generated HTML in WinForms WebBrowser control? -

i'm using winforms webbrowser control display content in windows forms app. i'm using documenttext property write generated html. part working spectacularly. want use images in markup. (i prefer use linked css , javascript, however, can worked around embedding it.) i have been googling on course of several days , can't seem find answer title question. i tried using relative reference: app exe in bin\debug. images live in "images" directory @ root of project. i've set images copied output directory on compile, end in bin\debug\images*. use reference "images..." thinking relative exe. however, when @ image properties in embedded browser window, see image url "about:blankimages/*". seems relative "about:blank" when html written control. lacking location context, can't figure out use relative file resource reference. i poked around properties of control see if there way set fix this. created blank html page, ,...

svn - Subversion and Siteminder -

has implements subversion siteminder authentication provider ? if yes, possible provide overview of how whole setup done ? since using http authentication, think easier integrate sm, not able find on over net. is there pitfall setup ? possible ? svn siteminder has been implemented , working now. since there not of information out there on this, post overview of steps followed: cookie based authentcation disabled on siteminder end http auth enabled (in siteminder) , webdav methods added policy server handled siteminder authentication disabled on apache end (http auth) svn

javascript - When are you supposed to use escape instead of encodeURI / encodeURIComponent? -

when encoding query string sent web server - when use escape() , when use encodeuri() or encodeuricomponent() : use escape: escape("% +&="); or use encodeuri() / encodeuricomponent() encodeuri("http://www.google.com?var1=value1&var2=value2"); encodeuricomponent("var1=value1&var2=value2"); escape() special characters encoded exception of: @*_+-./ the hexadecimal form characters, code unit value 0xff or less, two-digit escape sequence: %xx. characters greater code unit, four-digit format %uxxxx used. https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/escape encodeuri() use encodeuri when want working url. make call: encodeuri("http://www.example.org/a file spaces.html") to get: http://www.example.org/a%20file%20with%20spaces.html don't call encodeuricomponent since destroy url , return http%3a%2f%2fwww.example.org%2fa%20file%20with%20spaces.html encodeuric...

programming languages - Why do you or do you not implement using polyglot solutions? -

polyglot, or multiple language, solutions allow apply languages problems best suited for. yet, @ least in experience, software shops tend want apply "super" language aspects of problem trying solve. sticking language come "hell or high water" if language available solves problem , naturally. why or not implement using polyglot solutions? i advocate more 1 language in solution space (actually, more 2 since sql part of many projects). if client likes language explicit typing , large pool of talent, advocate use of scripting languages administrative, testing, data scrubbing, etc. the advantages of many-language boil down "right tool job." there legitimate disadvantages, though: harder have collective code ownership (not versed in languages) integration problems (diminished in managed platforms) increased runtime overhead infrastructure libraries (this significant) increased tooling costs (ides, analysis tools, etc.) cognitive "b...

cocoa touch - Why can't new ObjC classes descend from UIViewController? -

so, i've been making ios apps since first ipod touch came out, has flabbergasted me; why list of new cocoa touch classes restricted subclasses of nsobject, uiview, , uitableview? routinely make subclasses of uiimageview , uiviewcontroller. am "doing wrong™?" have totally misunderstood mvc point make controller classes shouldn't? philosophical reasoning requiring classes never descend basic controller class? like @themikeswan says, there aren't gui templates when create new class in xcode gui. can create new subclass parent nsobject. after that, go code , change parent class whatever like. so... no, not doing wrong in sense rightly understand want subclass uiviewcontroller; yes, doing wrong since assume shouldn't because xcode gui not support :)

recovery - How to recover a dropped stash in Git? -

i use git stash , git stash pop save , restore changes in working tree. yesterday had changes in working tree had stashed , popped, , made more changes working tree. i'd go , review yesterday's stashed changes, git stash pop appears remove references associated commit. i know if use git stash .git/refs/stash contains reference of commit used create stash. , .git/logs/refs/stash contains whole stash. references gone after git stash pop . know commit still in repository somewhere, don't know was. is there easy way recover yesterday's stash commit reference? note isn't critical me today because have daily backups , can go yesterday's working tree changes. i'm asking because there must easier way! if have popped , terminal still open, still have hash value printed git stash pop on screen (thanks, dolda). otherwise, can find using linux , unix: git fsck --no-reflog | awk '/dangling commit/ {print $3}' and windows: git fs...

orm - What is N+1 SELECT query issue? -

select n+1 stated problem in object-relational mapping (orm) discussions, , understand has having make lot of database queries seems simple in object world. does have more detailed explanation of problem? let's have collection of car objects (database rows), , each car has collection of wheel objects (also rows). in other words, car -> wheel 1-to-many relationship. now, let's need iterate through cars, , each one, print out list of wheels. naive o/r implementation following: select * cars; and for each car : select * wheel carid = ? in other words, have 1 select cars, , n additional selects, n total number of cars. alternatively, 1 wheels , perform lookups in memory: select * wheel this reduces number of round-trips database n+1 2. orm tools give several ways prevent n+1 selects. reference: java persistence hibernate , chapter 13.

windows services - How to get runonce to run, without having to have an administrator login -

is there way force update of software using runonce, without having administrator log in, if there service running administrator running in background? edit : main thing want able run when runonce does, i.e. before explorer starts. need able install things, without booting administrator account. i'm not sure understand question. let me try: the service mention, yours? if so, can add code imitate windows: service, examine runonce value , launch executable specifies. can use createprocessasuser() api launch in context of arbitrary user. after launching process, delete runonce entry. or have misunderstood question? edit: service not depend on user being logged in. can start update process service service starts, happen before real user logs in computer.

svn - Moving Directories with History -

i have svn structure this: /projects /project1 /project2 /somefolder /project3 /project4 i move projects /projects folder, means want move projects 3 , 4 /somefolder /projects folder. the caveat: i'd keep full history. assume every client have check out stuff new location again, fine, still wonder simplest approach move directories without destroying history? subversion 1.5 if matters. svn rename moving/renaming in subversion keeps history intact.

Design by contract using assertions or exceptions? -

when programming contract function or method first checks whether preconditions fulfilled, before starting work on responsibilities, right? 2 prominent ways these checks assert , exception . assert fails in debug mode. make sure crucial (unit) test separate contract preconditions see whether fail. exception fails in debug , release mode. has benefit tested debug behavior identical release behavior, incurs runtime performance penalty. which 1 think preferable? see releated question here disabling assert in release builds saying "i never have issues whatsoever in release build", not case. assert shouldn't disabled in release build. don't want release build crashing whenever errors occur either, you? so use exceptions , use them well. use good, solid exception hierarchy , ensure catch , can put hook on exception throwing in debugger catch it, , in release mode can compensate error rather straight-up crash. it's safer way go.

Is there an SQLite equivalent to MySQL's DESCRIBE [table]? -

i'm getting started learning sqlite . nice able see details table, mysql's describe [table] . pragma table_info [table] isn't enough, has basic information (for example, doesn't show if column field of sort or not). sqlite have way this? the sqlite command line utility has .schema tablename command shows create statements.

Can a .NET windows application be compressed into a single .exe? -

i not familiar .net desktop applications (using visual studio 2005 ). possible have entire application run single .exe file? yes, can use ilmerge tool.

PHP: Error trying to run a script via Cron job -

i have setup cron job via control panel. have uploaded script via ftp, set it's permission 777 (is safe so?) & gave path script in job. script makes use of dependent scripts able run job. confusing? here's it's like: cron.php <?php require("some_file1.php"); require("file1.php"); require("folder1/file1.php"); require("folder1/file2.php"); require("folder2/file1.php"); //this value received 1 of require files above after come calculations $get_content = 'this value received after calculations.'; mail('hi', 'email@mydomain.com', $get_content, 'error'); ?> i have opted receive confirmation of cron job email & here's error received: mydomain.com/cron.php: line 1: syntax error near unexpected token `(' mydomain.com/cron.php: line 1: `<?php require("some_file1.php"); ' i tried talking support don't have idea of technical detail & technic...

How to disable Javascript in mshtml.HTMLDocument (.NET) -

i've got code : dim document new mshtml.htmldocument dim idoc mshtml.ihtmldocument2 = ctype(document, mshtml.ihtmldocument2) idoc.write(html) idoc.close() however when load html executes javascripts in doing request resources "html" code. i want disable javascript , other popups (such certificate error). my aim use dom mshtml document extract tags html in reliable way (instead of bunch of regexes). or there ie/office dll can load html wihtout thinking ie related popups or active scripts? dim document new mshtml.htmldocument dim idoc mshtml.ihtmldocument2 = ctype(document, mshtml.ihtmldocument2) 'add code idoc.designmode="on" idoc.write(html)idoc.close()

c++ - Should I store entire objects, or pointers to objects in containers? -

designing new system scratch. i'll using stl store lists , maps of long-live objects. question: should ensure objects have copy constructors , store copies of objects within stl containers, or better manage life & scope myself , store pointers objects in stl containers? i realize short on details, i'm looking "theoretical" better answer if exists, since know both of these solutions possible. two obvious disadvantage playing pointers: 1) must manage allocation/deallocation of these objects myself in scope beyond stl. 2) cannot create temp object on stack , add containers. is there else i'm missing? since people chiming in on efficency of using pointers. if you're considering using std::vector , if updates few , iterate on collection , it's non polymorphic type storing object "copies" more efficent since you'll better locality of reference. otoh, if updates common storing pointers save copy/relocation costs. ...

jquery - how to pass new query to Flexigrid? -

im trying pass new query flexigrid using code: $('#fgallpatients').flexreload({ query: 'blah=qweqweqwe' }); but when goes webservice, gets old parameter , new 1 neglected. help! you need this $('#fgallpatients').flexoptions({ query: 'blah=qweqweqwe' }).flexreload(); sorry late haven't been paying attention tag lately

tStringList passing in C# to Delphi DLL -

i have delphi dll function defined as: function submitjobstringlist(joblist: tstringlist; var jobno: integer): integer; i calling c#. how declare first parameter tstringlist not exist in c#. have declaration as: [dllimport("opt7bja.dll", charset = charset.ansi, callingconvention = callingconvention.stdcall)] public static extern int submitjobstringlist(string[] tstringlist, ref int jobno); but when call memory access violation exception. anyone know how pass tstringlist correctly c#? you'll not have luck this. tstringlist more array, it's full-blown class, , exact implementation details may differ possible .net. take @ delphi vcl source code (that is, if have it) , try find out if can rebuild class in c#, , pass of best friend, interop marshaller. note delphi string type different .net string type, , passing without telling marshaller should do, pass char-array, likely. other that, suggest changing delphi dll. it's never thing expose delph...

crystal reports - How to make ODBC connection in web.Config file -

i make crystal reporting sybase database. use reportviewer view report. stuck on how make odbc connection in web.config file. i had done winforms still learning. have @ connectionstrings.com: http://www.connectionstrings.com/sybase-advantage , http://www.connectionstrings.com/sybase-adaptive

.net - Adjusting the auto-complete dropdown width on a textbox -

i using textbox in .net 2 winforms app setup custom autocompletesource. there anyway through code can increase width of list appears containing auto complete suggestions? ideally without increasing width of textbox short space in ui. not know of, can auto-size textbox wide when needs be, rather wide longest text. example http://forums.microsoft.com/msdn/showpost.aspx?postid=3311429&siteid=1 public class form1 private withevents t textbox private sub form1_load(byval sender system.object, byval e system.eventargs) handles mybase.load t = new textbox t.setbounds(20, 20, 100, 30) t.font = new font("arial", 12, fontstyle.regular) t.multiline = true t.text = "type here" t.selectall() controls.add(t) end sub private sub t_textchanged(byval sender object, byval e system.eventargs) handles t.textchanged dim width integer = textrenderer.measuretext(t.text, t.font).width + 10 dim height integer = textrenderer.measur...

iphone - Probelem with NSTimer -

i have problem nstimer . received "sigabrt" error , [nscftimer intvalue]: unrecognized selector sent instance these code: -(void)detectionmove:(nsnumber*)arrayindex{ static bool notfind = false; static int countvariable = 0; static int countrilevamenti = 0; notfind = false; for(int = countvariable+1; i<[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]count]; i++){ if(!notfind){ if((actualaccelerometerx+sensibilitymovement) >= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuex] && (actualaccelerometerx-sensibilitymovement) <= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]objectatindex:i]valuex] && (actualaccelerometery+sensibilitymovement) >= [[[[[sharedcontroller arraymovement]objectatindex:[arrayindex intvalue]] arraypositionmove]obj...

untagged - What's the most egregious pop culture perversion of programming? -

i'm thinking along lines of virtual world representation in hackers . uploading virus mac alien spacecraft in independence day.

asp classic - ASP shopping cart -

hello based on example @ http://www.15seconds.com/issue/010411.htm create asp shop rewrite connection db don't have dedicated server . instead of sub subgetdsncreateconn strbasketdsn = application("strbaskdsn") set baskconn = server.createobject ("adodb.connection") baskconn.connectionstring = strbasketdsn baskconn.open end sub and set savedbaskconn = server.createobject ("adodb.connection") savedbaskconn.connectionstring = application("strbaskdsn") savedbaskconn.open i use like: conn="provider=sqloledb;server=localhost;uid=username;pwd=password;database=shop" set rs = server.createobject("adodb.recordset") rs.open strsql, conn and can't make work .. point me in right direction or give me better tutorial how create classic asp shopping cart hold big traffic? thank you can ask why don't change settings in: strbasketdsn = application("strbaskdsn") to match requirement, rathe...

python - Is there a built-in function to print all the current properties and values of an object? -

so i'm looking here php's print_r function. can debug scripts seeing what's state of object in question. you mixing 2 different things. use dir() , vars() or inspect module interested in (i use __builtins__ example; can use object instead). >>> l = dir(__builtins__) >>> d = __builtins__.__dict__ print dictionary fancy like: >>> print l ['arithmeticerror', 'assertionerror', 'attributeerror',... or >>> pprint import pprint >>> pprint(l) ['arithmeticerror', 'assertionerror', 'attributeerror', 'baseexception', 'deprecationwarning', ... >>> pprint(d, indent=2) { 'arithmeticerror': <type 'exceptions.arithmeticerror'>, 'assertionerror': <type 'exceptions.assertionerror'>, 'attributeerror': <type 'exceptions.attributeerror'>, ... '_': [ 'arithmeticer...

interface - Why can final constants in Java be overridden? -

consider following interface in java: public interface { public final string key = "a"; } and following class: public class implements { public string key = "b"; public string getkey() { return key; } } why possible class come along , override interface i's final constant? try yourself: a = new a(); string s = a.getkey(); // returns "b"!!! despite fact shadowing variable it's quite interesting know can change final fields in java can read here : java 5 - "final" not final anymore narve saetre machina networks in norway sent me note yesterday, mentioning pity change handle final array. misunderstood him, , started patiently explaining not make array constant, , there no way of protecting contents of array. "no", said he, "we can change final handle using reflection." i tried narve's sample code, , unbelievably, java 5 allowed me modify fi...

versioning - approaches to WCF service version control -

we implementing numerous services in our company , running versioning issues data contracts. 1 of problems have our data contract used model of actual application behind service. wondering approach others have taken in kind of situation or service versioning in general. aware of microsoft best practices guide wanted see if has other ideas on how version. the first rule of services, business object != message object. basicly, never expose business objects data contracts. or say, can't fax cat. can send facsimile of cat, can't send cat on wire. here's great picture remind you: http://www.humorhound.com/2009/04/demotivational-poster-youre-doing-it-wrong/ in more modern terms, mvvm pattern. view of model domain layer uses not built client, have create separate model , view other layers. yes seems lot more work, in end easier , better way build service oriented applications. versioning 1 of ways makes life easier. other important thing tend build models g...

sql - 2-column distinct? -

i'm trying select 2 distinct numbers id1 , id2 following table: tb_table1( bigint id1 bigint id2 bigint userid) if select distinct id1, id2 tb_table1 i'll get, example, 2 rows, (111, 222) , (222,111). i want 1 of rows since don't care column, id1, or id2 result gets returned in. basically, want distinct pairs order doesn't matter. thoughts? in advance. it remiss of me not point out suggests table not quite normalized should - when users acquire third id? anyway. using fact union (as opposed union all ) automatically de-duplicate, do select id1, id2 tb_table1 id1 < id2 union select id2, id1 tb_table1 not id1 < id2

ruby on rails architecture model, view and DTOs -

i .net guy , try understand concept behind rails , active record stuff. as can see in examples assume view 1:1 copy of model. in reality that´s not true. like view holds customer and contact person(s) not related customer. user should able edit both (customer , contact person(s) in 1 view e.g.) in every example see bind view directly 1 activerecord object. stuff model, validation , on bind 1 object mapped directly database. could rails guy explain what´s elegant way work active record in real life applications in complex model situations? in first moment thinking dtos not imagine way go rails. agree john.... you asked: "like view holds customer , contact person(s) not related customer. user should able edit both (customer , contact person(s) in 1 view e.g.)" ok, customer model has employees, right? if not, replace "employee" "person" /app/model/customer.rb class customer < activerecord::base has_many :employees accepts...

oop - Can PHP static methods legally have a visibilty of protected or private? -

i realize it's possible define static class method private , protected in php. allows instantiated class, or public static method access it's own private/protected static methods. protected static function jumpover () however i'm not sure if legal in sense of oop design. can't find real info stating it's ok this. i'm worried php may "patch" in future versions if not valid , break scripts. thanks help. it is. static methods nothing more helper methods have code possibly don't want public. the other common object-oriented languages can think of have (c++, java, c#). don't think they're ever going remove feature. besides, guys @ php slow @ breaking existing features, wouldn't worry it.

c# - WebBrowser control executing from service issue -

ok, here's deal -- i'm running windows forms webbrowser control service. know thats no-no, seems work alright. the thing i'm running problem trying wait browser's pages load. in normal application, i'd like while (browser.readystate != complete) application.doevents() obviously won't work service. i've tried alternative: public class webcrawler { private class exposedactivexwebbrowser : system.windows.forms.webbrowser { public shdocvw.webbrowser underlyingwebbrowser { { return activexinstance shdocvw.webbrowser; } } } exposedactivexwebbrowser worker; public webbrowserreadystate readystate { { return worker.readystate; } } public htmldocument document { { return worker.document; } } public webcrawler() { worker = new exposedactivexwebbrowse...

c# - Problem sorting lists using delegates -

i trying sort list using delegates getting signature match error. compiler says cannot convert 'anonymous method' list<mytype> mylist = getmylist(); mylist.sort( delegate (mytype t1, mytype t2) { return (t1.id < t2.id); } ); what missing? here references found , same way. developer fusion reference microsoft reference i think want: mylist.sort( delegate (mytype t1, mytype t2) { return (t1.id.compareto(t2.id)); } ); to sort need other "true/false", need know if equal to, greater than, or less than.

How do I get Vim to highlight matching parenthesis? -

when browse code in vim, need see opening , closing parenthesis/ brackets, , pressing % seems unproductive. i tried :set showmatch , makes cursor jump , forth when type in bracket. if browsing written code? domatchparen in .vimrc file or :domatchparen within vim itself. edit: comes pi_paren plugin (which standard plugin).

security - T-SQL schemata to organize code -

i have ms sql server database growing number of stored procedures , user defined functions , see need organize code better. idea split sps , functions on several schemata. default schema hold the sps called outside. api of database in other words. second schema hold internal code, should not called outside. same tables: contain "raw" data, hold precalculated data optimizations, ... as have never used schema, have several questions: does make sense @ all? are there implications i'm not aware of? example performance issues when sp in schema using table in schema x? is possible restrict "outer world" use sps in schema? example: user allowed call objects in schema a, sps in schema still allowed use tables in schema b? as question subjective, have marked "community wiki". hope ok. yes, makes sense no difference in performance if schemas have same owner (ownership chaining) yes, permission schemas explicitly per client or have check...

java - Html.fromHtml(String) + Linebreak Problem -

i'd display text linebreak in alert message: private void showabout() { alertdialog.builder builder = new alertdialog.builder(context); string message = "<b>rechtlicher hinweis:</b>\nlorem ipsum dolor sit amet, consectetur adipiscing elit. sed dolor sapien. etiam arcu erat, lobortis sed vestibulum ut, adipiscing et enim. nulla vestibulum volutpat dolor, non pellentesque purus imperdiet vitae. aenean et elit vel erat consectetur pulvinar. sed semper, ante vel elementum aliquet, dui urna scelerisque tortor, eu auctor lorem nunc adipiscing velit. praesent eget libero diam, eget imperdiet sem. vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae.\n" + getversioninfo(); builder.setmessage(html.fromhtml(message)); builder.setcancelable(false); builder.setpositivebutton("close", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int...

asp.net - Automatic .aspx publishing in SharePoint -

i publishing code behind .aspx in sharepoint. can automatically publish .dll bin folder of virtual directory, cannot figure out how push .aspx pages , images server without manually using sharepoint designer. where folder exist? or need create sharepoint feature this? the .aspx files under c:\program files\common files\microsoft shared\web server extensions\12\templates\layouts a quick , dirty way deploy new functionality (which accessible on server) drop aspx's folder. not safe, gives way test things before investing time full blown solution/feature deployment. i suggest reading on andrew connell's development methods, think has book doing sharepoint development out too. 'developing sharepoint features' talk best jumpstart doing sharepoint development i've heard. http://www.andrewconnell.com/blog/

vb.net - How do I copy from, erase, then paste back into the clipboard? -

i have automate program outside of control. way i'm doing use sendkeys.sendwait("keys") other program. problem is, there multiple fields might active , no way select single 1 confidence. fields different lengths, solution copy long, copy clipboard, , @ last character made though, know field selected in other program. overrides clipboard, unfortunately. so, need these things. copy clipboard contents, anything, variable. send bunch of things other program , copy it. use other things. copy first variable clipboard. ideally, able copy clipboard (images, text, rich text) , place nothing happened. here's i've got far, erases whatever in clipboard, or replaces special can't pasted notepad. appactivate("otherprogram") dim oldclipboard idataobject = clipboard.getdataobject //'type long stuff, select all, cut clipboard sendkeys.sendwait("{esc}{f3}1234567890abcdefghijklmnopqrstuvwxyz" + "+{home}^x") dim selectedfieldtext...

iphone - How do I rotate an object using OpenGL ES 2.0? -

in opengl es 1.1, can use glrotatef() rotate model, function doesn't exist in opengl es 2.0. therefore, how perform rotation in opengl es 2.0? to follow on christian's said, you'll need keep track of model view matrix , manipulate perform rotations need. you'll pass in matrix uniform shader, , following: attribute vec4 position; uniform mat4 modelviewprojmatrix; void main() { gl_position = modelviewprojmatrix * position; } i've found core animation catransform3d helper functions work performing right kind of matrix manipulations needed this. can rotate, scale, , translate catransform3d, read out 4x4 matrix elements create model view matrix need. if want see in action, this sample iphone application created shows how perform rotation of cube using both opengl es 1.1 , 2.0.

Copy from dataset to access table in C#? -

i have dataset (from xml file), want read schema , values dataset , copy access table. i want create access database on fly (can use adox), create access table (from adox) create schema in table , copy values dataset table. i getting error when try create table , add columns in it, below code snippet giving me error dataset ds = new dataset(); console.write("the name is" + filename.text.tostring()); ds.readxml("file_path" + filename.text.tostring()); adox.catalog cat = new catalog(); cat.create("provider=microsoft.jet.oledb.4.0;data source='database_name';jet oledb:engine type=5"); table tab = new table(); tab.columns.append("column name", datatypeenum.advarchar, 50); // inserting 32 more columns in manner cat.tables.append(tab); when run code block com exception : "tableid invalid". am trying right approach? how can copy values dataset table? could t...

asp.net - How can I setup a friendly email name in the MailSetting section of web.config? -

currently have: <system.net> <mailsettings> <smtp from="me@mydomain.com"> <network host="localhost" port="25" /> </smtp> </mailsettings> </system.net> how can change email sent name , not email address only? well, in code need put sender's name in quotes, followed e-mail address. new smtpclient(...).send("\"john smith\" jsmith@somewhere.com", ...); and...it looks can encode attribute too... <smtp from="&quot;john smith&quot; &lt;jsmith@somewhere.com&gt;">