Posts

Showing posts from January, 2015

c# - Writing into excel file with OLEDB -

does know how write excel file (.xls) via oledb in c#? i'm doing following: oledbcommand dbcmd = new oledbcommand("create table [test$] (...)", connection); dbcmd.commandtimeout = mtimeout; results = dbcmd.executenonquery(); but oledbexception thrown message: "cannot modify design of table 'test$'. in read-only database." my connection seems fine , can select data fine can't seem insert data excel file, know how read/write access excel file via oledb? you need add readonly=false; connection string provider=microsoft.jet.oledb.4.0;data source=fifa_ng_db.xls;mode=readwrite;readonly=false;extended properties=\"excel 8.0;hdr=yes;imex=1\";

regex - Does re.compile() or any given Python library call throw an exception? -

i can't tell python documentation whether re.compile(x) function may throw exception (assuming pass in string). imagine there considered invalid regular expression. larger question is, go find if given python library call may throw exception(s) , are? well, re.compile may: >>> import re >>> re.compile('he(lo') traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\python25\lib\re.py", line 180, in compile return _compile(pattern, flags) file "c:\python25\lib\re.py", line 233, in _compile raise error, v # invalid expression sre_constants.error: unbalanced parenthesis the documentation support this, in roundabout way - check bottom of "module contents" page (brief) description of error exception. unfortunately, don't have answer general question. suppose documentation various modules varies in quality , thoroughness. if there particular module...

c# - Disable Alt+F4 in UserControl -

i have user control , want disable alt + f4 oportunity end user. when user control shows, there opportunity close alt + f4 , program goes base class in method: protected override void onclosing(system.componentmodel.canceleventargs e) { //content = null; // remove child logical parent - reusing purposes this.removelogicalchild(content); //this works faster base.onclosing(e); { gc.collect(); }; } what must here or somewhere else, disable user control closing on alt + f4 ? to sure, question best practice . however, if want this, need prevent window containing usercontrol closing. the easiest way set dependencyproperty on usercontrol boolean flags whether container can closed. set true when want close (you have button or using close control). public boolean allowclose { { return (boolean)getvalue(allowcloseproperty); } set { setvalue(allowcloseproperty, value); } } public static readonly dependencyproperty allowcloseproperty = ...

Customizing UserCreationForm for email address as username in Django 1.2 -

django 1.2 adds new allowable symbols usernames, meaning usernames can email addresses. until have been using inbuilt usercreationform registration - how can alter label 'username' field 'email' field? , how add (but still user object) fields such first , last names? (and how make them optional?) should altering usercreationform extent or better starting scratch (and if latter, how?) thanks. to change label of email field, can subclass usercreationform follows from django import forms django.utils.translation import ugettext_lazy _ django.contrib.auth.forms import usercreationform class myusercreationform(usercreationform): username = forms.regexfield(label=_("email"), max_length=30, regex=r'^[\w.@+-]+$', help_text = _("required. 30 characters or fewer. letters, digits , @/./+/-/_ only."), error_messages = {'invalid': _("this value may contain letters, numbers , @/./+/-/_ characters."...

c# - Tools for manipulating PowerPoint files -

do know managed tools manipulating powerpoint files? tool should 100% managed code , offer option handle .ppt , .pptx files. well, 100% managed going hard route, however, can use office pias .net code. joel spolsky has an article discussing various options.

shell - mysql dump selection of databases (not sure how many) -

i create backup script (.sh can cron) backs following databases: someotherdatabase database1 database2 database3 database4 database5 database6 ... database9999 i know "someotherdatabase" have name can backed easily. other databases have incremental number don't know when backing how many be, has automatic (best wildcard database* i'm not sure if that's possible) these live databases, i'm not sure if have enable sort of locking on databases when backing them up? so in short, what's best way backup database pattern can restored importing them when goes wrong? this might help . cheers! edit: here's more alternatives: 10 ways automatically & manually backup mysql database

c# - Nerd Dinner pagginated list - how do I add a linq orderby clause dynamicaly? ANYONE? -

i have implemented nerd dinner method of paging- works great. want able dynamically able order certian fields. how go implementing this. here code? controller: paginatedlist<classifieds_ads> pageofclassifieds = new paginatedlist<classifieds_ads>(classifiedsrepositry.getclassifiedsincategory(category), paging, 20); repository: return classifieds in context.classifieds_ads.include("user") (from catergory in context.classifieds_categories catergory.mvc_url == mvc_cat select catergory).contains(classifieds.classifieds_categories) orderby classifieds.dateposted descending select classifieds; as can see have orderby clause "hard coded" repository. don't know code implement dynamically? anybody have ideas? thanks, you can use orderby(of tsource, tkey)-extensionmethod , pass custom function via keyselector-parameter. maybe little example may give idea how...

vi - In Vim, what is the best way to select, delete, or comment out large portions of multi-screen text? -

selecting large amount of text extends on many screens in ide eclipse easy since can use mouse, best way e.g. select , delete multiscreen blocks of text or write e.g. 3 large methods out file , delete them testing purposes in vim when using via putty/ssh cannot use mouse? i can yank-to-the-end-of-line or yank-to-the-end-of-code-block if text extends on many screens, or has lots of blank lines in it, feel hands tied in vim. solutions? and related question: there way somehow select 40 lines, , comment them out (with "#" or "//"), common in ides? well, first of all, can set vim work mouse, allow select text in eclipse . you can use visual selection - v , default. once selected, can yank , cut , etc. as far commenting out block, select visual , do :'<,'>s/^/# / replacing beginning of each line # . (the '< , '> markers beginning , and of visual selection.

c++ - compile error using qFromBigEndian -

i'm trying use qfrombigendian read 32-bit int byte stream received on udp socket. void processdata(uchar *data) { qint32 addr; addr = qfrombigendian(data); } compiling gives following error: error: invalid conversion 'uchar*' 'qint32' the qt documentation says: t qfrombigendian ( const uchar * src ) reads big-endian number memory location src , returns number in host byte order representation. note: template type t can either qint16, qint32 or qint64. obviously i'm doing bit silly , hanging head in shame. can please explain obvious mistake? note qfrombigendian(const uchar *src) function template. you're missing template parameter, use addr = qfrombigendian<qint32>(data); instead, , things work expected.

Sharepoint 2007 with MS Office 2007 footers -

we had need document management solution , hoping sharepoint 2007 satisfy our needs. felt our needs relatively simple. needed manage versioning , have searching capabilities , , having approval workflow . sharepoint handled these 3 aspects great out of box. however, require footer on office 2007 (word, excel, , powerpoint) documents reflect document version, last person modify, , last modification date. these things can done office automation, have yet find complete solution. we first tried on checking-in , checked-in events , followed path while, however, complication ran after made changes document had no way of preventing save updating version number. resulted in similar this: document checked-in – document version should v0.1 v0.2 because save document after footer replaced. if in document history there 2 separate versions v0.1 not have footer v0.2 has footer says v0.1 version document when replaced. this unacceptable solution want process handled on user side have...

How to plot data without a separate file by specifying all points inside the Gnuplot script? -

my program generates bash scripts call gnuplot. don't want have make file store data; there way can explicitly call of values? or possibly having bash make temporary file. something like plot {(1,5),(2,10),(3,1)} is looking for. you can use syntax inline data - filename '-' . the following example produces simple plot in gif image ( bash script): gnuplot << eof set terminal gif set output 'plot1.gif' plot '-' using 1:2 1 10 2 20 3 32 4 40 5 50 e eof

User Initiated Kernel dump in Windows XP -

i remember watching webcast mark russinovich showing sequence of keyboard keys user initiated kernel dump. can refresh memory on exact order of keys. please note xp. http://psacake.com/web/jr.asp contains full instructions, , here's excerpt: while may seem odd think purposefully causing blue screen of death (bsod), microsoft includes such provision in windows xp. might come in handy testing , troubleshooting startup , recovery settings, event logging, , demonstration purposes. here's how create bsod: launch registry editor (regedit.exe). go hkey_local_machine\system\currentcontrolset\services\i8042prt\parameters. go edit, select new | dword value , name new value crashonctrlscroll. double-click crashonctrlscroll dword value, type 1 in value data textbox, , click ok. close registry editor , restart windows xp. when want cause bsod, press , hold down [ctrl] key on right side of keyboard, , tap [scrolllock] key twice. should see bsod. if system reboots instea...

c# - Rhino Mocks: How can I mock out a method that transforms its input? -

i have data access object transactiondao. when call transactiondao.save(transaction) setting transaction.issaved=true flag (this simplification actual thing i'm trying not quite banal). when mocking transactiondao rhinomocks how can indicate should transform input? ideally write this: expect.call(delegate {dao.save(transaction);}).override(x => x.issaved=true); does know how this? though got hint how answer specified below actual type signature off, have this: because of mark ingram posted, seems best answer, though nobody's explicitly said it, this: public delegate void fakesave(transaction t); ... expect.call(delegate {dao.save(t); }).do( new fakesave(delegate(transaction t2) { t.issaved = true; })); gorge, the simplest solution, found, applied question following: expect.call(() => dao.save(transaction)) .do(new action<transaction>(x => x.issaved = true)); so don't need create special delegate or else. use action in sta...

sharepoint 2007 - Site column does not get deleted -

i have site column delete programatically using following code. have removed references field previously. however, if there not error, goes fieldtodelete.delete() , steps through next line. however, when check site column collection using spm2007 or via ui site column still there. dim fieldtodelete spfield try fieldtodelete = site.rootweb.fields.getfieldbyinternalname(name) 'site.rootweb.fields.getfieldbyinternalname(name) fieldtodelete.delete() catch ex exception console.writeline("field: {0} not deleted", name) return 0 end try any ideas on why sharepoint this? also, there 2 fields same name, not sure if has direct effect on this. want delete both. thanks since there 2 fields same name, internal names different name. sure line fieldtodelete = site.rootweb.fields.getfieldbyinternalname(name) is returning valid spfield? if not, need find internal names of ...

asp classic - VBScript conditional short-circuiting workaround -

i have large classic asp app have maintain, , repeatedly find myself thwarted lack of short-circuit evaluation capability. e.g., vbscript won't let away with: if not isnull(rs("myfield")) , rs("myfield") <> 0 ... ...because if rs("myfield") null, error in second condition, comparing null 0. i'll typically end doing instead: dim myfield if isnull(rs("myfield")) myfield = 0 else myfield = rs("myfield") end if if myfield <> 0 ... obviously, verboseness pretty appalling. looking around large code base, best workaround i've found use function original programmer wrote, called ternaryop, grafts in ternary operator-like functionality, i'm still stuck using temporary variable not necessary in more full-featured language. there better way? super-secret way short-circuiting exist in vbscript? maybe not best way, works... also, if in vb6 or .net, can have different methods cast proper...

cakephp - How to save multiple individual records for a single model -

i have model(friends), user can export friend's info facebook. want save friends info(id , name) mysql database. i having trouble creating form same using form helper don't know exact number of friends each user. is there easier way save user's friends database? (save multiple records same model) basically should know how number of friends current user, right? if so, loop following in view: echo $this->form->create('user'); for($i=0;$i<$number_of_current_user_friends;$i++){ echo $this->form->input('friend.'.$i.'user_id', array('value'=>$current_user_id)); echo $this->form->input('friend.'.$i.'friend_name', array('value'=>$friends[$i]['name'])); echo $this->form->input('friend.'.$i.'fb_id', array('value'=>$friends[$i]['fb_id'])); } echo $this->form->end('submit'); then in controller save with: $this-...

Why won't my local Apache open html pages? -

so, i'm running apache on laptop. if go "localhost", page says, if can see this, means installation of apache web server software on system successful. may add content directory , replace page. except, can't add content , replace page. i can click on links, , works fine. first of all, there's not "index.html" document in directory. if try directly access 1 created localhost/index.html, "the request url not found on server." so, i'm not sure page coming from. i've searched words in page under apache directory, , nothing turns up. seems redirect somewhere. just test, know loads localhost/manual/index.html (doesn't matter is) tried replace i've written, , received message the server encountered internal error or misconfiguration , unable complete request. the error log says, [fri sep 12 20:27:54 2008] [error] [client 127.0.0.1] syntax error in type map, no ':' in c:/program files/apache grou...

security - Best way to handle user account authentication and passwords -

what best way handle user account management in system, without having employees have access database, have access accounts. examples: storing username/password in database. bad idea because has access database can see username , password. , hence use it. storing username/password hash. better method, account can accessed replacing password hash in database hash of account know auth info for. after access granted reverting in database. how windows/*nix handle this? this common issue in unix many years ago, , resolved separating user identity components (username, uid, shell, full name, etc.) authentication components (password hash, password hash salt). identity components can globally readable (and in fact must be, if uids mapped usernames), authentication components must kept inaccessible users. authenticate user, have trusted system accept username , password, , return simple result of "authenticated" or "not authenticated". system s...

How can I listen in on shortcuts when the app is the task bar in C# -

an example of app enso , pops when press caps lock. you can act on global hotkeys calling winapi function registerhotkey . see http://www.codeproject.com/kb/vb/mclhotkeynet.aspx , http://www.codeproject.com/kb/miscctrl/systemhotkey.aspx example. can not use key combination hotkeys. don't work might try global keyboard hook (setwindowshookex)

osx - Changing the font in Aquamacs? -

i've had need bit of lisp editing , found nifty ready lisp package os x, great, except aquamacs automatically uses proportional font (which idiotic, imho) , want change monospace font. however, i'm not of emacs user, , preferences menu in aquamacs less clear on , how 1 might make such change. this have in .emacs os x: (set-default-font "-apple-bitstream vera sans mono-medium-r-normal--0-0-0-0-m-0-mac-roman") now, i'm not sure bitstream vera comes standard on os x, may have either download or choose different font. can search x font names running (x-list-fonts "searchterm") in elisp buffer (e.g. *scratch* - run it, type in , type c-j on same line).

How can I generate a git diff of what's changed since the last time I pulled? -

i'd script, preferably in rake, following actions single command: get version of local git repository. git pull latest code. git diff version extracted in step #1 in local repository. in other words, want latest code form central repository , generate diff of what's changed since last time pulled. you refspecs. git pull origin git diff @{1}.. that give diff of current branch existed before , after pull. note if pull doesn't update current branch, diff give wrong results. option explicitly record current version: current=`git rev-parse head` git pull origin git diff $current.. i use alias shows me log, in reverse order (i.e. oldest newest), sans merges, of commits since last pull. run every time pull updates branch: git config --global alias.lcrev 'log --reverse --no-merges --stat @{1}..

sql - word 2007: adding form fields -

does know how add textbox onto word 2007 document. need gather user input , after form filled out, data added access database thank you! word supports different kind of text input fields: "legacy" input fields implemented using word fields: selection.formfields.add range:=selection.range, type:= wdfieldformtextinput activex controls: selection.inlineshapes.addolecontrol classtype:="forms.textbox.1" content controls (word 2007 or later): selection.range.contentcontrols.add (wdcontentcontroltext)

c# - .NET Dataset design -

i have concern designing datasets. i told have dataset each table maintenance purpose. because frequent change in database tables expected, having 1 dataset including every tables pain make corresponding change in application. q. approach have dataset each table ( end having 30~40 datasets each db table using stored procedure) ? i have separate project commonly used datasets. each project include "dataset project" reference, , use including needed dataset forms, classes, etc. q. approach makes whole system slower? if have set of datasets separate project, beneficial, since easier make change (i need make modification in 1 place) performance wise having multiple datasets (and multiple queries) typically slower. however, on maintenance side, having single query , dataset per tables easier maintain. it depends on how related tables are. if can use hierarchical query of related data , put in 1 dataset recommend that. if tables not related @ separating datas...

.net - Close and Dispose - which to call? -

having read threads is sqlcommand.dispose enough? , closing , disposing wcf service wondering classes such sqlconnection or 1 of several classes inheriting stream class matter if close dispose rather close? i want clarify situation. according microsoft guidelines, it's practice provide close method suitable. here citation framework design guidelines consider providing method close() , in addition dispose() , if close standard terminology in area. when doing so, important make close implementation identical dispose ... in of cases close , dispose methods equivalent. main difference between close , dispose in case of sqlconnectionobject is: an application can call close more 1 time. no exception generated. if called dispose method sqlconnection object state reset. if try call method on disposed sqlconnection object, receive exception. that said: if use connection object 1 time, use dispose . if connection object must...

Where do the Python unit tests go? -

if you're writing library, or app, unit test files go? it's nice separate test files main app code, it's awkward put them "tests" subdirectory inside of app root directory, because makes harder import modules you'll testing. is there best practice here? for file module.py , unit test should called test_module.py , following pythonic naming conventions. there several commonly accepted places put test_module.py : in same directory module.py . in ../tests/test_module.py (at same level code directory). in tests/test_module.py (one level under code directory). i prefer #1 simplicity of finding tests , importing them. whatever build system you're using can configured run files starting test_ . actually, default unittest pattern used test discovery test*.py .

c# - DataTable to EnumerableRowCollection -

i have datatable according client requirement can contain invalid date "00/00/1999",null,empty string.(typed datset) when collect them enumerables wish convert of invalid forms empty string. (i.e) enumerablerowcollection<datarow> query = order in _table.asenumerable() select new { orderdate= string.isnullorempty(convert.tostring(order.field<datetime>("orderdate")) || (how check date invalid date) ? string.empty : order.field<datetime>("orderdate") } how check whether date valid date or not? datetime.tryparse...like given current code: datetime date; enumerablerowcollection<datarow> query = order in _table.asenumerable() select new { orderdate= string.isnullorempty(convert.tostring(order.field<datetime>("orderdate")) || !datetime.tryparse(convert.tostring(order.field<datetime...

php - I am developing a web application for a client, how can I stop them from licensing it? -

i creating web application developing client , want ensure maintain rights resell application. how can stop client licensing himself? thanks. could used? here http://www.developer-resource.com/sample-eula.htm this sounds should in terms of contract. specific technical measures, we'd need know more application exactly.

iphone - Do I need to release xib resources? -

if have uilabel linked xib file, need release on dealloc of view? reason ask because don't alloc it, makes me think don't need release either? eg (in header): iboutlet uilabel *lblexample; in implementation: .... [lblexample settext:@"whatever"]; .... -(void)dealloc{ [lblexample release];//????????? } if follow considered best practice, should release outlet properties, because should have retained them in set accessor: @interface mycontroller : mysuperclass { control *uielement; } @property (nonatomic, retain) iboutlet control *uielement; @end @implementation mycontroller @synthesize uielement; - (void)dealloc { [uielement release]; [super dealloc]; } @end the advantage of approach makes memory management semantics explicit , clear, and works consistently across platforms nib files . note: following comments apply ios prior 3.0. 3.0 , later, should instead nil out property values in viewdidunload. one consideration her...

.net - Would you bother to mock StreamReader object? -

i use stream reader import data , @ moment hardcode small sample file in test job. is sensible use mock objects , how ? i don't see points mock streamreader unless you're making streamreader derived class. if need provide test input via streamreader, read predefined data suitable source.

php - Make Joomla component compatible with SEF/SEO -

hi have developed custom component joomla 1.5. urls when sef turned on bit better e.g. display title rather id, how can make custom urls component when sef joomla turned on? have looked in joomla routing methods? http://docs.joomla.org/routing

multithreading - How to spread tcplistener incoming connections over threads in .NET? -

when using net.sockets.tcplistener, best way handle incoming connections (.acceptsocket) in seperate threads? the idea start new thread when new incoming connection accepted, while tcplistener stays available further incoming connections (and every new incoming connection new thread created). communication , termination client originated connection handled in thread. example c# of vb.net code appreciated. the code i've been using looks this: class server { private autoresetevent connectionwaithandle = new autoresetevent(false); public void start() { tcplistener listener = new tcplistener(ipaddress.any, 5555); listener.start(); while(true) { iasyncresult result = listener.beginaccepttcpclient(handleasyncconnection, listener); connectionwaithandle.waitone(); // wait until client has begun handling event connectionwaithandle.reset(); // reset wait handle or loop goes fast can (after first request) } } private void...

python - Map comparison operators to function call -

i'm building dsl form validation in python, , 1 of requirements able specify field should greater or less constant or field value. result, i'm trying map operators < , > , <= , >= equivalent functions in operator module, can called during field validation. i realise create dictionary map operator function, there nicer way it? there way access python's built-in mapping? as far i'm aware, there no built-in dictionary mapping string ">" function operator.lt , etc. as others have pointed out, python interpreter not make use of such dictionary, since process of parsing , executing python code first translate character sequence ">" token representing operator, translated bytecode, , result of executing bytecode execute __lt__ method directly, rather via operator.lt function.

delphi - OpenGL: Increasing the number of the lines changes the antialiasing? -

i writing paint program in delphi. user clicks 2 points on screen , line drawn between them. want lines anti-aliased. put code in create() procedure of opengl class (which called 1 time in start): glenable(gl_line_smooth); glenable(gl_blend); glblendfunc(gl_src_alpha, gl_one_minus_src_alpha); glhint(gl_line_smooth_hint, gl_nicest); when start drawing, first, second , maybe third lines drawn fine. interestingly enough, when number of lines increases (say 7, 8 lines), anti-aliasing starts fail! adding each line on screen, gets worse , lines edges starts become sawtooth!! i put same code on top of draw() procedure draws lines (and runs each click of mouse), nothing changes. am doing wrong here? has suggestion? are sure you're not drawing line segment more once? call glclear before doing drawing?

.net - What's the best way to save and retrieve binary files with Oracle 10g? -

i'm implement feature in our application allows user 'upload' pdf or microsoft powerpoint document, application make available other users in viewer (so don't 'download' in 'save as..' sense). i know how save , retrieve arbitrary binary information in database columns, commonly used feature of our application fear solution lead enormously large database tables (as know 1 of our customers want put video in powerpoint documents). i know there's way create 'directory' object in oracle, there way use feature store , retrieve binary files saved elsewhere on database server? or being overly paranoid database size? (for completeness our application .net winforms using corelab / devart oradirect.net drivers oracle 10g) thanks :o) couple of options: put blob column in own tablespace, own storage characteristics; store blobs in own table, linked other table id column. in either case suggested define column bfile means actual f...

c++ - Using GCC from within VS 2005(8) IDE -

is there way utilise gcc compiler whilst still being able develop via visual studio ide? our project cross-platform, , quite trouble colleague because i'm checking in code that's not standards compliant (this can attributed vs compiler!). i'd still able compile using ms compiler, can continue debugging, etc, i'd able switch compile using gcc, can sure i'm not breaking build on other platforms. is possible? what suggest still require makefile, partially repeating advice earlier reply. or, mentioned earlier, maybe have makefile, in case have fewer steps in order accomplish describe. once know specific windows command-line command invoking make or g++ on code, create "pre-build event" in visual studio project. ("project properties >> configuration properties >> build events >> pre-build event"). the pre-build event can call bat file script, or other script on machine, , script able return error-code. es...

linux - What does a double underscore mean in a variable name in the C language? -

possible duplicate: why people use __(double underscore) in c++ i studying linux kernel programming code. there data structures , functions start double underscore like: __u32 len how different normal variables? it means it's system-reserved name. c standard says names beginning 2 underscore, or underscore , capital letter, reserved use of system or compiler , should not defined in application code.

c - Misra standard for embedded software -

i have requirement make large amount of code misra compliant. first question: can give estimation passing written code embedded system based on experience. understand "well written" poorly defined , vague ask raw estimation. second question: recommendation tool can customizable (i.e allowing suppress specific warnings) , used in automatic build environment (i.e command line interface) other useful suggestions can task. ilya. i highly recommend pc-lint. if happen compiling code visual studio recommend plug-in 'visual lint' riverblade. if cannot compile code in visual studio, can still run pc-lint command line effect. some embedded system compilers provide misra compliance testing compiler warnings. use iar compiler arm7/arm9 development. provides easy configure misra compliance checklist right in compiler setup. it difficult come rule of thumb estimating time take make written code misra compliant. lot depends on existing coding habits of pr...

asp.net - IIS Authentication across servers -

my production environment involves pair of iis 6 web servers, 1 running legacy .net 1.1 applications , other running .net 2.0 applications. cannot install .net 2.0 alongside 1.1 on same machine because tightly-regulated 'validated system' , present bureaucratic nightmare revalidate. websites on both servers use basic authentication against active directory user accounts. is possible web application on 1.1 server securely redirect user page served on 2.0 server, without requiring users re-authenticate? no, because you're not using cookies authentication in scenario, scaleovenstove's link won't help. basic authentication sends login information in http headers every request, it's browser this, when sees new server, new password request. (or indeed suggested change authentication on both systems support single signon)

General guidelines to avoid memory leaks in C++ -

what general tips make sure don't leak memory in c++ programs? how figure out should free memory has been dynamically allocated? instead of managing memory manually, try use smart pointers applicable. take @ boost lib , tr1 , , smart pointers . smart pointers part of c++ standard called c++11 .

Hidden Features of VB.NET? -

i have learned quite bit browsing through hidden features of c# , surprised when couldn't find similar vb.net. so of hidden or lesser known features? the exception when clause largely unknown. consider this: public sub login(host string, user string, password string, _ optional bretry boolean = false) try ssh.connect(host, user, password) catch ex timeoutexception when not bretry ''//try again, once. login(host, user, password, true) catch ex timeoutexception ''//log exception end try end sub

css - TabPanel within TabPanel styling -

my app's layout consists of tappanel, holds tabpanel. i'd have 2 tabpanels differently. following gwt tutorial on applying styles did following: tabpanel innertabpanel= new tabpanel(); //carrierstabpanel.setsize("100%", "100%"); innertabpanel.addstylename("inner-tabpanel"); .gwt-tabpanel .inner-tabpanel{ width: 100%; height: 100%; } this, however, did not have effect whatsoever. tried following, didn't work either: .inner-tabpanel{ width: 100%; height: 100%; } so how can style 2 panels separately? percentage values width , height relative parent, not window. as w3schools notes , % "defines width in percent of containing block". if want see effect of rules, try setting background-color or color css property instead. instance, .inner-tabpanel { color: red} set color of text in inner tab panel red, assuming there aren't other conflicting rules. in , other css debugging situations, firebug ...

xml - Where can I find good tutorials on XSL-FO (Formatting/ed Objects), the stuff one feeds to fop and get PDF's? -

on company i've worked, me , colleagues, implemented tailored document distribution system on top of xsl-fo. my task script deliver documents , configure cups print server , fax server, never had time hands dirty on xsl-fo. i'm thinking of implementing in region made there i'll need templates work while testing. where can find tutorials on xsl-fo, since fop process i've mastered already? i refer people 2003 ibm developerworks article: html formatting objects (fo) conversion guide i don't recommend using provided .xsl convert html fo, use narrative understand different xsl-fo constructs , how relate html (which understand).

sql server - Avoid returning result set from stored procedure -

assume have stored procedure (and can't change it) returning result set: create procedure test_procedure begin select 1 end i know can insert result set table, hidden calling code: declare @t table(i int) insert @t exec test_procedure are there other ways hide returning result set calling code? updated it looks i've been bit confusing. i'm looking t-sql answers (not .net ones). no, there no other solution. however, should refactor procedure need. if need output other calls, try split procedure two.

asp classic - How do I convert legacy ASP applications to ASP.NET? -

we have large asp (classic asp) application , convert .net in order work on further releases. makes no sense continuing use asp obsolete, , don't want rewrite scratch (joel spolsky tells why ). is there way convert asp asp.net automatically? well, used work company web apps classic asp. when decision made move .net had find way transform 168(!) web apps new framework. tried tools available @ time , failed. best way build new web server , start there scratch, way can sure upgrade happen fast , work without hick-ups because of old-new integration. able choose functionality , visual appearances keep , 1 change. not waste time on automatic tools upgrade old asp files/sites net platform. none far have ever worked properly. and on top of if have database on end, run problem connection web apps.

iphone - How do I set the height of a toolbar in objective C? -

i have code in applicationdidfinishlaunching: navcontroller.toolbarhidden = no; [navcontroller toolbar].tintcolor = [uicolor darkgraycolor]; [[navcontroller toolbar] setframe:cgrectmake(0.0,0.0,320.0,180.0)]; the first 2 lines have effect on ui. example, if set toolbarhidden yes, hidden. however, when try set frame , customize toolbar height, no change takes place. know how fix this? uitoolbar s have fixed height. won't able change it.

inheritance - State of Derived class object when Base class constructor calls overridden method in Java -

please refer java code below: class base{ base(){ system.out.println("base constructor"); method(); } void method(){} } class derived extends base{ int var = 2; derived(){ system.out.println("derived constructor"); } @override void method(){ system.out.println("var = "+var); } } class test2{ public static void main(string[] args) { derived b = new derived(); } } the output seen is: base constructor var = 0 derived constructor i think var = 0 occurs because derived object half initialized; similar jon skeet says here my questions are: why overridden method called if derived class object isn't created yet? at point in time var assigned value 0? are there use cases such behavior desired? the derived object has been created - it's constructor hasn't been run yet. type of object never changes in java after instant...

c# - Create a process without elevation -

i want create child process in application run not inherit parent's uac. parent runs administrator, , want child process run simple user w/o elevation. know how can done? i'm coding in c#. thanks! http://www.gregcons.com/kateblog/nonelevatedfromelevatedmanagedthistime.aspx see run program asuser

html - Inline style to act as :hover in CSS -

i know embedding css styles directly html tags affect defeats of purpose of css, it's useful debugging purposes, in: <p style="font-size: 24px">asdf</p> what's syntax embedding rule like: a:hover {text-decoration: underline;} into style attribute of tag? it's not this... <a href="foo" style="text-decoration: underline">bar</a> ...since apply time, opposed during hover. i'm afraid can't done, pseudo-class selectors can't set in-line, you'll have on page or on stylesheet. i should mention technically should able according css spec , browsers don't support it edit: did quick test this: <a href="test.html" style="{color: blue; background: white} :visited {color: green} :hover {background: yellow} :visited:hover {color: purple}">test</a> and doesn't work in ie7, ie8 beta 2, firefox or chrome. can e...

drupal - Where is the last vote stored? -

i'm using fivestars module , i'm modifying code. need last vote of user specific node. i'm sure module stores it, because displays stars user selected, when logs in , re-visits node. but i'm not able find in code. (i found average vote node, , count of nodes). take @ fivestar_get_votes() in fivestar.module. votes for, say, user 1 on node 34, you'd fivestar_get_votes('node', 34, 'vote', 1) . alternatively, take @ voting api , fivestar_get_votes() uses.

What continuous integration tool is best for a C++ project? -

cruisecontrol , hudson 2 popular continuous integration systems. although both systems able automated continuous builds nicely, seems lot easier create batch or bash build script, use windows scheduler or cron schedule builds. are there better continuous integration systems available c++ projects? or using script , scheduler simpler way? we have been using cruisecontrol ci on c++ project. while thing use ant for, ant build script cruisecontrol starts our normal build script, simple , haven't needed update in long while. therefore fact crusiecontrol java based has not been issue @ us. the main benefits of using cruise control are a nice web page showing build status email after each build or after failed builds automatically build after commit source control system a firefox plugin monitor build status shows output build errors. shows files have changed since last build (good seeing developer broke buid) of course can write script of this, why work? in...

javascript - When do I need to escape metacharectars? (jQuery Selectors) -

according jquery docs, need escape metacharacters occur in selector strings, when occur literal. however, couldn't find many specific examples of when , when not escape selectors. when , when don't need escape metacharacters, when interpreted literal, in: attribute selectors? ie $("[attr=value]") id selectors? ie $("#id") class selectors? ie $(".class"); and, there way write function replaces metachars in selector strings, while still preserving beginning character? ie: // replace meta chars, preserving id selection? $("#id.rest$of*string") // replace meta chars, preserving attribute selection? // going previous question, need escape metachars in situation? $("[attr=blah.dee#foo*yay]") the reason ask question, because i'm working website happens have nasty selectors. , don't have control on website, can't go change selectors nicer work with. thanks!! from jquery docs: if wish us...

What Tools Does Google Use to Manage Their JavaScript? -

i reading this article , came across this: gmail engineer adam de boor surprised audience noting company's gmail service written entirely in javascript, , of code, around 443,000 lines worth, written hand. assuming wasn't talking gwt, that's ton of javascript code. made me wonder how manage all. some questions: use write all? (i'm guessing emacs or vim or similar) what use package , test all? know of sprockets packaging up, there else? what use debug? firebug nice , all, have beefs it... google uses home-grown javascript compiler optimize hand written js code before sending client. see http://code.google.com/closure/compiler/

javascript - How do I prevent Firefox XMLSerializer from capitalizing nodes -

i'm creating xml document in javascript on client side, , transforming string send server. mozilla has handy method accomplish this: xmlserializer().serializetostring() , i'm using. however, there seems bug in method: returns node names in uppercase , attribute names in lowercase(regardless of capitalization used create node). is there way circumvent behavior , xml string original capitalization? more generally, there way create xml document in mozilla , return string without having capitalization overridden? it looks working html document. try operating on xml document instead. var odocument = new domparser().parsefromstring("<root />", "text/xml"); odocument.documentelement.appendchild(odocument.createelementns(" http://myns ", "x:test")); alert(new xmlserializer().serializetostring(odocument)); or var odocument = document.implementation.createdocument("", "", null); odocument.appendchild...

Merge two arrays as key value pairs in PHP -

i've got 2 arrays of same size. i'd merge 2 values of 1 key indexes of new array, , values of new array values of other. right i'm looping through arrays , creating new array manually, have feeling there more elegant way go this. don't see array functions purpose, maybe missed something? there simple way along these lines? $mapped_array = mapkeys($array_with_keys, $array_with_values); see array_combine() on php.net.

Retrieving date in sql server, CURRENT_TIMESTAMP vs GetDate() -

using sql server - fastest or best practice method use date retrieval? there difference? current_timestamp standard ansi sql, , theoretically 1 tiny little island of 'don't need change' amongst thousands of sql server-specific lines of sql if ever need move databases....

c# - how to insert data in sql table using Linq without seting any primary key in table -

i have table in don't want specify primary key, after inserting records in using linq...aahhh...its giving error "can't perform create, update or delete operations on 'table(abc)' because has no primary key" can ani 1 tell me how insert record without setting primary key. way im not setting primary key because table have bulk of data keep. you can't use linq-to-sql directly tables don't have primary keys, because it's not supported. if you're worried performance hit of indexing, can add stored procedure insert , add data context. it's bit more work, , it's not linq-to-sql, it'll method on call on data context. there won't noticeable performance hit on identity primary key field anyway.

perl - How to detect malformed UTF characters -

i want detect , replace malformed utf-8 characters blank space using perl script while loading data using sql*loader. how can this? consider python. allows extend codecs user-defined error handlers, can replace undecodable bytes want. import codecs codecs.register_error('spacer', lambda ex: (u' ', ex.start + 1)) s = 'spam\xb0\xc0eggs\xd0bacon'.decode('utf8', 'spacer') print s.encode('utf8') this prints: spam eggs bacon

SVM Multiclass text classification -

i want classfy news data set , training data classified iptc subject code(hierarchical classification). in project should use svm . i have done of feature extraction ,stemming,removing stop word ... i have file format required svm multiclass : which like: category feature:value feature:value feature:value i don't know how should use svmmulticlass i have hearde 1 -against-all ,i dont know is please tell me whrere can find tutorial ,or how use it regards one -against-all, technique train svm's in multi-label classification , example u have "n" class label : u create "n" svm , train each 1 on 1 class +ve label , others -ve labels . this 1 -against-all mean . u can visit , use there multi-class svm http://svmlight.joachims.org/svm_multiclass.html

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot...

ruby on rails - Rake db:migration aborted -

i've got unfinished project developer didn't finish , didn't leave documentation installation process. i've downloaded production directory windows machine (running instantrails 2), created databases required in database.yml , tried run rake:db:migrate --trace i'm receiving following error message: (in d:/projects/broke2) ** invoke db:migrate (first_time) ** invoke environment (first_time) ** execute environment ** execute db:migrate rake aborted! uninitialized constant admin d:/instantrails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:279:in `load_missing_constant' d:/instantrails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:468:in `const_missing' d:/instantrails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:480:in `const_missing' d:/instantrails-2.0-win/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/activ...

mysql - a bash script to dump a database -

how write bash script dump database , restore it. there should 2 arguments. first 1 name of db going dumped , 1 name of db in going restore dump data. i got python script take dump , upload s3. think better bash script: import datetime import subprocess, tarfile, os, s3, tempfile #mysql mysql_user = "xxxx" mysql_pass = "xxx" mysql_db = "xxxxx" mysql_host = "localhost" mysql_dump = "mysqldump" aws_access_key_id = "xxxxxxxxxxxx" aws_secret_access_key = "yyyyyyyyyyyyyyyyyyyy" bucket_name = "bucket" folder = "backup/" keep = 5 ext_time = datetime.datetime.strftime(datetime.datetime.now(), '%y-%m-%dt%h:%m') print "start mysqldump..." proc1 = subprocess.popen(mysql_dump + " --no-create-info -u %s -p%s -x --databases %s" % (mysql_user, mysql_pass, mysql_db), shell=true,stdout=subprocess.pipe,stderr=subprocess.stdout) t1 = tempfile.namedtemporaryfi...

Best Oracle database manager/editor? -

we have oracle 8i database our developers run against , use 9i enterprise manager view tables/values , minor manual data editing. i wondering if there more modern tool use oem 9. 1 major annoyance oem lack of mousewheel support. to keep question objective, need oracle database editor 1) has mousewheel support 2) can let developer view tables , edit data i looked @ latest oracle 11 client there doesn't seem database manager in it! everyone recommended toad didn't read question closely. you're using oem. tells me you're not doing whole lot of development in oracle database. oem horrendous development tool. state need for, " view tables/values , minor manual data editing." , don't need toad @ all. i'm not toad detractor, couldn't live life without it. it's important piece of software have. but if that's list of , that's how now, download sql developer . it's free, it's oracle, has lot more bells , whistles e...

network programming - How do I set the socket timeout in Ruby? -

how set timeout blocking operations on ruby socket? the solution found appears work use timeout::timeout : require 'timeout' ... begin timeout(5) message, client_address = some_socket.recvfrom(1024) end rescue timeout::error puts "timed out!" end

oracle - Should procedures and/or functions of the DBMS_STANDARD package be used in PL/SQL code? -

recently, encountered before insert or update trigger on table. in trigger, author relies on inserting , updating functions (both return boolean ) of dbms_standard package determine if trigger fired before insert or before update. for example: create or replace trigger customer_trigger before insert or update on customer each row begin if inserting /* code */ end if; if updating /* other code */ end if; end; yes, know two, individual triggers have been written handle 2 events separately. that's not point of question. after troubleshooting error being received these functions, received word (from oracle support) "dbms_standard routines not meant called user programs". true? i find little strange, considering other procedures (such raise_application_error , commit ) commonly used in pl/sql code. the functions inserting, updating , deleting expressly provided use in writing trigger code (see trigger documentation ), there abso...

actionscript - How to convert flash with dynamic data into AVI video -

hy, after upload images , 1 mp3 files on site make slideshow (.avi file)! nothing fancy, simple slideshow! i want make stereotyped in flash load images , mp3 file , make nice slideshow effects! the problem is... how can save swf file? (later convert .swf file .avi or .mpg) you should use third party screen capture or video screen recording program best results.

android - Implement onScrollChanged Event -

i have absolutelayout xml: <absolutelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/measureabslayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:id="@+id/measureimageview" android:layout_width="fill_parent" android:layout_height="fill_parent"> </imageview> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <button android:text="previous" android:layout_height="wrap_content" android:id="@+id/measureprev" android:layout_alignparentbottom="true" android:layout_width="wrap_content"> </button> <button android:text="result" android:lay...

sql server 2005 - SQLSERVER mirroring VS Log shipping -

i need understanding mirroring follwoing example. primary server in fl mirror server in germany my application doing insert table fl system case 1 : mirror server down -- network issue -- assume insert written transaction log on principal -- not commited disk happen if tries query fl database.will see last transaction[insert]? when sql server perform query, @ both db , tlog?. case 2: if mirror server down 2 days. guess transation log continue grown. can explain how affect response time of appplication case 3 : if mirror down while (week). better break mirroring. also, means have take full backup of db again in order reconfigure mirroring you haven't specified kind of mirroring, assume high safety automatic failover case 1 : principal in 'disconnected' state. transactions committed disk on principal, not mirror (obviously). transactions remain in 'active' part of log , not backed up. i.e. see transaction log grow , log_reuse_wait...

gwt rpc - GWT Client and Server -

i believe gwt achieves ria through initial throwing of objects , files client side initially. not understand is possible control amount of information being thrown client side? cos because not want sensitive information cache @ client side. these information shall retrieved server when requested. these information should sent client when requested , should not cached @ client side. know if possible control amount of information being sent client? can enlighten me? appreciate sincerely. see if dont want expose particular information on client side keep on server side , whenever want information using rpc call can on server side.and gwt cache things images etc on client side information only.it not caching information present in lets database or server side.so dont need worry it.and if want more security can use encryption , decryption algorithms.and if follow design patterns mvc programming practice.i created 1 sample application if want can take checkout here ...

winapi - Create Process As User after loading user profile -

i have service runs system, want spawn new process in user ts session user privileges. i'm calling logonuser, loaduserprofile, createenvironmentblock, createprocessasuser , spwan process in user ts session. the process (cmd.exe) run in user ts session, when i'm trying run gui application following error message: exception eaccessviolation in module ntdll.dll @ 00022272. access violation @ address 77d22272 in module 'ntdll.dll'. write of address 0000000c. have missed something? any appreciated ! thanks, lior look @ launching process in user’s session service . main problem should start process on other ts session. have switch current session respect of settokeninformation , tokensessionid . able have enable se_tcb_name privilege. moreover have change security descriptor of desktop , windows station objects respect of openwindowstation , opendesktop , setuserobjectsecurity (see http://msdn.microsoft.com/en-us/library/ms681928.aspx , http:/...

objective c - How parse html string in iphone -

i m using php file using data in application, in file post data on server , if data server in html formate. so problem have string html tags how use data in string. how extract data html string. i have used code --> flatten-html-content-ie-strip-tags-cocoaobjective-c . there examples of use on so.

reflection - What is the C# equivalent to Java's isInstance()? -

i know of is , as instanceof , reflective isinstance() method? the equivalent of java’s obj.getclass().isinstance(otherobj) in c# follows: bool result = obj.gettype().isassignablefrom(otherobj.gettype()); note while both java , c# work on runtime type object (java java.lang.class ≣ c# system.type ) of obj (via .getclass() vs .gettype() ), java’s isinstance takes object argument, whereas c#’s isassignablefrom expects system.type object.

c++ - What Windows API do I choose for a rich client application? -

i develop rich client software on mac os x , linux. wish port application windows , not being user of microsoft products, i'm not familiar windows in general. what i'm familiar with: on mac os x, have option of cocoa , objective c or carbon , c/c++. on linux, have option of gtk+ , c/c++ or qt , c++. prefer cocoa on mac os x , gtk+ on linux. interface builder cocoa , glade gtk+ make life easy. it's fun create rich clients in these operating systems. my core classes, or "model" in mvc, written in cross-platform c++. user interface classes, or "view , controller" in mvc, written in "preferred" language , gui api each respective platform. c++ language i'm familiar with. use boost libraries extensively. smart pointers, threads, , asio networking libraries. unicode, localization, etc., use international components unicode (icu). question 1: "preferred" language , gui api windows platform that's compatible cross-platfo...

c# - transform UT8 to UCS-2 -

i have learned sql server 2005 not support utf8: utf8 problem sql server i believe supports ucs-2 though , way transform utf8 ucs-2 without loss of information if possible. it? any feedback welcome. thanks! christian ps: c# preferred (-: it looks have text file encoded in utf-8 , want re-encode ucs-2. streamreader , streamwriter support encoding automatically; supply encoding object in constructors. you should able to: construct streamreader encoding.utf8 construct streamwriter encoding.unicode read lines reader , write them writer

Save a YAML Emitter content to a file with YAML-CPP -

i started playing around yaml-cpp, managed build , run of examples yaml-cpp wiki can't find way save emitter file. is not possible? mean pyyaml library has 'dump' function this. there no such functionality in yaml-cpp? there workaround converting yaml emitter stl stream , dumping yaml file? please let me know thanks, adam the function emitter::c_str() returns null -terminated c-style string (which not have release), can write file. example: yaml::emitter emitter; emitter << "hello world!"; std::ofstream fout("file.yaml"); fout << emitter.c_str(); there emitter::size() , returns number of bytes in string, in case want more advanced , don't want walk string find length. if want dump node stream, there's shortcut: yaml::node node = ...; std::ofstream fout("file.yaml"); fout << node;

Start empty Excel workbook without any worksheets -

creating new excel workbook in: dim xl excel.application dim wb excel.workbook set xl = new excel.application xl.visible = false set wb = xl.workbooks.add is there easy way stop excel automatically creating sheet1, sheet2, sheet3? i can delete these unwanted sheets afterwards feels clunky solution. xl.sheetsinnewworkbook = 1 more information on msdn (scroll down add method applies workbooks object. ) full code: dim xl excel.application dim wb excel.workbook dim restoresheetsinnewworkbook long set xl = new excel.application restoresheetsinnewworkbook = xl.sheetsinnewworkbook xl.sheetsinnewworkbook = 1 set wb = xl.workbooks.add xl.sheetsinnewworkbook = restoresheetsinnewworkbook 'or set 3'

asp.net - Where should I manage the createdBy, modifiedBy, createDate, and modifiedDate? -

i want insert createdby, modifiedby, createdate, modifieddate columns in every database table manage user activity. this first time try this. there best practice follow? design pattern manage this? my first thought in business logic layer, , in every business classes' insert , update method, this: class.createdate = datetime.now; or class.modifieddate= datetime.now; class.modifiedby = currentuser.id; or class.createdby = currentuser.id; or there better way? bryan this depends on types of business objects managing, , rules around create/modified data needed for. in cases, database audit trail, , there no need information in business logic layer. in case, information should live @ database level only. if using orm, might mean keep data objects anyway. if using stored procs, need know how take user name tag record with. datetimes can handled setting default value of getdate() on column.

jquery - Boolean object in javascript returns true for "false" parameter -

i have little problem. i have situations ajax calss returns string. sometimes string "false" want convert string value boolean tried : new boolean(thatvalue) but returns true "false" paremter is there anyway solve this? except me writing own custom function return false if "flase" ?.. thank you the best way you've described: if(value === 'true') { //do } or: if(value !== 'false') { //do } you're limited javascript's weak typing here, working disadvantage, non-empty string convert true boolean, if string "false" . to , store use elsewhere, works: var mybool = value !== "false";