Posts

Showing posts from July, 2014

redirect - Identify the postback from a ASP.NET Login control -

i have <asp:wizard> applicable logged-out user. if user logged in, he/she redirected page. on 1 of wizard steps, part of wizard, ask credentials via <asp:login> control , log in user. presents problem. according msdn : "when user uses login control log in web site, data in view state , post data lost. not perform actions in loggedin event rely on view state." because of this, wizard control forgets step it's on after login process. msdn recommends : "if embed login control in wizardstep object, explicitly set activestepindex property in page_load event handler if user authenticated. wizard control not automatically advance next wizardstep object in scenario." however, because view state lost, redirect logged-in users kicks in, sending user away page. what's best way determine, @ page load, of states user in? already logged in time ago; needs redirected. was logged in inside wizard; needs reach next wizard step. thanks ideas. ...

In HTML5, is the <form> element a sectioning element, like <section>? -

in html5, elements (like <section> , <article> ) create new sectioning context in document‘s outline, per outlining algorithm. this means can use <h1> top-level heading inside them without screwing document’s generated outline. does <form> element create sectioning context? no, because it’s not sectioning content . following elements sectioning content: <article> <aside> <nav> <section> however, <fieldset> element sectioning root . means creates new sectioning context (like sectioning content element), but headings , sections within don’t contribute outlines of ancestors. so can blindly use <h1> inside <fieldset> element without screwing document’s outline. sectioning roots are: <blockquote> <body> <details> <dialog> <fieldset> <figure> <td> see http://dev.w3.org/html5/spec/overview.html#headings-and-sections full description , ex...

tsql - sql server agent proxy account -

i trying use proxy account non sysadmin grant them exec permission on xp_cmdshell. did is: use [master] go create credential [proxyaccount] identity = n'domain\user', secret = n'password' go use [master] go create credential [proxyaccount] identity = n'domain\user', secret = n'password' go use [msdb] go exec msdb.dbo.sp_add_proxy @proxy_name=n'myproxy',@credential_name=n'proxyaccount', @enabled=1 go exec msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=n'myproxy', @subsystem_id=2 go exec msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=n'myproxy', @subsystem_id=3 go exec msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=n'myproxy', @subsystem_id=11 go but still when user tries do xp_cmdshell 'dir c:' it gives following error: msg 229, level 14, state 5, procedure xp_cmdshell, line 1 execute permission denied on object 'xp_cmdshell', database 'mssqlsystemresource...

statistics - Tukey five number summary in Python -

i have been unable find function in of standard packages, wrote 1 below. before throwing toward cheeseshop, however, know of published version? alternatively, please suggest improvements. thanks. def fivenum(v): """returns tukey's 5 number summary (minimum, lower-hinge, median, upper-hinge, maximum) input vector, list or array of numbers based on 1.5 times interquartile distance""" import numpy np scipy.stats import scoreatpercentile try: np.sum(v) except typeerror: print('error: must provide list or array of numbers') q1 = scoreatpercentile(v,25) q3 = scoreatpercentile(v,75) iqd = q3-q1 md = np.median(v) whisker = 1.5*iqd return np.min(v), md-whisker, md, md+whisker, np.max(v), pandas series , dataframe have describe method, similar r 's summary : in [3]: import numpy np in [4]: import pandas pd in [5]: s = pd.series(np.random.rand(100)) in [6]: s.describe(...

Simple C++ project issue with XCode -

i setting c++ project in xcode , seems not recognize classes. default, there main.cpp file in source folder. i added node.cpp , node.h file folder, , included node.h in main.cpp file. unfortunately, it's not recognizing it, says no such file or directory. why not linking? how did include node.h in main.cpp? #include <node.h> will not work, have use #include "node.h"

Shell application in Vim window -

i'm searching way start console application in vim window. open python & php interactive shell in it. handy. i want :10 sp !python try conque shell plugin . sounds you're looking for.

Determine the Internal Path Length of a Tree (C++) -

well i'm down last function of program , i'm done. i've hit stump can't seem fix on own. int tree::internalpathlength(node * r, int value) { if(r->left == null && r->right == null) { return 0; } return value + internalpathlength(r->left, value+1) + internalpathlength(r->right, value+1); } i feel i'm close solution, know i'm missing something. think it's if statement , i've tried different combinations end getting crashed program or 0 answer. any suggestions or appreciated ! thanks! may works: int tree::internalpathlength(node * r, int value) { if(r->left == null && r->right == null) { return 0; } return value + ( r->left? internalpathlength(r->left, value+1):0 ) + ( r->right? internalpathlength(r->right, value+1):0 ); } or add null check node int tree::internalpathlength(node * r, int value) { if (r == nul...

c# - What does this ?? notation mean here -

possible duplicate: what “??” operator for? what ?? notation mean here? am right in saying: use id , if id null use string "alfki" ? public actionresult selectionclientside(string id) { viewdata["customers"] = getcustomers(); viewdata["orders"] = getordersforcustomer(id ?? "alfki"); viewdata["id"] = "alfki"; return view(); } [gridaction] public actionresult _selectionclientside_orders(string customerid) { customerid = customerid ?? "alfki"; return view(new gridmodel<order> { data = getordersforcustomer(customerid) }); } that's null-coalescing operator. var x = y ?? z; // equivalent to: var x = (y == null) ? z : y; // equivalent to: if (y == null) { x = z; } else { x = y; } ie: x assigned z if y null ,...

forms - Django Page not reloading with updated data after data update -

i have form submits , saves data database. after submit process, have view form re-display summary page lists items in database using following: return httpresponseredirect(reverse("my_shows")) reverse("my_shows") leads view gets relevant objects database , sends data template the problem although correct page loads, data shows "old" , doesn't have recent submission i've confirmed in in database. have log out , log in summary page reflect recent changes. what's fix this? i'm not using caching @ moment, , i'm not sure whats causing this.

vsto - Cannot find MySQL Reference in Visial Studio 2008 -

please, me want add mysql reference in visial studio 2008 cannot find it. can download mysql reference , add in visial studio or not, or should ??? download mysql connector .net, found here . after installing you'll find in reference list.

javascript - What MySQL drivers are available for node.js? -

is there node.js driver mysql commonly used other node-mysql? (it seems there not activity node.js database drivers. there reason or because node.js young?) here options: http://github.com/felixge/node-mysql (last update: sep 29th) http://github.com/sidorares/nodejs-mysql-native (last update: aug 31st)

cocoa touch - Is UIBezierPath available for iphone 4.0 onwards? -

is iphone sdk 4.0 supports uibezierpath since in documentation told available above 3.2 didnt told available in iphone or ipad. uibezierpath available in ios 4.0+. in fact, revised , methods added in ios 4.0.

examples of DCI architecture? -

i've been trying understand dci architecture reading lean software architecture . feel need see more examples crystalize understanding of it, i've been able find ones variations of money transfer between accounts case worked through in book. if there out there on web, let me know. alternatively if you've created example isn't on web, post here. any language do. i not sure, if had @ of these literature on web. listing them down reference: http://folk.uio.no/trygver/2008/commonsense.pdf http://www.artima.com/articles/dci_vision.html http://pettermahlen.com/2010/09/10/dci-architecture-good-not-great-or-both/ http://groups.google.com/group/object-composition/ http://www.jroller.com/sebastiankuebeck/entry/james_coplien_s_talk_on http://www.infoq.com/presentations/the-dci-architecture and following discusses application using example in scala http://sadekdrobi.com/2009/06/10/dci-in-real-world-domain-context-and-interaction-with-scala-in-a-rea...

html - How to style each table cell in a column via CSS? -

i have ordinary html table: <table> <tr> <td class="first-column-style">fat</td> <td>...</td> </tr> <tr> <td class="first-column-style">fat</td> <td>...</td> </tr> </table> i want apply css style every table cell ( td ) in particular column. possible without applying class / style attribute every table cell in column, , without javascript? use <col> tag , style following this guide . way need add class (or inline style specification) <col> element instead of each <td> in table.

javascript - Returning the response from an Jquery AJAX call -

this question has answer here: how return response asynchronous call? 21 answers i have written function, has check whether username has been taken or not. when call function function, , alert it's return value: alert(checkusernameavailable('justausername')); it says 'undefined'. i've searched high , low, can't find i'm doing wrong. guess should return php-echo in check.php, doesn't. here's function wrote: var checkusernameavailable = function(value) { $.ajax({ url: "check.php", type: "post", async: false, cache: false, data: "username=" + value + "", success: function(response) { alert(response); return response; }, error: function() { alert('ajax error'); } }); } what doing...

android - doubt in list view -

i have 2 lists, 1 on left of screen, other list, on right of screen gets dynamically populated based on selected item on left list. i move right list pressing "right" key left list. issue: whenever press right key left list, item selected item of right list aligned left item. dont want happen. want 1st item of right list selected. can how go this? hmm, don't know if work listitems. buttons, there attirbute set focus must go to! eg: nextfocusright however, in these, view id must specified, i.e id of view focus must passed. not sure if maybe useful listview items. link text

java - Problem to Type casting -

i using bonita api java docs(bonita api) instanceuuid of process , instanceuuid of type processinstanceuuid.using getvalue(), convert object value in string , send java class want typecast string processinstanceuuid class object type. it possible,if possible please give me idea solve problem. processinstanceuuid instanceuuid = this.getprocessinstanceuuid(); instanceuuidvalue = instanceuuid.getvalue(); thanks from api: processinstanceuuid instanceuuid = this.getprocessinstanceuuid() string instanceuuidvalue = instanceuuid.getvalue(); processinstanceuuid newuuid = new processinstanceuuid(instanceuuidvalue); as @nivas said, not typecasting. here example of type casting: object obj1 = "hello world"; // obj1 in fact string object obj2 = new integer(2); // obj2 integer string mystring1 = (string) obj1; // explicitly type cast object string // next statement throw exception @ runtime because obj2 not string string mystring2 = (string) obj2;

How to obtain my vsix extension's folder and use this value to insert in some project template's files? -

my vsix extension has project templates custom project file. file contains reference .targets file installed part of vsix extension (so it's in extension's folder). problem can't find variable indicates vs extensions path, needed find target projects file. if there still like: <import project="$(vsextensionspath)\mycompany\myextension\mylang.targets" /> that great. if not, there other way? maybe can run script during vsix installation? <import project="$([system.io.directory]::getfiles($([system.io.path]::combine($([system.environment]::getfolderpath(specialfolder.localapplicationdata)), `microsoft\visualstudio\11.0\extensions`)), `your.targets`, system.io.searchoption.alldirectories))" />

visual studio 2008 - Why I cannot call the interface of Release of a COM object -

i'm develop vc add-in vc6 , vc9. following codes works. in cviadevstudio::evaluate , after call pdebugger->release() , it's ok. in cviavisualstudio::readfrommemory , after call pdebugger->release() or pproc->release() , vc9 prompt error complaint unspecified error number. don't know why. think it's reasonable call release() after have used com object. /* vc6 */ class cviadevstudio { ... iapplication* m_papplication; }; bool cviadevstudio::evaluate(char* szexp, tchar* value, int size) { bool re = false; idebugger* pdebugger = null; m_papplication->get_debugger((idispatch**)&pdebugger); if (pdebugger) { ... } exit: // following code must called, otherwise vc6 complaint invalid access // when it's started again if (pdebugger) pdebugger->release(); return re; } /* vc9 */ class cviavisualstudio { ... ccomptr<envdte::_dte> m_papplication; }; bool cvia...

python - Numpy - add row to array -

how 1 add rows numpy array? i have array a: a = array([[0, 1, 2], [0, 2, 0]]) i wish add rows array array x if first element of each row in x meets specific condition. numpy arrays not have method 'append' of lists, or seems. if , x lists merely do: for in x: if i[0] < 3: a.append(i) is there numpythonic way equivalent? thanks, s ;-) what x ? if 2d-array, how can compare row number: i < 3 ? edit after op's comment: a = array([[0, 1, 2], [0, 2, 0]]) x = array([[0, 1, 2], [1, 2, 0], [2, 1, 2], [3, 2, 0]]) add a rows x first element < 3 : a = vstack((a, x[x[:,0] < 3])) # returns: array([[0, 1, 2], [0, 2, 0], [0, 1, 2], [1, 2, 0], [2, 1, 2]])

networking - redirect domain name to local network internal ip (no requirement for external access) -

i want following: open web browser on local network. type in mydevice.com(or similar) , have browser redirect actual device (192.168.1.x) the reason is, not me. product hosts web page , not want users have type in ip address. also, aware of dyndns.org , related sites. wondering though if there isnt (easier) alternative since have no requirement whatsoever in outside (i.e. no external access). pretty want tell router whenever sees request made domain name, instead redirect specific ip address on local network. question be, if such thing possible, easy enough instruct said users set up. is such thing possible? ps - may have change problem title... didnt know called, made hard google in first place. turn so, naturally, have trouble writing specific title you use hosts file. see wiki hosts file entry format os.

unicode - difficulty with japanese character encoding in wordpress -

i have wordpress installation in english of content in japanese. have set charset utf-8 in head section of page , characters display fine. if use wordpress search widget search in japanese, of characters encoded wierd encoding looks this: %e3%82%92%e8%a1%8c%e3%81%84%e3%81%be%e3%81%99%e3%80%82 , search doesn't work. have looked 2 hours trying ot find out problem can't work out. appreciated. thanks 1 have know encoding of japanese contents. 2 have convert of contents utf-8, put wordpress db. i guess skipped step 1. therefore wordpress db has shift-jis or euc japanese contents. wordpress believed contents utf-8. wordpress sent search result charcterset=utf-8 meta tag.

java - How google docs shows my .PPT files without using a flash viewer? -

i want show .ppt (powerpoint) files uploaded user on website. converting them flash files, showing flash files on web page. don't want use flash this. want show it, google docs shows, without using flash. i've solved problem .pdf files converting them images using imagemagick, have trouble .ppt files. i maybe try using google docs api first upload ppt presentation , download in different format. think should possible though have not tested it.

.net - Trouble updating self-tracking entities -

i'm using self-tracking entities in wcf client-server application. wcf service returns various entities, , these can updated using corresponding update methods. this worked while, i'm having problems. keep focus, i'l limit discussion specific case, simplified bare essentials. one of tables called systemdefinition. has no foreign keys, 1 other table (route) has foreign key it. consequently, has single navigation property in entity model (called routes). other columns scalars. table, , corresponding entities, has primary key column called id, of type guid. database sql server compact v3.5. to reproduce problem, can: retrieve single systemdefinition entity using wcf service's getsystem() method in client, call markasdeleted() on entity call updatesystem(), passing entity parameter the code in updatesystem() (non-essential code deleted clarity): _objectcontext.systemdefinitions.applychanges(system); _objectcontext.savechanges(); the entity retrieved n...

Java runtime error with JNI -

i trying build , run example jni program. program sample helloworld program. did not write assume works. running on linux. there 4 files. hellonative.c hellonative.h hellonative.java hellonativetest.java to build files, did gcc -i/mydir/jdk/include -i/mydir/jdk/include/linux -fpic -c hellonative.c gcc -shared -o hellonative.so hellonative.o java *java here result of build hellonative.c hellonative.h hellonative.o hellonativetest.class hellonative.class hellonative.java hellonative.so hellonativetest.java then did setenv ld_library_path /mydir/myexample:${ld_library_path} java hellonativetest i got following error exception in thread "main" java.lang.unsatisfiedlinkerror: no hellonative in java.library.path @ java.lang.classloader.loadlibrary(classloader.java:1734) @ java.lang.runtime.loadlibrary0(runtime.java:823) @ java.lang.system.loadlibrary(system.java:1028) @ hellon...

SQL Server 2005 derived field w/ logic -

i have 3 tables pproject, projectmilestone , releaseschedule. i want add derived field project table called enddate. the value of new field called enddate should larger of 2 values projectmilestone.enddate , releaseschedule.enddate. the sql logic 2 data points of enddate within both tables this: select enddate projectmilestone milestonecid = 77 , projectid = project.projectid select enddate releaseschedule milestonecid = 77 releaseid = project.releaseid so need derived field larger of these 2 values , if neither value exist have 'n/a' i @ point trying case statement work... alter table project add enddate (case when projectmilestone.enddate < releaseschedule.enddate projectmilestone.enddate else releaseschedule.enddate end) how n/a if both null? thanks all this sort of thing better handled in client application, can in t-sql below. all outputs case statement have of same data type have cast dates char or varchar. alter table project add...

asp.net - Getting javascript libraries from Google / Microsoft CDNs through SSL -

i'm getting couple of libraries google / microsoft cdns. only 1 page on system uses ssl since i'm referencing libraries on master page i'm getting javascript libraries using ssl single page requires doesn't throw security errors because accessing unsafe resources. i've read browser cache doesn't work of browsers if resource loaded using ssl, test using fiddler indicates opposite (firefox , ie). what's truth? i'm using cdn improving performance if getting library using ssl against purpose, revert "improvement". i build send code referencing library on code behind ans use ssl or not according case, avoid this. thanks! it's common practice not cache secure web pages on disk. negates advantage of precached scripts. in other hand secure page requisites should served using secure connection. have choose between convenience , security.

Can a project contain other projects with Visual Studio? -

i have software project has following structure. - library - library b - main program - test main i have 4 project files (csproj) each one, if can debugging/compile projects in single solution explorer. does visual studio (especially 2010) support feature? no, projects cannot contain other projects in visual studio. solutions used container projects. i don't understand why project container work solution not. can elaborate?

javascript - Pressing Escape under Firefox kills my Ajax requests. I'd like to prevent this -

i'm developing web application requires long-running ajax requests. unfortunately, under firefox, pressing escape during request has drawback of killing request , information holding. rather annoying, can lead sorts of nasty complications if happens @ wrong time. therefore, deactivate feature. my first reflex intercept keypresses @ boundaries of <body>, ensure not reach window. purpose, installed [keypress] event handler, events [keychar] 27, , had invoke [stoppropagation] , [preventdefault]. , time, looked working. then, realized wouldn't work when user hadn't clicked anywhere on window, <body> event handlers never received event. tried attach handler <document> or <window> no avail, ended adding [load] event handler , had force focus <body>. , time, looked working. then, realized when user editing <input>, reason, once again, <body>, <document> or <window> event handler never seem receive event. so, added yet...

database - Wordpress blog : Import content -

i running website using php/mysql. want allow blogs using wordpress in website can use google adsense along blog content. have installed wordpress on site, using tools provided host service provider. now there anyway can import selective-content mysql database these wordpress blogs? if so, how? thanks. short answer: maybe . it depends on how content in existing mysql database structured. if old content created content management system, see if has built-in exporter. wordpress has plug-ins can import variety of commonly-used cms platforms already. check see if yours supported. unfortunately, if content kind of "there" in database without cms or kind of standard (non-custom) structure, won't work. recommendation use phpmyadmin export content, use text editor cut out portions want keep , manually create new blog posts within wordpress. process time consuming can optimized if want build custom importer.

django, python: reload function in shell -

i work in django ipython-shell, can started manage.py shell . when load extern function in shell testing, alright. when make changes function, shell still has old version of function. if make new import. does know how reload actual version of function? thanks in regards! edit: use windows - if makes difference. i reload module remove the sys.modules , make new import. import sys sys.modules.pop('your.module') import your.module # or your.module import your_function

Visual Studio 2010: Unit test results with "jump to file at line/col" links -

i'm unit testing compiler , provide unit test result can clicked , bring visual studio specified test input file cursor @ specified line/col. possible? i've tried format outlined @ http://blogs.msdn.com/b/msbuild/archive/2006/11/03/msbuild-visual-studio-aware-error-messages-and-message-formats.aspx for example: main.cs(17,20): warning cs0168: variable 'foo' declared never used afaik, visual studio doesn't columns. have built own vs error formatter , sytex goes this: %file%(%line%): error %specific error%: %error text% that appears work fine vs 2008 , 2010. the link provided has more details can use format error or warning string.

iis - maxRequestPathLength not in ASP.NET 4 documentation and doesn't work -

if try use new maxrequestpathlength settings in asp.net application not work. unrecognized attribute error. i've tried using both asp.net integrated , classic application pools in iis 7. funny if search maxrequestpathlength on msdn no found in documentation except in list of new features asp.net 4. gives? this had me foxed little while. way in .net 4 this: <httpruntime maxurllength="1024" relaxedurltofilesystemmapping="true"/> in <system.web> section of web.config. did , worked.

Bash Nested Loops, mixture of dates and numbers -

i trying output range of commands different dates , numbers associated. each hour eg. output im trying in loop is: shell.sh filename<number e.g. between 1-24> <date e.g. 20100928> <number e.g. between 1-24> <id> so the above generate output done 24 times each particular day unique 4 digit id. i thinking of having nested loop, batch number needs unique. can help? it not clear why need nested loop or whether need iterate on range of dates or not. script this: #!/bin/bash day_from=1 # first (starting) day day_to=24 # last day date=$(date +%y%m%d) # date processing. id=0 # number our unique id generation. # being incremented each day. # since variable in global scope, # unique no matter how many dates process. # if want unique id unique date scope, # reset 0 before processing each date. # let's go iterate on days. (( i=$day_from; <= $day_to; ++i )) let ++id # increment our unique id number... # pr...

.net - COM method call fails in C#, VB.NET, but works in Python -

i'm having trouble com library i'm trying use. argumentexception when call particular method , pass null . happens me in both c# project , vb.net project (i call method using nothing ) added library reference "com" list in visual studio 2008. when call same method in python, passing in none , method works expected no errors. it's understanding python interacts com library through dcom (and have fuzziest notion means) whereas might using com library directly when reference in c#/vb.net projects. happening cause parameter pass screwed before gets com library? i'm not sure what's happening here. updated com library newer version, wondered if perhaps getting version conflicts in there somewhere, causing exception. removed references com library c# , vb.net projects, deleted bin , obj directories, , re-added reference. did cause interop.mycomlibrary.dll file shows in obj have today's date instead of older date had been seeing. the document...

sqlite - Android input dialog -

i have class showing custom dialog public class add_category_dialog { public string inputed_value; private context context; public add_category_dialog(context context){ this.context=context; } public void showdialog(){ alertdialog.builder alert = new alertdialog.builder(context); alert.settitle("title"); alert.setmessage("message"); final edittext input = new edittext(context); alert.setview(input); alert.setpositivebutton("ok", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { inputed_value = input.gettext().tostring(); } }); alert.setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { return; } }); alert.show(); } } calling main activity: @overri...

How can I extract a specific table and copy from MS Word to Excel in Perl? -

i have ms word 2003 file contains several tables in , want extract specific table contents. example, tables coming under sections , want extract contents of table coming under section 6 alone , no other table contents , want copy contents new excel sheet formatting. section 4 table data table data table data section 5 table data table data table data section 6 table data # table data extracted , imported new excel sheet table data # table data extracted , imported new excel sheet table data # table data extracted , imported new excel sheet section 7 table data table data table data unless thinking of using antiword, starting point perl module win32::ole, installed part of activestate perl. need start microsoft word application using ole, open document, @ sections object of document object, find section object section six, @ tables property of range property of section object, , find table object want in it. copying excel sheet invo...

c++ - Multiply vector elements by a scalar value using STL -

hi want (multiply,add,etc) vector scalar value example myv1 * 3 , know can function forloop , there way of doing using stl function? {algorithm.h :: transform function }? yes, using std::transform : std::transform(myv1.begin(), myv1.end(), myv1.begin(), std::bind1st(std::multiplies<t>(),3));

Python - decorator - trying to access the parent class of a method -

this doesn't work: def register_method(name=none): def decorator(method): # next line assumes decorated method bound (which of course isn't @ point) cls = method.im_class cls.my_attr = 'foo bar' def wrapper(*args, **kwargs): method(*args, **kwargs) return wrapper return decorator decorators movie inception; more levels in go, more confusing are. i'm trying access class defines method (at definition time) can set attribute (or alter attribute) of class. version 2 doesn't work: def register_method(name=none): def decorator(method): # next line assumes decorated method bound (of course isn't bound @ point). cls = method.__class__ # don't understand this. cls.my_attr = 'foo bar' def wrapper(*args, **kwargs): method(*args, **kwargs) return wrapper return decorator the point of putting broken code above when know why it...

c - Which of the following would be more efficient? -

in c: lets function "myfuny()" has 50 line of codes in other smaller functions called. 1 of following code more efficient? void myfunction(long *a, long *b); int i; for(i=0;i<8;i++) myfunction(&a, &b); or myfunction(&a, &b); myfunction(&a, &b); myfunction(&a, &b); myfunction(&a, &b); myfunction(&a, &b); myfunction(&a, &b); myfunction(&a, &b); myfunction(&a, &b); any appreciated. that's premature optimization, shouldn't care... now, code maintenance point of view first form (with loop) better. from run-time point of view , if function inline , defined in same compilation unit, , compiler not unroll loop itself, , if code in instruction cache (i don't know moon phases, still believe shouldn't have noticable effect) second 1 may marginally fastest. as can see, there many conditions fastest, shouldn't that. there many other parameters optimize in progra...

x509certificate - Can I create my own digital certificate in C# or Windows? -

i'm working on c# win app digital signature.. i knew how import , export both private , public key using "x509certificate2" class in c# (i'm exporting private key in pfx type right ?) the problem how create digital certificate? how obtain one? i think looking for: how to: obtain x.509 certificate makecert.exe (certificate creation tool)

javascript - Intercept Link Clicks from Frame -

i have old fashion page uses frameset containing top frame , bottom frame. frameset defined in "index.html" , code follows: <html> <head> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script> $(document).ready(function(){ $('#mainframe').ready(function() { $('#mainframe a').live('click', function() { alert('u click'); return false; }); }); }); </script> </head> <frameset id="main" rows="125,*" cols="*"> <frame src="header.html" name="headerframe" id="headerframe" /> <frame src="main.html" name="mainframe" id="mainframe" /> </frameset> </html> i able intercept links clicked on frame "mainframe". thought add ready event live bind click eve...

concurrency - What are the possible ways to do garbage collection in concurrent systems? -

i need write garbage collector interpreter support concurrency, can find information garbage collection without concurrency. are there specific methods garbage collection of objects in multithreaded systems? can find information on architecture , implementation? concurrent garbage collection lot trickier right. there has been research concurrent garbage collection algorithms, however. mark & sweep: http://doc.cat-v.org/inferno/concurrent_gc/ mark & sweep (pdf warning): http://www.win.tue.nl/~jfg/articles/csr-04-31.pdf generational-copying: https://labs.oracle.com/techrep/2000/abstract-88.html generational-copying: http://chaoticjava.com/posts/parallel-and-concurrent-garbage-collectors/ the difficulty synchronizing threads, heap isn't left in inconsistent (invalid) state.

c# - How do you remove HttpOnly cookies? -

if application places httponly cookies on client , needs remove them how can remove them completely? you can cause cookie expire when user visits website, example: httpcookie expiredcookie = new httpcookie(cookiename); expiredcookie.expires = datetime.utcnow.adddays(-1); response.cookies.add(expiredcookie); you'll have every cookie want removed.

mysql - Creating new items based on sort values -

i have situation i'm building new list based on sort values on column. for example table: products id, name, sort_order, expiration_date table: lists id, product_id let's want have 15 products in lists table , in order. however, products expire, , when happens being removed lists table, need add in new products based on "next in line" sort_order (the last sort_order id in lists + 1, if exists, if not, start over). i hope makes sense... but question is, there way handle in 1 query? right now, here's how it: query 1: select count(*), sort_order lists order sort_order desc if($count < 15){ $difference = 15 - $count; for($c = $count; $c >= 1; $c -=1){ query 2: select id products sort_order = $so + 1 limit 1 if(results = 0){ query 3: select id products order sort_order asc limit 1 query 4: insert (id) lists }else{ query 5: insert (id) lists } } } just ...

Parsing javascript arrays in PHP -

i can't seem figure out how js array php. what have work looks this: var arrlow = [ { "e": "495864", "rank": "8678591", "rankmove": "<p><img src='up.php?ustyle=144'> 495864" }, { "e": "104956", "rank": "-", "rankmove": "<p><img src='up.php?ustyle=145'> down 1" }, { "e": "0", "rank": "0", "rankmove": "<p><img src='up.php?ustyle=975'> new" } ] json_decode , others return null, google returns strange way use serialize() http post js-understanding browser can't work here does have clue how :x ========================================================================== edit: guys! didnt know easy <?php $json = file_get_contents('24d29b1c099a719zr8f32ce219489cee.js'); $json = str_replace('var arrlow = ','...

android - getItemAtPosition() How to get readable data from the selected item in a ListView -

i have listview of contacts got android contactmanager sample. list showing fine, can't figure out how info selected item, "name" , "phone number". i can selected position, result of mcontactlist.getitematposition(position) contentresolver$cursorwrapperinner , doesn't make sense me. can't heads or tails that. anyone know how can name/id/phone number selected item in listview? here code. @override public void oncreate(bundle savedinstancestate) { log.v(tag, "activity state: oncreate()"); super.oncreate(savedinstancestate); setcontentview(r.layout.choose_contact); // obtain handles ui objects maddaccountbutton = (button) findviewbyid(r.id.addcontactbutton); mcontactlist = (listview) findviewbyid(r.id.contactlist); mshowinvisiblecontrol = (checkbox) findviewbyid(r.id.showinvisible); // initialize class properties mshowinvisible = false; mshowinvisiblecontrol.setchecked(mshowinvisible); ...

visual studio - Running multiple T4 Templates with a single click -

i have 6 t4 templates spread through solution in different projects, possible run them single click or need go through them 1 one? does "transform templates" button in toolbar of solution explorer need? oleg visual studio 2012+ in build -> transform t4 templates

Jangomail Integration with Salesforce -

has used or uses feature? i've been using free trial of centerprise recommended me works in building specific contact lists want salesforce imported jangomail. worth looking jangomail's integration salesforce because haven't had time figure out. might have spend $250 per month after free trial centerprise because it's easy use , saves me lot of time, save amount if jangomail can me. in other words, can jangomail's integration salesforce scrub contacts want salesforce obtain contacts needed segment specific ecampaigns? it depends on requirements. if need simple load of data salesforce, why should pay integration tool. but, if want more that, scrubbing , doing more meaningful stuff list, go integration tool. recommend sticking centerprise data integrator reasons mentioned. it's easy use , saves lot of time! plus it's least expensive salesforcfe integration tool in market - great value money.

html - How do I use PHP to populate a second select-tag with options based on the option selected in the first select-tag? -

i draw options second select-tag database. thanks. you have use ajax perform without page submit. or submit page make action self (the same php). check if there $_post[select1value] then populate db in second select <select2> <?php if( ($_post['submit']) && ($_post['select1']) ) { ?> <option1> of select2</option> <? } ?> thats it. but ajax nice if wan use

What email services convert URLs to links? -

aside visual splendor of html emails - links thing keeping me sending plain text emails. simpler users at times , reduce bandwidth on 50%. however, forcing users copy/paste or (* shiver *) type url plain text email not acceptable. however, seems many services such gmail , hotmail converting urls html links. if that's true, lighter emails switch plain text (in cases) without bothering anyone. anyone know percentage (or systems or clients) convert text urls clickable links? some users access via web (hotmail/yahoo/gmail) while others use clients (outlook/thunderbird). all email progams know make links clickable, web-based , normal ones. you should consider putting links @ end of mail, , use "[number]" refer them: you should visit pear[1] , friends, php[2]! [1] http://pear.php.net/ [2] http://www.php.net/ that frees problems longer urls within text, , keeps text readable.

Fastest way to communicate between c++ and c# -

we building new vision inspection system application. actual inspection system needs c++ number of reasons. system using boost & qt. for our ui, looking @ using wpf/c# ui , sql based reports. complicating factor ui has run both local on same box c++ inspection system or remotely on box if inspection system has no monitor or keyboard. our concern fastest way transfer data between 2 systems? looking @ socket based system using google protocol buffers serialization. protocol buffers generate code c++ , c#( jskeet/dotnet-protobufs ). does have suggestions/experience? if you're looking fastest way communicate c++ inspection system, implement both cases. local interface using named pipes (see here interprocess communication windows in c# (.net 2.0) ) , remote interface using google protocol buffers situations inspection system don't have keyboard and/or monitor attached. ui first tries opening named pipe on local box , if fails user has enter remote addre...

APL versus A versus J versus K? -

the array-language landscape, while fascinating, confusing no end. there reason pick 1 of j or k or apl or a? none of these options seem open-sourced -- there open sourced versions? love expand mind, remain befuddled. the differences among these languages relatively subtle. apl "proper" has advantages, , disadvantages, of original symbolic notation. (there minor changes have been made symbol set on years, they're true enough original vision.) the a+ language available open source. departs "classic" apls, them in keeping of core character set. sense has not been kept date technology changes. precursor k. languages in array-language family have departed distinctive apl character set include j, k, , nial. nial uses english words instead of symbols, , has open source interpreter called q'nial. k , j rely on symbols, these drawn ascii character set. words may used in place of symbols in these languages, however, assigning definitions. the ap...

linux - Upstart init is leaking memory, how do you debug it? -

i've got memory leak in upstart init process (pid 1), options have on debugging it? edit: suggest me real tools this, manually putting printfs or calculating memory allocations hand isn't gonna cut it. dumping init core , poking around not option. upd1: valgrind doesn't work. replacing /sbin/init on kernel command line proper valgrind + init magic doesn't seem option tries access /proc self smaps, isn't available before init ran. upd2: dmalloc doesn't work either (doesn't compile on arm). a poor man's solution log every call malloc , free , comb through logs , pattern. ld provides amazing feature here. --wrap=symbol use wrapper function symbol. undefined reference symbol resolved "__wrap_symbol". undefined reference "__real_symbol" resolved symbol. this can used provide wrapper system function. wrapper function should called "__wrap_symbol". if wishes...

jquery - uniform, change style in another file -

i have site structure: first page: <script src="../jquery.uniform.min.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript" charset="utf-8"> $(function(){ $("input, textarea, select, button").uniform(); $("#show_image_error").load("adv_dell_img_err.html?id="+ math.random()); }); </script> <link rel="stylesheet" href="../css/uniform.default.css" type="text/css" media="screen"> </head> <body> in first page:<br/> <select> <option>through google</option> <option>through twitter</option> <option>other&hellip;</option> </select> <div id = "show_image_error">load file ...</div> adv_dell_img_err.html file: file 2 //get data db ...

linux - 777 permissions for public_html - Internal Server Error on some servers, but not others? -

i have few different servers, , on servers, can chmod public_html folder 777 permissions without problems - on other servers, error messages. when trying access domain internal server error, , in cpanel error_log on 1 server messages following: fri oct 08 09:55:39 2010] [error] [client x.x.x.x] softexception in application.cpp:601: directory "/home/managedi/public_html" writeable group the reason need temporarily change public_html permissions 777 php script executes shell unzip command work properly, , able extract files when accessed via url. is there server setting causes 777 permissions public_html give internal server error? how can rid of error while still changing permissions public_html? turns out because servers have suphp enabled, while other servers not. suphp can enabled or disabled in cpanel whm under: main >> service configuration >> apache configuration >> php , suexec configuration if suphp disabled, php runs apache modul...

Export contacts from a desktop application to a BlackBerry phone via USB -

i have develop module exports contacts desktop application blackberry address book via usb connection. read irimdatabaseaccess interface , other rim interfaces cannot figure out how initial access contacts database on bb device desktop application. blackberry desktop software can csv import , export of contacts on phone. 1 option produce csv file , run desktop software import contacts.

ruby on rails - how to call javascript function in select_tag -

<%= select_tag :per_page, options_for_select([10,20,30], @per_page.to_i), :onchange => "get_per_page_url(#{self.value})" this code calling javascript function in select_tag.but problem get_per_page_url function calling here??

statusbar - Get iPhone Status Bar Height -

i need resize elements in relation height of iphone's status bar. know status bar 20 points high isn't case when it's in tethering mode. gets doubled 40. proper way determine determine it's height? i've tried [[uiapplication sharedapplication] statusbarframe] but gives me 20 x 480 in landscape correct gives me 320 x 40 in portrait. why isn't giving me opposite of (40 x 320)? the statusbarframe returns frame in screen coordinates. believe correct way corresponds in view coordinates following: - (cgrect)statusbarframeviewrect:(uiview*)view { cgrect statusbarframe = [[uiapplication sharedapplication] statusbarframe]; cgrect statusbarwindowrect = [view.window convertrect:statusbarframe fromwindow: nil]; cgrect statusbarviewrect = [view convertrect:statusbarwindowrect fromview: nil]; return statusbarviewrect; } now in cases window uses same coordinates screen, [uiwindow convertrect:fromwindow:] doesn't change anything, in...

c - How to check the status between 2 servers? -

there 2 servers, need know status(live oe dead) each other. method long tcp connecting, there better method? thanks. i`m no sysadmin, why not use nmap or likes check if ports servers listening on still open? mean, want know if alive or dead, right? when 1 of server crashes, port shouldn´t open anymore.

asp.net - InstantiateIn and user controls -

i want add user control in instantiatein this: public void instantiatein(control container) { pimvisualizer pimvisualizer = new pimvisualizer(); container.controls.add(pimvisualizer); container.controls.add(new button() {text="asdf"}); } but control doeas not appear on page (the button does). control trivial, testing approach: <%@ control language="c#" autoeventwireup="true" codefile="pimvisualizer.ascx.cs" inherits="pimvisualizer" %><asp:label id="label1" runat="server" text="uc"></asp:label> but still, why not text "uc" appear onthe page? you have load usercontrols, not create them via constructor.

unix - Set umask for a sftp account? -

could tell me how set umask for single sftp user? worth mentioning ibm aix ... adding umask 002 user's .profile didn't work... (the goal user files accesible people same group). i've seen somehowto's around editing sftpd configs, though want set 1 user only, expected find didn't need root access. thanks! f. the user can set without involvement of root, either client (per connection) or on server (per public key). from client, can override remote command used handle sftp interaction using -s option: sftp -s 'umask 0777; env path=${path}:/usr/libexec/openssh:/usr/lib/ssh:/usr/sbin sftp-server' username@hostname (if sftp-server not installed in 1 of locations mentioned above, add path also). from server, can force particular command run whenever connection made using particular public key. run connections, not sftp, can inspect $ssh_original_command environment variable decide course of action take. adding following authoriz...

sql - Modify table: How to change 'Allow Nulls' attribute from not null to allow null -

how change 1 attribute in table using t-sql allow nulls (not null --> null)? alter table maybe? -- replace nvarchar(42) actual type of column alter table your_table alter column your_column nvarchar(42) null

iphone - CSS issue on iPad with table border -

i have css problem when html page rendered on ipad. works in other browsers. problem small space between cells in tables can see in picture: http://oi53.tinypic.com/2vl0as9.jpg if zoom in page maximum on line between cells, dissappears.. must kind of bug when page rendered. can go around in way? table , css: <table class="smalltable" cellpadding=0 cellspacing=0> <tr> <td class="td1"></td> <td class="td2"></td> </tr> <tr> <td class="td1"></td> <td class="td2"></td> </tr> </table> css: .smalltable { margin: 20px auto 40px auto; border-spacing: 0; } .smalltable td { margin: 0; } .smalltable td.td1 { background: url(../images/table1.png); } .smalltable td.td2 { background: url(../images/table2.png); } i able fix putting meta tag in html head when idevice (ipod, ip...

c# - Should I return html or json in a ajax single page checkout -

i want update current asp.net webforms e-commerce site nice one-page checkout , i'm looking "best practice" on how update data. page consist of several parts: cart, user identification, payment options, delivery options etc. if user changes payment option might result in changes in other parts of page, delivery option becomes unavailable , total cost changes. do build webservices return full pre-calculated html when user changes on page? or return kind of order-object in json format , update different parts need updating javascript? the second option seem cleaner me slow normal page? or exist third option? 99.9% of time, json more compact equivalent html: smaller payload means quicker delivery of response. more important reason is: what if different pages want call webservice: 1 wants display results list while other wants display them table, , third wants put results jggrid? if webservice returns html, 2 of 3 pages can't use service. if webser...

jquery - all checkbox under a div not immediate inside to the div -

i have div id=”content” the div may contain lot of <input id="chkboxtag1" type="checkbox" value="1"/> div may contain ul tag. ul may contain check boxes. div may contain divs or ul, may contain checkboxes. is there chance values of checked check boxes inside div (not immediate inside div)? var selecteditems = new array(); $('#content input:checkbox:checked').each(function() { selecteditems.push($(this).val()); });

c++ - How can etags handle multiple directories -

how possible under emacs , c++ extend etags covering multiple directories? (i not referring recursive etgas has straight forward solution using -r option). something needed, example, in case using third party library, including headers, installed anywhere in directory structure. an similar problem facing emacs c++ editor how open included header file directly #include directive. this trivial ide's (like vc_++) since include headers path part of project cannot find similar solution emacs thinner environment not using concept of project.... answering main question: use find traverse directories example in tagging script: find . \( -name "*[tt]est*" -o -name "cvs" -o -name "*#*" -o -name "html" -o -name "*~" -o -name "*.ca*" \) -prune -o \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.cxx" -o -iname "*.h" -o -iname "*.hh" \) -exec etags -a {} \; tip c++...

java - can OptimisticLockException occur if app srv Isolation level is set to READ COMMITTED? -

Image
i using websphere application server 7.0.0.0.9 ;openjpa 1.2.3-snapshot'. have set property of jdbc data source webspheredefaultisolationlevel=2 (read committed). have question because understanding optimasticlockexception occurs if there race commit same row multiple thread. think situation should never occur if isolation level app server set read committed. this exception getting.. <openjpa-1.2.3-snapshot-r422266:907835 fatal store error> org.apache.openjpa.persistence.optimisticlockexception: optimistic lock violation detected when flushing object instance i have question because understanding optimisticlockexception occurs if there race commit same row multiple thread. yes, optimisticlockexception thrown if version attribute of entity higher (i.e. has been modified transaction) @ commit time when read. illustrated figure below (borrowed jpa 2.0 concurrency , locking ): but think situation should never occur if isolation level app server...

ant java jar classpath problem -

<target name="results"> <echo message="calculating qi" /> <java jar="jmt.jar" fork="true" failonerror="true" maxmemory="1024m" classpath="jmt/jmt"> <arg value="-name:kis"/> <arg value="-results:console"/> <arg value="../alljavas.jar"/> </java> </target> i want folder tmp run jar file in folder jmt/jmt. must run inside jmt/jmt folder becouse of dependencies files. i can run <java jar="jmt/jmt/jmt.jar" dependencies files not ok. try use classpath not working. doing wrong? use dir="jmt/jmt" attribute specify folder launch java process in, , use jar="jmt/jmt/jmt.jar" specify jar. don't need classpath attribute @ all. see http://ant.apache.org/manual/tasks/java.html

c# - How to use Microsoft.Exchange.WebServices? -

Image
i try use : microsoft.exchange.webservices.dll use outlook. connection return error error return line: service.autodiscoverurl("myusernamek@xxxx.com"); the autodiscover service not located. codes: using system; using system.collections.generic; using system.linq; using system.text; using system.net.mail; using system.net; using microsoft.exchange.webservices.data; using microsoft.exchange.webservices.autodiscover; using system.net.security; using system.security.cryptography.x509certificates; namespace test { class program { static void main(string[] args) { try { // connect exchange web services user1 @ contoso.com. exchangeservice service = new exchangeservice(exchangeversion.exchange2007_sp1); service.credentials = new webcredentials("myusernamek@xxxx.com", "mypassword", "xxxx.com"); service.traceenabled = true; ...

data structures - Finding the no of leaf nodes -

an n-ary tree has n sub-nodes each node. if tree has m non-leaf nodes, how find no of leaf nodes? first of if root level 0 , k -th level of tree have n^k nodes. can start incrementing counter level level until m nodes. way find how many levels tree consisting of. , number of leaf nodes number of nodes on last level - n^lastlevel . here example: n = 3, m = 4 . first level = 3^0 = 1 second level = 3^1 = 3 1 + 3 = 4 so found tree has 2 levels(counting 0). answer 3^2 = 9 . note: can find level number directly, noticing m sum of geometric progression: 1 + 3 + 9 + 27 ... = m hope clear.

c++ cast vector<Inherited*> to vector<abstract*> -

class interface{}; class foo: public interface{}; class bar{ public: vector<interface*> getstuff(); private: vector<foo*> stuff; }; how implement function getstuff() ? vector<interface*> result(stuff.begin(), stuff.end()); return result;

spring / hibernate - filter by current user id -

i have table companylist in oracle database : cmp_id integer -- id of company cmp_name varchar2 -- name of company usr_id integer -- foreign key users table i have spring 3 mvc app configured using annotations, pojos , dao objects (companydao) using hibernate retrieve exemple list of companies. companydao : @transactional public set<company> findallcompanys() throws dataaccessexception { return findallcompanies(-1, -1); } @suppresswarnings("unchecked") @transactional public set<company> findallcompanies(int startresult, int maxrows) throws dataaccessexception { query query = createnamedquery("findallcompanies", startresult, maxrows); return new linkedhashset<company>(query.getresultlist()); } and company domain : @entity @namedqueries( { @namedquery(name = "findallcompanies", query = "select mycompany company mycompany")}) ... public class company implemen...