Posts

Showing posts from March, 2015

c# - Debugging .dmp files from WinDbg in Visual Studio 2008 for .Net managed apps -

i trying find how take crash dump of .net managed executable , open resulting .dmp file in visual studio 2008. want see in source code exception thrown, call stack , value of variables in functions on stack. to simplify problem, i've written mini-app crashes: ... class program { static void main(string[] args) { int = 2; //variable want see value when debugging if (!file.exists(@"c:\crasher\bin\debug\file.txt")) //doesn't exist throw new filenotfoundexception(); //unhandled exception thrown } } ... i did debug build , ran outside visual studio. in windbg, clicked "attach process" , selected app. typed in windbg command window: .dump /ma c:\crasher\bin\debug\dump.dmp then opened .dmp file in visual studio. went tools->options->debugging->symbols , added following: http://msdl.microsoft.com/download/symbols (saved local folder) this gives me symbols of d

python: json.dumps can't handle utf-8? -

below test program, including chinese character: # -*- coding: utf-8 -*- import json j = {"d":"δΈ­", "e":"a"} json = json.dumps(j, encoding="utf-8") print json below result, json.dumps convert utf-8 original numbers! {"e": "a", "d": "\u4e2d"} why broken? or wrong? you should read json.org . complete json specification in white box on right. there nothing wrong generated json. generators allowed genereate either utf-8 strings or plain ascii strings, characters escaped \uxxxx notation. in case, python json module decided escaping, , δΈ­ has escaped notation \u4e2d . by way: conforming json interpreter correctly unescape sequence again , give actual character.

Delphi - Find primary email address for an Active Directory user -

i'm looking best* method find primary email address logged in active directory user (using getusername logged in username) i have seen how integrate delphi active directory? couldn't work delphi 2010. (*best method: eventual application run users not have administrative access machine) edit 1: reading on this, appears email or mail field not best way go seems might not populated, therefore i'd need use multivalue field of proxyaddresses the code below works me. extract of class use in production code. didn't proxyaddresses added , seems work, although 1 alternative e-mail address, looking smtp: g.trol@mydomain.com . can't find example more 1 address, may need test happens then. also, tested in delphi 2007, using type library found somewhere, because had trouble importing it. in code see __midl_0010 , __midl___midl_itf_ads_0000_0017 record property of field value. noticed named otherwise in different version of type library, may need mak

django - query filter on manytomany is empty -

in django there way filter on manytomany field being empty or null. class testmodel(models.model): name = models.charfield(_('set name'), max_length=200) manytomany = models.manytomanyfield('anothermodel', blank=true, null=true) print testmodel.objects.filter(manytomany__is_null=true) print testmodel.objects.filter(manytomany=none)

c# - Modify data template properties of listbox in code behind -

i have listbox in xaml per code shown below. <listbox name="mylistbox"> <listbox.itemtemplate> <datatemplate> <image source="{binding path=image}" width="175" height="175" verticalalignment="center" horizontalalignment="center"/> </datatemplate> </listbox.itemtemplate> </listbox> at runtime based on condition, want change height , width properties value using code behind. please can guide me in achieving desired functionality. many thanks i think easiest way achieve bind width , height of image 2 properties. if want change width , height of images can use 2 properties in code behind , if want able individually same bind against properties in collection items. <listbox name="mylistbox"> <listbox.itemtemplate> <datatemplate> <image source="{binding path=image}"

c++ - max_heapify procedure on heap -

i have these procedure #include <iostream> using namespace std; int parent(int ){ return i/2; } int left(int ){ return 2*i; } int right(int i){ return 2*i+1; } int a[]={ 27,17,3,16,10,1,5,7,12,4,8,9,10}; int n=sizeof(a)/sizeof(int); void max_heapify(int i){ int largest=0; int l=left(i); int r=right(i); if(l<=n && a[l]>a[i]){ largest=l; } else{ largest=i; } if(r< n && a[r]>a[largest]){ largest=r; } if (largest!=i){ int t=a[i]; a[i]=a[largest]; a[largest]=t; } max_heapify(largest); } int main(){ max_heapify(2); (int i=0;i<n;i++){ cout<<a[i]<<" "; } return 0; } when run compiles fine after run stops ubnormaly it's running why? please @ code max-heapify[2](a, i): left ← 2i right ← 2i + 1 largest ← if left ≤ heap-length[a] , a[left] > a[i] then: largest ← left

c# - How to Serialise Images from Remote URL to IsolateStorage or to XML? -

i need download images remote url , serialise them isolated storage, having trouble figuring out how work, i'm serialising uris images - , can work, want download image , store in file system, best way using c# , silverlight. i've tried finding ways this, complicated, if possible can store image data in xml if solution, want download file - .net on desktop has many methods sort of thing, need silverlight solution. if there examples demonstrate sort of thing, may - seems straightforward issue cannot resolve , have tried many things make work simply, can save image remote url isolatedstorage , asynchronously. i have code @ moment can't seem streamline it, post if no suitable alternatives posted if needed. try class. hope it'll you. start grabbing use: imagegrabber grabber = new imagegrabber(); grabber.grabimage(@"http://www.google.com.ua/images/srpr/nav_logo25.png"); btw in example i've used nice method allow read bytes s

WPF ListView Always show complete items -

i've got app multiple listview controls there's requirement item's in listview must visible. there should never partial listviewitem's showing in list. if user releases scrollviewer @ position ends showing partial item, list should "snap" , correct complete items displayed. has done before? think i'm going need overload listview and/or scrollviewer this. i'm looking suggestions on how approach this. thanks. here 1 of lists: <ctrls:snaplist x:name="part_productlist" scrollviewer.cancontentscroll="false" scrollviewer.verticalscrollbarvisibility="auto" scrollviewer.horizontalscrollbarvisibility="hidden" itemcontainerstyle="{staticresource productfinderitem}" canvas.top=&qu

html5 - JavaScript canvas generic drawImage -

i have been using drawimage cause video explode taught in tutorial: http://www.craftymind.com/factory/html5video/canvasvideo.html i able manipulate other objects using drawimage. thing when try on other image/video (an iframe example), type error. is there way around this? is there way "pixels" of arbitrary control on html5 page? simply put, can't. canvas pixel manipulated sandbox. other elements on webpage rather vector graphics, can manipulate attributes like: width, height, color, position, etc. but considered thing. imagine how work mean render single page, if manipulated pixel-by-pixel. consider hardware acceleration rather new area, , websites should run on devices different computational capabilities. even though hypertext web has gone long way become interactive application platform, yet technological boundaries still limiting areas of competition visual/performance features of native app.

java - Why cast after an instanceOf? -

in example below (from coursepack), want give square instance c1 reference of other object p1 , if 2 of compatible types. if (p1 instanceof square) {c1 = (square) p1;} what don't understand here first check p1 indeed square , , still cast it. if it's square , why cast? i suspect answer lies in distinction between apparent , actual types, i'm confused nonetheless... edit: how compiler deal with: if (p1 instanceof square) {c1 = p1;} edit2: issue instanceof checks actual type rather apparent type? , cast changes apparent type? thanks, jdelage keep in mind, assign instance of square type higher inheritance chain. may want cast less specific type more specific type, in case need sure cast valid: object p1 = new square(); square c1; if(p1 instanceof square) c1 = (square) p1;

javascript - How can I read a String[] from a JavaScriptObject? (GWT) -

i creating object json has string[] property, json looks this: { key1: "val1", key2: ["val2a", "val2b", "val2c"], } what's best way define javascriptobject? right defining new object jsstring, java object looks this: public class myobject extends javascriptobject { ... public jsarray<jsstring> getkey2() {... } this kinda annoying. it'd nice if this: public class myobject extends javascriptobject { ... public string[] getkey2() {... } but doesn't work. there better way? in advance did @ jsarraystring ?

c# - How did I wrong my DataContext? -

i've been working linq sql time now, , in solution following: in project create dbml schema. in project create simple dataaccesslayer (dal) knows first project, , instantiates datacontext. in 3rd project (business logic) instantiate dal. this works well. however, time, don't know why, "it" doesn't work. "it" being "me updating database". changed code around tests, , result don't understand. mydatacontext datacontext = new mydatacontext(myconnectionstring); databaseitem dbi = (from item in datacontext.databaseitems item.id == 1 select item).first(); dbi.name= "toto"; // datacontext.getchangeset() tells me nothing changed. i dug deeper breaking bdi.name = "toto"; , compared similar value assignment in project works (both designer generated code) , saw code missing (i wrote them down there, commented them see missing) : [column(storage="_name", dbtype="nvarchar(250)")] public s

special characters - How to use '^@' in Vim scripts? -

i'm trying work around problem using ^@ (i.e., <ctrl-@> ) characters in vim scripts. can insert them script, when script runs seems line truncated @ point ^@ located. my kludgy solution far have ^@ stored in variable, reference variable in script whenever have quoted literal ^@. can tell me what's going on here? there better way around problem? that 1 reason why never use raw special character values in scripts. while ^@ not work, string <c-@> in mappings works expected, may use 1 of nnoremap <c-@> {rhs} nnoremap <nul> {rhs} it strange, cannot use <char-0x0> here. notes null byte in strings: inserting null byte string truncates it: vim uses old c-style strigs end null byte, cannot appear in strings. these strings inefficient, if want generate large text, try accumulating list of lines (using setline fast buffer represented list of lines). most functions return list of strings (like readfile , getline(start, end) ) or t

java - Using buttons to switch views with Android SDK -

i'm having trouble switching views button presses in android app. code shows no errors in eclipse, app quits unexpectedly in emulator when button clicked. code below. thanks public class main extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); button go = (button)findviewbyid(r.id.gobutton); go.setonclicklistener(mgolistener); } private onclicklistener mgolistener = new onclicklistener() { public void onclick(view v) { intent intent = new intent(intent.action_view); intent.setclassname("android.taboo.activities", "android.taboo.activities.mainmenu"); startactivity(intent); } }; } public class mainmenu extends activity{ @override public void oncreate(bundle savedinstancestate) { super.o

Querying UserType's in NHibernate -

i have following scenario: let's "product" table in legacy database has "categories" column of type string. column stores category id's separated sort of ascii character. instance: "|1|" (for category 1), "|1|2|3|" (for categories 1, 2, , 3), etc. instead of exposing string property that, want expose ienumerable, users of product class don't have worry parsing values. i'm creating selectedcatories type that's ienumerable, , product class looks this: public class product { public virtual guid id { get; set; } public virtual string name { get; set; } public virtual bool discontinued { get; set; } public virtual selectedcategories categories { get; set; } } i created selectedcategoriesusertype class so: public class seletedcategoriesusertype : iusertype { static readonly sqltype[] _sqltypes = {nhibernateutil.string.sqltype}; public bool equals(object x, object y) { // fix check

linux - Why does emacs sometimes insert weird characters at the top of my file? -

every often, when save file using emacs open file find weird string of characters inserted @ beginning of file. have noticed on multiple computers, don't believe specific machine. i'm running ubuntu 9.04 gnu emacs version 23.1.1. here sample of found today while editing latex document: b1;2305;0c\documentclass{article} \usepackage{graphicx} \usepackage{hyperref} am perhaps closing file incorrectly? are running emacs in shell or under x? looks terminal problem (similar escape sequences see if terminal doesn't cursor keys et al.)

php - Regex to add a comma after every sequence of digits in a string -

i want regex or loop on numbers in string , add comma after them. if there comma shouldn't it. example: $string="21 beverly hills 90010, ca"; output: $string="21, beverly hills 90010, ca"; thanks you do $string = preg_replace('/(?<=\d\b)(?!,)/', ',', $string); explanation: (?<=\d\b) # assert current position right of digit # , digit last 1 in number # (\b = word boundary anchor). (?!,) # assert there no comma right of current position then insert comma in position. done. this not insert comma between number , letter (it not change 21a broadway 21,a broadway ) because \b matches between alphanumeric , non-alphanumeric characters. if want this, use /(?<=\d)(?![\d,])/ instead.

Python datetime format like C# String.Format -

i'm trying port application c# python. application allows user choose datetime format using c# string.format datetime formatting . python's datetime formatting not close same, i'm having jump code through few hoops. is there way python can parse strings yyyy-mm-dd hh-mm-ss instead of %y-%m-%d %h-%m-%s ? you can fair distance using simple replacement convert format strings. _format_changes = ( ('mmmm', '%b'), ('mmm', '%b'), # note: order in list critical ('mm', '%m'), ('m', '%m'), # note: no exact equivalent # etc etc ) def conv_format(s): c, p in _format_changes: # s.replace(c, p) #### typo/braino s = s.replace(c, p) return s i presume "hoops" means similar. note there complications: (1) c# format can have literal text enclosed in single quotes (examples in link quoted) (2) allows single character made literal escaping (e.g.)

string - jQuery template rendered output -

when pass html elementals strings in object not converted elements upon rendering, template gets filled this <tr><td>"<img src="path/pic.png" />"</td></tr> if pass dom elementals get <tr><td>[object htmlimageelement]</td></tr> how can actual image rendered dom element ? using jquery template plugin should reduce html string building usage. edit : simple example below grabs dom elements , gives jquery template, renders it. source html <div id="source-id"><a href="http://link/to/this.file" title="foo">bar</a> <img src="path/pic1.png" />pic1_text <img src="path/pic2.png" title="picture 2" />pic2_text</div> <div id="target-id"><div> jquery template <script type="text/x-jquery-tmpl" id="linktemplate"><table><tr><td>${link}</td>&

actionscript - Communicating with a loaded as2 swf in another as2 swf -

i have loaded as2 swf inside as2 swf using moviecliploader. have no control(cannot edit) on child swf. there way can communicate child swf parent swf. the child swf not accepting localconnection objects. can call method in child swf other way? thanks, sri i made mistake of adding code interacting loaded swf buttons in onloadcomplete listener doesn't work unless interacting loaded swf container only, dynamic text or buttons inside loaded swf can't accessed. control objects inside child (buttons, dynamic text etc) add code in onloadinit listener. example mcllistener.onloadinit = function(childswf:movieclip, status:number):void { childswf.btninsidechild.onrelease = function() { childswf._x += 10; } }; moved loaded childswf clicking buttons inside loaded swf

vb6 :create object dynamically -

in vb6, can : set object=new class where object object , class class defined in code. now, want same dynamically, want like: set object=createobject("class") but fail because createobject apparently activex registered class , not class modules. i hope reason want mimic sort of interface-like functionality, otherwise it's not ideal solution. anyway, create method gives different class depending on string provide. function myclasscreatingfunction(classname) select classname case: "class1" set myclasscreatingfunction = new class1 exit function ... end select end function

Difference between :as option in Rails 2 and Rails3 routing? -

in rails 2.x have: map.resources :posts, :controller => 'posts', :as => 'articles' this creates alias our posts routes. example, sends "domain.com/articles/" posts controller index action. in rails3, however, :as option behaves differently. example: resources :posts, :controller => 'posts', :as => 'articles' sets named route rather alias, , going "domain.com/articles/" gives error: no route matches {:controller=>"posts"} how old (rails 2) :as behavior using new (rails 3) api? ps: please don't tell me rename controller. that's not option me. from cursory reading of ror guide on routing, think might need try: resources :articles, :controller => "posts" (http://guides.rubyonrails.org/routing.html#specifying-a-controller-to-use) you might need add :as => "articles" , named helper might set since adding :articles resources.

html - CSS3 multiple backgrounds across selectors -

what want achieve set background in 2 separate css classes (using css3's multiple backgrounds great). little markup possible , universal. example: css .button { display: block; } .green { background-color: #87b400; background: -moz-linear-gradient(top, #a4d400, #739e00); } .icon { background-repeat: no-repeat; } .icon.add { background-image: url('../img/icons/add.png'); } html <a href="#" class="button green icon add">add item</a> <input type="submit" name="example" value="add item" class="button green icon add" /> <button type="submit" class="button green icon add">add item</button> i realize can that <a href="#" class="button green"><span class="icon add">add item</span></a> but think there better way , wouldn't able use inside input element. i don't want

java - Inputstream to BufferedImage Conversion damages the file -

i uploading image files using servelt. want resize images. converts source bufferedimage using below lines. inputstream imagestream = item.getinputstream(); bufferedimage imagebuffer = imageio.read(imagestream); then resize image , write in location. but, of output files size 0 . i using following code resize image. affinetransform @ = new affinetransform(); if(sx != 0) at.scale( sx , sx ); affinetransformop ato = new affinetransformop(at, affinetransformop.type_bilinear); uploadimage = ato.filter(uploadimage, null); //uploadimage == bufferedimage is there way convert inputstream bufferedimage without damaging image? sure image getting uploaded. but, after conversion bufferedimage, file damaged. i uploading submitting form dopost() method. below line gives me inputstream list item. inputstream imagestream = item.getinputstream(); and, writing imageio.write(image, "jpg", new file(path + ".jpg")); update java.awt.image.imagingopexcepti

Using jQuery with JSF auto-generated ids (issue with ":") -

i read post handling colon in element id in css selector outlines how select known id contains colon. what create jsf list contains images. using jquery select each image , read in id. possible without writing code replace colons? use jquery iterate on each individual img element . assuming ul element has id wx:yz : // use jquery select images within var imgs = $('#wx\\:yz img'); // iterate on each 1 , give image id library // if image has id. imgs.each(function() { if(this.id && this.id.length) { nameofyourlibraryfunction(this.id); } });

javascript - Equidistant points on canvas -

Image
i want draw variable number of equidistant points on html5 canvas element, using javascript. how calculate x/y position of each point? edit: i want distance 1 point direct neighbours , edges of canvas same. if had 8px x 8px canvas , 4 points, distace point it's direct neighbours , edges of canvas 2px. if had uneven number of points , not square canvas? (i think image might understand problem little better) i'd recommend building simple constraint solver - using relaxation arrive @ answer want. similar technique used visio-like applications. basically, can add spring forces between pairs of points , boundaries of canvas. simulate short amount of time, , 'settle' place. you try box2djs - simple javascript physics system. or read on verlet integration / constraints - it's pretty simple , running, , great these kinds of applications.

ruby - How to run IRB.start in context of current class -

i've been going through pragprog continuous testing ruby , talk invoking irb in context of current class inspect code manually. however, quote if invoke irb.start in class, self predefined, , refers object in when start called isn't true in case. even simple example like a = "hello" require 'irb' argv.clear # otherwise script parameters passed irb irb.start when try access a variable, obvious nameerror: undefined local variable or method `a' main:object it works when change a global variable $a = "hello" require 'irb' argv.clear # otherwise script parameters passed irb irb.start then can access it irb(main):001:0> $a => 1 is there way around access local , instance variables in current class? i'd suggest trying in ripl , irb alternative. above example works: a = 'hello' require 'ripl' ripl.start :binding => binding note local variables work because passing current bind

django - Initial values for CheckboxSelectMultiple -

i'm initializing form using: multisubscriptionform(initial={'email': user.email}) in form i'd initialize checkboxselectmultiple widget check set of checkboxes. how can that? more or less same actually, pass list of values , works. multisubscriptionform(initial={ 'email': user.email, 'multiple_field': ['a', 'b', 'c'], })

c - Why is realloc eating tons of memory? -

this question bit long due source code, tried simplify as possible. please bear me , reading along. i have application loop runs potentially millions of times. instead of several thousands millions of malloc / free calls within loop, 1 malloc front , several thousands millions of realloc calls. but i'm running problem application consumes several gb of memory , kills itself, when using realloc . if use malloc , memory usage fine. if run on smaller test data sets valgrind 's memtest, reports no memory leaks either malloc or realloc . i have verified matching every malloc -ed (and realloc -ed) object corresponding free . so, in theory, not leaking memory, using realloc seems consume of available ram, , i'd know why , can fix this. what have this, uses malloc , works properly: malloc code void () { { b(); } while (someconditionthatistrueformillioninstances); } void b () { char *firststring = null; char *secondstring = null;

ios - XCode 3.2.5 Base SDK missing, can only compile for simulator -

i used answer: install xcode 3.2.3 w/ iphone sdk 4, "base sdk missing", can't see other sdks , doesn't work. still have "base sdk missing" , can choose simulators compile for. i'm ready device test there's no iphone in active executable list. i updated newest 4.2 , 3.2.5 xcode the base-sdk can set project , targets. please check both places.

Android can ACTION_SEND be used to call a Service -

i've being able use action_send intent displays application in list when share button pressed in gallery. app sends selected picture computer , no further input form user required. rather starting app when selected in list unnecessary step possible pass data own service sends picture , avoid starting app? if not other options have? start app, sent picture , close activity? rather starting app when selected in list unnecessary step possible pass data own service sends picture , avoid starting app? action_send used starting activities, not services -- sorry. if not other options have? start app, sent picture , close activity? sounds reasonable. if of in oncreate() , call finish() , , never call setcontentview() , nothing shown user.

Sharepoint: How do I change the default page layout for newly created subsites? -

i'm working on sharepoint 2010 publishing site has many subsites. i've set custom master page, , several custom page layouts. i've discovered how set default page layout used newly created pages in subsite (found @ /_layouts/areatemplatesettings.aspx), can't seem figure out how specify default page layout used create ~/pages/default.aspx when create new subsite. right selects welcomelinks.aspx, , that's not want. is available if deploy custom master pages / layouts via code, , if so, have examples? thanks. you don't need deploy custom page layout need use code. way have solved create event receiver webprovisioned event fire after new spweb has been created. what can update publishingpage in new web page layout want. allows users create new webs set default page layout of each new web. this event receiver code: public override void webprovisioned(spwebeventproperties properties) { try { if (publishingweb.ispublishingwe

Struts2 Application hides my exceptions after adding Interceptor -

so have struts2 application i'm working on. on front page have section display exceptions application throws. worked until added custom interceptor. here interceptor code: public string intercept(actioninvocation actioninvocation) throws exception { string result = actioninvocation.invoke(); return result; } this code in action class exception gets generated, occurs authservice.authorize() called: if(authservice.authorize(username, password)) { if(authservice.adminauthorized()) { return "admin"; } return success; } this inside of authservice.authorize(), throws null point exception when acc accessed : try { acc = profilerepository.wheresingle("username", "=", username); } catch (exception e) { return false; } if (acc.password.equals(password)) { however, when page loaded. not populated: <s:property value="%{exception.message

LINQ to Dataset Left Join -

sorry if question has been raised, after hours of searching, cant seem find way on how fix this. im trying create left join on 1 table when try return column on other table, null reference error raised. tried workarounds still doesn't work. here code. from t1 in ds.table1 join t2 in ds.table1 on t1.col2 equals t2.col1 j1 t3 in j1.defaultifempty() select new { t1.col5, t3.col6 }; if try display columns t1 works great, once display cols t3 error appears. seems null rows t3 causing error. how can determine or rather prevent null rows t3 displayed? tried using null , dbnull still no success. i appreciate help. thanks you need handle cases t3 null. for example: from t1 in ds.table1 join t2 in ds.table1 on t1.col2 equals t2.col1 j1 t3 in j1.defaultifempty() select new { t1.col5, col6: t3 == null ? null : t3.col6 };

actionscript 3 - Calling static functions that don't exist -

i'd have class resolve calls static functions don't exist. if have object subclasses proxy class, can override callproperty() method catch calls functions, properties of object, don't exist. how can done static function calls in class? cannot done making overridden callproperty() method static. there way? i may wrong, don't think there way asking. static functions have exist , called static compiler knows there. can't see way around that. there way want without being static? maybe if described more trying achieve might able more of help.

windows - Dimming Secondary Monitors -

does know programmatic way of dimming secondary monitors while keeping primary display screen bright? have investigated existing software, dim monitors (or primary one). feel might windows registry modification perhaps. (this windows 7 platform) if point me towards registry entries can modified screen brightness levels. think handled in os , not in monitor itself. any , appreciated! http://msdn.microsoft.com/en-us/library/ms775240.aspx use setmonitorbrightness api.

sql - How to find list of tables that are having foreign key contraint for primary key of Table-A? -

how can find out list of various tables having foreign key constraint primary key of particular table. kindly guide... here's query using information_schema , adapted this blog post : select fk_table = fk.table_name , fk_column = cu.column_name , pk_table = pk.table_name , pk_column = pt.column_name , constraint_name = c.constraint_name information_schema.referential_constraints c join information_schema.table_constraints fk on c.constraint_name = fk.constraint_name join information_schema.table_constraints pk on c.unique_constraint_name = pk.constraint_name join information_schema.key_column_usage cu on c.constraint_name = cu.constraint_name join ( select i1.table_name, i2.column_name information_schema.table_constraints i1 join information_schema.key_column_usage i2 on i1.constraint_name = i2.constraint_name i1.constraint_type = 'primary key'

c# - How to make the following code snippet work and How to pass the parameter to invoke? -

using system; f.involk() failed since needs string parameter, how correct code? namespace lamdatest { class program { static void test(func<string,bool> f) { **f.invoke();** } static bool getitem(string s) { console.writeline("getitem"); if (s == "123") return true; else return false; } static void main(string[] args) { test((string s)=> getitem("123")); } } } try replacing: **f.invoke();** with: f(null); however, if not using string argument, should instead use delegate type func<bool> or action .

c++ - Identifying installed updates in win vista and win 7? -

in winxp, reading registry entries @ location software\microsoft\windows nt\currentversion\hotfix give me list of installed updates windows system. i guessing practise has been discountinued since windows 7 (may vista too). how generate list of installed updates? have changed name of resgistry location? or have introduced new method identify this? similar question: registry key install update , hotfix information on windows 7 windows update agent api if need code.

encryption - C# How to simply encrypt a text file with a PGP Public Key? -

i've researched bit how achieve said in question , found several apis of them complicated , since i'm noobie in area want simple method like: public string encrypt(string message, publickey publickey) don't know if can done? if not please enlighten me way achieve :) thank you. update: so far have seen of library openpgp encryption require both public key , private key encrypt while want encrypt public key (because don't have private key use it)! i found tutorial here requires both secret key , public key encrypt data. i've modified codes bit require public key (no signing, no compress) , thought should publish here in case looking solution question. belows modified codes, credits author - mr. kim. public class pgpencrypt { private pgpencryptionkeys m_encryptionkeys; private const int buffersize = 0x10000; /// <summary> /// instantiate new pgpencrypt class initialized pgpencryptionkeys. ///

Adding images into array of an Android Application -

i want display images in application added "raw" folder of eclipse gets started. how add particular images array , rotate loop until images displayed? can me this? check out android's frame animation. think want. http://developer.android.com/guide/topics/graphics/2d-graphics.html#frame-animation

iphone - Is there a way to dismiss an no button UIalertView after some time? -

uialertview *alertview = [[uialertview alloc] initwithtitle:@"tittle" message:@"" delegate:self cancelbuttontitle:@"" otherbuttontitles:nil]; [alertview show]; [alertview release]; i want dimiss alerview after it's showing time,but when alertview has no button,it doesn't work if invoked -dismisswithclickedbuttonindex:animated: method and- performselector:withobject:afterdelay: there other way dismiss ? ideas! -(void)xx { [self performselector:@selector(dismissalertview:) withobject:alertview afterdelay:2]; } -(void)dismissalertview:(uialertview *)alertview{ [alertview dismisswithclickedbuttonindex:0 animated:yes]; } that's it.i fix it

Multiple login pages within the same ASP.Net application using Forms Authentication -

i have asp.net application makes use of forms authentication. have 2 folders "protected" administrators , registered users. want have 2 different login pages based on whether user trying access /admin/ or /members/ folder. based on understanding there can 1 login page configured in web.config when using forms based authentication? at moment using code identify "mode" login page should display on page load of login page. below snippet of code convey approach using: select case getrootfoldername(request.querystring("returnurl")) case "members" return pagemodes.merchants case "admin" return pagemodes.admin case else throw new exception("invalid protected folder") end select ideally have 2 separate login pages. possible? you can have many login pages want, , style them see fit. underlying membership provider still return same authentication token (usually cookie) wha

php - Finding an image in a folder with subfolders which contains a post value -

i using jquery post value page should search folder , sub-folders see file exists. the start of filename have "hav_" , product code... hav_345gg.jpg i need take posted value product code , search folders find match return location link ie: http://www.mydomain.co.uk/folder/subfolder/hav_345gg.jpg any great. another option make use of phps glob function returns array based on pattern match. seems used in case. need careful of files similar names partially matching though such as: hav_123 hav_1234

Erlang: MNesia: Implementing redundancy? -

i have application developed erlang / mnesia , trying implement redundancy mnesia. i want add - remove nodes dynamically in runtime , handle synchronization of tables every new joining node. what best way implement using erlang , mnesia? thanks. you don't need implement - mnesia has these features. can add , remove nodes mnesia cluster @ runtime, add , remove table copies nodes within cluster, , mnesia:wait_for_tables/2 let cope synchronization while adding nodes or table copies. have @ mnesia documentation more information.

android - Export BLENDER model into an OpenGL geometry inside a C++ header file -

i'm developing android application. i have 3d model drawn blender. know if there way export model opengl geometry? i'm going use c++ code load model , draw opengl. if know better choice, please tell me. there no such format defined opengl geometry . have create own structures store , manage vertices , triangles. if don't want use third party loader, easiest thing using wavefront obj format. it's simple parse, , can export models blender can export obj natively. if don't feel starting scratch, can use very basic obj loader opengl. download here .

text - Edit multiple HTML Files -

i have 90 html files audio file played (wrong link), need change src of audio file in each 1 of these files. from <embed src="../audio/" autostart=false width=0 height=0 id="sound1" enablejavascript="true"> to: file 1: <embed src="../audio/1.mp3" autostart=false width=0 height=0 id="sound1" enablejavascript="true"> file 2: <embed src="../audio/2.mp3" autostart=false width=0 height=0 id="sound1" enablejavascript="true"> ... any suggestions automated approach? later edit: the new src different each file... possibilities fill automated each file? file1 -> src1, file2 -> src2 ... notepad ++ has search , replace functions use here.

osx - How to set a boolean value in an array object in a plist -

i'm trying modify settings textmate modifying plist. here's i've got far: defaults write com.macromates.textmate oakshellvariables -array-add '{value = "hello"; variable = "tm_hello";}' this add in new shell variable textmate. i'm wanting via command line can script it. above works fine want set enabled key (which boolean) true. unfortunately, can't seem figure out correct syntax achieve this. attempts result in setting enabled key string instead of boolean. example: defaults write com.macromates.textmate oakshellvariables -array-add '{enabled = true ;value = "hello"; variable = "tm_hello";} this how michael. looking same thing, , happened come across answer. thought i'd share. example shown below. defaults write com.apple.dashboard layer-gadgets -array-add "<dict><key>32bit</key><false/></dict>"; these data types: <string></string>

Testing Jersey-Spring Integration with JerseyTest, Maven and TestNG -

i want test jersey resources jersey test-framework. i followed descriptions provided here http://blogs.oracle.com/naresh/entry/jersey_test_framework_makes_it http://zhanghaoeye.javaeye.com/blog/441759 to create simple example. example hosted git repository on http://github.com/rmetzler/jersey-test . $ mvn jetty:run works expected keep getting nullpointerexceptions when running $ mvn clean test . java.lang.nullpointerexception @ com.sun.jersey.spi.container.containerresponse.mapexception(containerresponse.java:429) @ com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1295) @ com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1239) @ com.sun.jersey.test.framework.impl.container.inmemory.testresourceclienthandler.handle(testresourceclienthandler.java:119) @ com.sun.jersey.api.client.client.handle(client.java:616) @ com.sun.jersey.api.client.webresource.handle(webresource.java:559)