Posts

Showing posts from August, 2013

selector - Are Objective-C initializers allowed to share the same name? -

i'm running odd issue in objective-c when have 2 classes using initializers of same name, differently-typed arguments. example, let's create classes , b: a.h: #import <cocoa/cocoa.h> @interface : nsobject { } - (id)initwithnum:(float)thenum; @end a.m: #import "a.h" @implementation - (id)initwithnum:(float)thenum { self = [super init]; if (self != nil) { nslog(@"a: %f", thenum); } return self; } @end b.h: #import <cocoa/cocoa.h> @interface b : nsobject { } - (id)initwithnum:(int)thenum; @end b.m: #import "b.h" @implementation b - (id)initwithnum:(int)thenum { self = [super init]; if (self != nil) { nslog(@"b: %d", thenum); } return self; } @end main.m: #import <foundation/foundation.h> #import "a.h" #import "b.h" int main (int argc, const char * argv[]) { nsautoreleasepool * pool = [[nsautoreleasepool alloc] init...

c# - Ambiguous Generic restriction T:class vs T:struct -

this code generates compiler error member defined same parameter types. private t getproperty<t>(func<settings, t> getfunc) t:class { try { return getfunc(properties.settings.default); } catch (exception exception) { settingreadexception(this,exception); return null; } } private tnullable? getproperty<tnullable>(func<settings, tnullable> getfunc) tnullable : struct { try { return getfunc(properties.settings.default); } catch (exception ex) { settingreadexception(this, ex); return new nullable<tnullable>(); } } is there clean work around? generic type constraints can't used overload resolution, don't need overloaded method this. use default instead of null : private t getproperty<t>(func<settings, t> getfunc) { try { ...

osx - Mac OS X pygame input goes to Terminal instead of Python -

i'm having trouble running pygame based app on mac os x via terminal. input events such keystrokes go terminal instead of python app, , detected pygame. for example, have following test script: import pygame pygame.init() screen = pygame.display.set_mode((640, 480)) done = false while not done: pygame.event.pump() keys = pygame.key.get_pressed() if keys[pygame.k_escape]: done = true if keys[pygame.k_space]: print "got here" neither k_escape nor k_space handled script when run mac os x terminal, terminal echo spaces. i'm running macports port of pygame (py-game), depends on python 2.4, , i've used python_select make python24 active version. the default py-game on mac ports has problem describe. work-around install py-game2.6 target instead. works me os x 10.6.7.

c - Check if file exists, including on PATH -

given filename in c, want determine whether file exists , has execute permission on it. i've got is: if( access( filename, x_ok) != 0 ) { but wont search path files , match directories (which don't want). please help? edit: as alternative, seeing i'm running execvp() in child process, there way check return value of execvp() , signal parent process die error message? this code's not quite want, blindly executes first thing comes to. can modify search code instead of calling execve call access , stat find out if it's not directory. think last function, execvepath , has replaced. in best unix tradition, code "self-documenting" (i.e., undocumented). #include <string.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include "shellpath.h" static void *malloc_check(const char *what, size_t n) { void *p = malloc(n); if (p == null) { fprintf(stderr, "cannot allocate %zu by...

How to install the .app file in to iphone device? -

i have .app file , provisional profile contain devices has been bounded @ creating of provisional profile when use compile , install in iphone via xcode goes in iphone without problem provisional profile. when remove provisional , app file iphone , pick app file , provisional , install via itunes through window system shows me code sign error when sync iphone through itunes install provisional in iphone unable install app file. is there proper way via can install on window or other os without fail or tutorial .. thanks is app file trying install through itunes built in distribution configuration , using distribution provisioning profile? able drag, drop , install distribution build (.app) itunes. however, can install both development , distribution provisioning profiles itunes dragging , dropping.

Create Facebook share button, without automatic customization -

i'm creating own facebook button using following istructions: http://www.kimwoodbridge.com/how-to-create-your-one-facebook-share-url/ however title , meta-information replaced information automatically fetched facebook. in other words, description append using &t=<title of content> , replaced facebook automatically retrieved page title. how can disable ? thanks ok. how parameter &t works. if facebook unable reach page, use "t" parameter instead. you’ll want provide "t" in case there network problem when facebook tries connect. in other cases, facebook use your: <meta name="title" content="your title" /> <meta name="description" content="your content" /> for thumb <link rel="image_src" href="http://www.example.com/image.jpg" /> now ok?

nhibernate - Is first level cache enabled in my Castle ActiveRecord based application? -

i have simple level asp.net web application based on castle activerecord. how can determine if first level cache enabled within or not? first level cache can never disabled. it's on.

iphone - rightBarButtonItem.enabled removes my custom layer from the uinavigationbar -

i've customized custom uinavigationbar show custom image (actually crossfade between lots of images on nstimer) : - (void) displayimage:(egoimageview*)animageview { cabasicanimation *crossfade = [cabasicanimation animationwithkeypath:@"contents"]; crossfade.duration = 0.5; crossfade.fromvalue = self.layer.contents; crossfade.tovalue = (id)[self imagefromview:animageview].cgimage; [self.layer addanimation:crossfade forkey:@"animatecontents"]; self.layer.contents = (id)[self imagefromview:animageview].cgimage; } how prevent navigationbar loose custom layer when enabling or disabling barbuttonitem? navigation bar goes it's default state after following line in vc executed: self.navigationitem.rightbarbuttonitem.enabled = !editing; (it reverts uibarstyleblackopaque i've set in vc's viewdidload) when working on custom navbar found useful how iphone apps instagram/reeder/dailybooth implement custom navigationbar...

ufw Linux firewall difference between reject and deny -

using uncomplicated firewall ufw , can set ports/services reject , deny. for example: ufw deny www ufw reject www can explain me difference between 2 approaches? "deny" uses drop iptables target, silently discards incoming packets. "reject" uses reject iptables target, sends error packet sender of rejected packet. from ufw manual page : sometimes desirable let sender know when traffic being denied, rather ignoring it. in these cases, use reject instead of deny. from point of view of user/program trying connect server: "deny" keep program waiting until connection attempt times out, short time later. "reject" produce immediate , informative "connection refused" message. edit: from security point of view "deny" slightly preferrable. force every connection potential attacker time-out, slowing down probing of server. experienced and/or determined attackers won't affected - pati...

php - Adding a page link in CakePHP -

i'm trying add page link in cakephp using: <?php echo $html->link('home', '/notes/index');?> it doesn't seem output proper link. what i'd want this: <a href="/cake/cake_startab/notes/index/" alt="home">home </a> how can this? you'll want use url array <?php echo $html->link('home', array('controller'=>'notes','action'=>'index')); ?> this work you. not able use absolute path :) check out manual page, http://api.cakephp.org/class/html-helper#method-htmlhelperlink

SQL Azure server as unit of billing -

one of azure training kit presentation says: each account has 0 or more logical servers provisioned via common portal establishes billing instrument each logical server has 1 or more databases contains metadata database & usage unit of authentication, geo-location, billing, reporting generated dns-based name each database has standard sql objects users, tables, views, indices, etc unit of consistency so i'm lost :d. not databases units of billing? i mean, thought servers logical containers , charged per number , size of databases. how servers billed? thanks. in subscription, when set sql azure, create logical server, located in 1 of 6 data centers. default, subscription supports single logical server. i'm guessing you'd have contact microsoft increase quota. in case, don't pay @ "server" - there's no data space allocated. you pay strictly per database. eac...

.net - When and where to call the RemoveHandler in VB.NET? -

i working vb.net windows forms projet in .net 1.1. , have type of architecture, simplified. public mustinherit class basetestlogic private _timerpoll timer public sub new(byval sym symbolfilemng, byval cfg lamptestconfig, byval daas daasmanager, byval mcf elux.wg.lpd.mcfs.vmcf) addhandler _timerpoll.tick, addressof timerpoll_tick end sub end class public class specifictestlogic inherits basetestlogic end class depending of type of test doing create instance of specific test derived basetestlogic . found after hundreds of object creations can have stackoverflow exception. i checked code , saw forgot remove handler timer tick. question is, , when correct remove hadler? do need implement idisposable interface in base class , removehandler in dispose ? you may go along removing handler when dispose called, purist "you shouldn't abuse idisposable purposes other disposing unmanaged resources". another option remove handler @ fi...

language agnostic - Code Golf: Ghost Leg -

the challenge the shortest code character count output numeric solution, given number , valid string pattern, using ghost leg method. examples input: 3, "| | | | | | | | |-| |=| | | | | |-| | |-| |=| | | |-| |-| | |-|" output: 2 input: 2, "| | |=| | |-| |-| | | |-| | |" output: 1 clarifications do not bother input. consider values given somewhere else. both input values valid: column number corresponds existing column , pattern contains symbols | , - , = (and [space], [lf]). also, 2 adjacent columns cannot both contain dashes (in same line). the dimensions of pattern unknown (min 1x1). clarifications #2 there 2 invalid patterns: |-|-| , |=|=| create ambiguity. given input string never contain those. the input variables same all; numeric value , string representing pattern. entrants must produce function. test case given pattern: "|-| |=|-|=|lf| |-| | |-|lf|=| |-| | |lf| | |-|=|-|" |-| |=|-|=| | |-| | |-| |=| |-|...

email - looking for Android Gmail SMTP Oauth example -

why hard find android example of sending email using oauth , google mail? i new java , android , having hard time working out. possible? i have found gmail (or pop3) library android development which links http://code.google.com/apis/gmail/oauth/code.html but no working android examples found anywhere. i this possible. have app sends email users gmail account using code http://www.jondev.net/articles/sending_emails_without_user_intervention_(no_intents)_in_android but users not enter google password in app. , don't blame them. in day , age think there easy solution many examples. so, there examples out there , missing them? tia xoauth , android source code: implementing smtp or imap xoauth hth

c# - log4net logging not creating log file -

i'm not sure if right forum post question. i'm hoping here might have used log4net in past, hoping help. i'm using log4net log exceptions. configuration settings this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configsections> <section name="log4net" type="log4net.config.log4netconfigurationsectionhandler, log4net"/> </configsections> <log4net debug="false"> <appender name="rollinglogfileappender" type="log4net.appender.rollingfileappender"> <file value="c:\logs\sample.log" /> <appendtofile value="true"/> <rollingstyle value="size"/> <maxsizerollbackups value="10"/> <maximumfilesize value="10mb"/> <staticlogfilename value="true"/> <layout type="log4net.layout.patternlayout"> <conversionpattern val...

objective c - How to be notified in OS X when a drag operation *starts* anywhere? -

i'm wondering if there's way have application notified when drag-and-drop operation starts anywhere on screen, if don't have active window there. i've looked normal drag-and-drop apis, haven't spotted this. nsdraggingdestination protocol along -[nswindow/nsview registerfordraggedtypes:] method allows notice when dragging , crosses on window, i'd notice when dragging operation started anywhere on screen. any tips on how go this? there standard cocoa api it, or there private api / kind of dirty hack information? thanks in advance :) take @ nsevent’s +addglobalmonitorforeventsmatchingmask:handler: . i’m not sure if can track mouse dragging it’s possible track mouse button up/down events.

JSON object repeats in PHP output -

this output: [ { "0": "1", "cat_id": "1", "1": "hello world!", "post_title": "hello world!", "2": "1296943703", "post_date": "1296943703", "3": "lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown printer took galley of type , scrambled make type specimen book. has survived not 5 centuries, leap electronic typesetting, remaining unchanged. popularised in 1960s release of letraset sheets containing lorem ipsum passages, , more desktop publishing software aldus pagemaker including versions of lorem ipsum.", "post_content": "lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry's standard dummy text ever since 1500s, when unknown pri...

unit testing - Android: How to test a custom view? -

there several methods of unit testing in android, what's best 1 testing custom view i've written? i'm testing part of activity in instrumentation test case, i'd rather test view, isolated. well unit testing method individual units of source code tested determine if fit use. when want test custom view, can check various methods of custom views "ontouchevent", "ondown", "onfling", "onlongpress", "onscroll", "onshowpress", "onsingletapup", "ondraw" , various others depending on business logic. can provide mock values , test it. suggest 2 methods of testing custom view. 1) monkey testing monkey testing random testing performed automated testing tools. monkey test unit test runs no specific test in mind. monkey in case producer of input. example, monkey test can enter random strings text boxes ensure handling of possible user input or provide garbage files check loading routines...

Delphi DLL called from C++ crashes when showing a form -

edit: dumb question, fixed. form1 nil because didn't assign new tform1 , forgot delphi doesn't c++. i have delphi dll want use gui of c++ program, starters, created form, , have function show form exported c++ can call it. however, program crashes when calls function. here code. (i using delphi 2010) the delphi part: unit main; interface uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, tabs, comctrls; type tform1 = class(tform) tabcontrol1: ttabcontrol; tabset1: ttabset; private { private declarations } public { public declarations } end; var form1: tform1; function showform(i: integer) : integer; export; cdecl; exports showform name 'showform'; implementation {$r *.dfm} function showform(i: integer) : integer; export; cdecl; begin form1.show(); result := 3; // random value, doesn't mean end; end. and here c++ code: hmodule h = loadlibrary("delphidll.dll"...

Create a Windows (XP) installer on a Linux machine? -

i need create installer software windows xp , newer. there mechanism on linux machine alone? (i'm running ubuntu, i'd guess not show stopper). the nsis (nullsoft scriptable install system) free , open source installer system allows create native windows installers. it uses ascript files define aspects of setup procedure , compiler generate resulting setup package. can find sources here . installer system runs on windows , posix compliant systems. there eclipse plugin available. the nullsoft installer used open source projects , commercial products. update: there new alpha release on december 24, 2013, of late 2013 project still active. update 2: beginning of april 2016 new version 2.51 released release candidate nsis 3.0.

r - Interpolation with na.approx : How does it do that? -

i doing light un-suppression of employment data, , stumbled on na.approx approach in zoo package. data represents percentage of total government employment, , figured rough estimate @ trends of change between state , local government. should add one. state % local % 2001 na na 2002 na na 2003 na na 2004 0.118147539 0.881852461 2005 0.114500321 0.885499679 2006 0.117247083 0.882752917 2007 0.116841331 0.883158669 i use spline setting allows estimation of leading na's z <- zoo(df2,1:7) d<-na.spline(z,na.rm=false,maxgap=inf) which gives output: state % local % 0.262918013 0.737081987 0.182809891 0.817190109 0.137735231 0.862264769 0.118147539 0.881852461 0.114500321 0.885499679 0.117247083 0.882752917 0.116841331 0.883158669 great right? part amazes me that, approximated na values sum 1 (which want, unexpected!) documentation na.approx says each column separately, column-wise. missing something? money's on mis-reading docum...

yaml - SnakeYAML: How to disable underscore stripping when parsing? -

here's problem. have yaml doc contains following pair: run_id: 2010_03_31_101 when get's parsed @ org.yaml.snakeyaml.constructor.safeconstructor.constructyamlint:159 underscores stripped , constructor returns long 20100331101 instead of unmodified string "2010_03_31_101" need. question: how can disable behavior , force parser use string constructor instead of long? ok. got answer form mailing list. here is hi, according spec ( http://yaml.org/type/int.html ): “_” characters in number ignored, allowing readable representation of large values you have few ways solve it. 1) not rely on implicit types, use quotes (single or double) run_id: '2010_03_31_101' 2) turn off resolver integers (as done here floats) link 1 link 2 3) define own pattern int link 3 please aware when start deviate spec other recipients may fail parse yaml document. using quotes safe. andrey

sql - Help with query -

i'm trying make query looks @ single table see if student in team called cmht , in medic team - if don't want see result. i want see record if they're in cmht or medic, not both. would right direction using sub query filter out? i've done search on not in how see check if in more 2 teams not? student team ref 1 cmht 1 1 medic 2 2 medic 3 in result 3 cmht 5 in result so far i've done following code need use sub query or self join , filter way? select table1.student, table1.team, table1.refnumber table1 (((table1.team) in ('medics','cmht')) this mark byers's answer having clause instead of subquery: select student, team, ref table1 group student having count(student) = 1

transactions - DbTransaction and DbConnection when working with EF4 -

i'm trying implement unif of work around objectcontext of ef4 in web application. uow httpmodule. need current transaction connection. when http request first commes start transaction on objectcontext context.connection.begintransaction(). on request end need retrieve current transaction connection there no property on connection object. made following code achieve doesn't work. private dbtransaction gettransaction() { if (_currenttransaction == null) { var command = getsession().connection.createcommand(); // current transaction if (command.transaction != null) _currenttransaction = command.transaction; else _currenttransaction = getsession().connection.begintransaction(); } return _currenttransaction...

java - What is PECS (Producer Extends Consumer Super)? -

i came across pecs (short producer extends , consumer super ) while reading on generics. can explain me how use pecs resolve confusion between extends , super ? tl;dr: "pecs" collection's point of view. if only pulling items generic collection, producer , should use extends ; if only stuffing items in, consumer , should use super . if both same collection, shouldn't use either extends or super . suppose have method takes parameter collection of things, want more flexible accepting collection<thing> . case 1: want go through collection , things each item. list producer , should use collection<? extends thing> . the reasoning collection<? extends thing> hold subtype of thing , , each element behave thing when perform operation. (you cannot add collection<? extends thing> , because cannot know @ runtime specific subtype of thing collection holds.) case 2: want add things collection. list consumer , should use c...

java - Why tomcat server location property is greyed in Eclipse -

Image
i want change server location can't it's greyed (i cannot select last radio button) how can then: on servers view, delete webapps published under server (right click on server > remove or right click on server > add , remove , remove manually webapps) , right click on server > publish (the 'empty' content). way un-gray server locations area.

java - Hibernate @OneToOne @NotNull -

is valid declare @onetoone , @notnull on both sides of relationship, such as: class changeentry { @onetoone(cascade=cascadetype.all) @notnull changeentrydetails changeentrydetails; public void adddetails(changeentrydetails details) { this.changeentrydetails = details; details.setchangeentry(this); } } class changeentrydetails { @onetoone(cascase=cascadetype.all) @notnull changeentry changeentry; public void setchangeentry(changeentry changeentry) { this.changeentry = changeentry; } } i can't find says invalid, seems during persistence @ least 1 side of relationship must violated. (eg., if writing changeentry first, changeentrydetails null temporarily). when trying this, see exception thrown not-null property references null or transient value . i'd avoid relaxing constraint if possible, because both sides must present. is valid declare @onetoone , @notnull on both side...

android - Re use gradient drawable with theme-dependent colors -

in 2 different activities want use same gradient drawable different colors. think refer gradient colors activity theme in follow way: i've added follow rows in attrs.xml <attr name="backgroundtopcolor" format="color" /> <attr name="backgroundbottomcolor" format="color" /> in bg_gradient.xml typed <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startcolor="?backgroundtopcolor" android:endcolor="?backgroundbottomcolor" android:angle="270" /> <corners android:radius="0dp" /> </shape> in activity theme, i've added <item name="backgroundtopcolor">#ffffffff</item> <item name="backgroundbottomcolor">#ffffff00</item> after application start in logcat 02-07 14:03:59.479: error/androidruntime(2096): caused by: java.lang.unsuppo...

c - Create statically-linked binary that uses getaddrinfo? -

i have included header netdb.h, getaddrinfo included, gcc issues warning: warning: using 'getaddrinfo' in statically linked applications requires @ runtime shared libraries glibc version used linking gcc -m32 -static -s -o2 -std=c99 -d_posix_c_source=200112l myprogram.c how can statically compile whatever file missing ? possible solutions: it glibc installation missing corresponding object file necessary static compilation. if case, create corresponding object file , link @ compilation. try eglibc instead of glibc. i succesfully compiled program dietlibc compiled without errors plus resulting binary smaller glibc makes. glibc uses libnss support number of different providers address resolution services. unfortunately, cannot statically link libnss, providers loads depends on local system's configuration.

map - Having two sets of input combined on hadoop -

i have rather simple hadoop question i'll try present example say have list of strings , large file , want each mapper process piece of file , 1 of strings in grep program. how supposed that? under impression number of mappers result of inputsplits produced. run subsequent jobs, 1 each string, seems kinda... messy? edit: not trying build grep map reduce version. used example of having 2 different inputs mapper. let's lists , b , mapper work on 1 element list , 1 element list b so given problem experiences no data dependency result in need chaining jobs, option somehow share of list on mappers , input 1 element of list b each mapper? what trying built type of prefixed look-up structure data. have giant text , set of strings. process has strong memory bottleneck, therefore after 1 chunk of text/1 string per mapper mappers should able work independent , w/o side effects. parallelism can be, mapper tries match line patterns. each input processed once! other...

c# - Incorporating ISO 8859-1 Symbols / foreign languages into a WinForms application -

i have function finds iso 8859-1 symbol within given string, , tries converting proper meaning. however, question marks instead i'd actual values like: ÿ é æ etc. can point me in right direction on how handle foreign/unique symbols? from wording of question, sounds attempting identify byte values in string , convert them - won't work. strings composed of characters , each character can consist of more 1 byte (depending on encoding). in other words, conversion stream of bytes human-readable string performed time access string. have @ system.text.encoding class. if want convert byte stream 1 encoding another, try system.text.encoding.convert(). but nice know more details specific task people can give more precise answer.

c# - Could not load type "System.Web.HttpContext" from assembly "System.Web" -

system.typeloadexception: not load type 'system.web.httpcontext' assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'. using system; using system.collections; using system.collections.generic; using system.web; using system.xml.linq; public class example : { xdocument doc = xdocument.load(system.web.httpcontext.current.server.mappath("~/example.xml")); } of course, if not in web application, no way can use httpcontext.current ! you can check if system.web.httpcontext.current null or not, it's available in web pages or web services.

php - Removing word + wildcard number from string -

i have string is $str = "testingsub1"; how can strip out sub* string? assume using preg_replace i'm not matching want regex. does know how can this? thank you that's way. $str = preg_replace("#sub[0-9]+#", "", $str); the # s delimiters; can non-alphanumeric/whitespace/backslash character doesn't appear in pattern. [0-9] means digit (you can use \d in languages, don't bother), , + means 1 or more of previous, if take + out replace first digit

actionscript 3 - Is there an FLVPlayback onHttpError? -

i'm able tell if image path file-not-found or not, because can attach loaders httpstatus. can't find similar flv (not using streaming). edit - i'm trying do, although code doesn't work: flv.addeventlistener(httpstatusevent.http_status, httpstatushandler); private function httpstatushandler(event:httpstatusevent):void { if(event.status != 200){ console.error("video httpstatushandler.error: " + event.status, event); } } flv.addeventlistener(ioerrorevent.io_error, ioerrorhandler); private function ioerrorhandler(event:ioerrorevent):void { console.error("video ioerrorhandler: " + event); } i found problem. doing: flv.load(path) flv.play() by not waiting kind of status before calling play, squelching connectionerror status.

iphone - Memory over-release problem when I am animating UIView -

i have enabled nszombie's , getting following message in console when running application: *** -[uiviewanimationstate release]: message sent deallocated instance 0xf96d7e0 here method performing animation -(void)loadavatar:(stobject*)st { nsautoreleasepool * pool = [[nsautoreleasepool alloc] init]; avatar.alpha = 0; avatar.frame = avatarrectsmall; avatar.image = [imagecache getmemorycachedimageaturl:st.avatar_url]; [uiview beginanimations:nil context:nil]; [uiview setanimationduration:.50]; avatar.frame = avatarrectnormal; [avatar setalpha:1]; [uiview commitanimations]; [pool release]; pool = nil; } i don't crash, sometimes. i'm wondering getting released? you have autorelease pool there prompts me ask, separate thread? if answer yes can't stuff uiview there. uikit not thread safe. can other things calculating positions or updating images later put on screen user interface stuff has happen in...

Programmatically monitor Exchange Inbox and print label -

here's have... i have program keeps track of barcode type labels. can select item in database , print label it. adding ability send email specific inbox on our exchange server (2007 sp1) item id in subject line print label id. far can read exchange , extract id number send report , have report print it. i'm stuck monitoring inbox. how reademail() method fire automatically? there no event make happen. have make check inbox itself. idea if need label printed, can send email inbox , label print automatically. 1 person can print these , if isn't here , needs label, lets him send email , label printed. private void reademail() { exchangeservice _mailservice = new exchangeservice(exchangeversion.exchange2007_sp1); _mailservice.usedefaultcredentials = true; _mailservice.url = new uri("https://webmail.mydomain.com/ews/exchange.asmx"); try { itemview allitems = new itemview(100); searchfilter searchfilterinbox = new searchfilter.isequalto(emailm...

.htaccess - In my project sub folders are viewable. I need to make it forbidden. How shall i make it? -

for example, if give below url in address bar images viewable right now. url : http:///www.test.com/images/ how shall able avoid this.. should not viewable or should restricted or redirected other page. how can done? thanks in advance... we can using options -indexes which should entered in .htaccess file , should placed inside corresponding folder. and working fine now...

destruction of a variable or array in C# -

i have variable or array, no longer needed. how destroy them? sorry noob-question. you don't. let reference go out of scope , it'll automatically garbage-collected .

CPP unit setup for C++ -

in cpp unit run unit test part of build part of post build setup. running multiple tests part of this. in case if test case fails post build should not stop, should go ahead , run test cases , should report summary how many test cases passed , failed. how can achieve this. thanks! your question vague precise answer. usually, unit test engine return code tell has failed (like non 0 return code in shell on linux) or generate output file results. calling system handle this. if have written (some home made scripts) have give option go on tests execution if error occurred. if using tools continuous integration server, have go through doc , find option allows go on when tests fails. a workaround write script return "ok" result if unit test fails, there lose automatic verification ... be more specific if want more clues. my2c

Ad-hoc retreival of data from SQL Server varbinary column -

i retreive binary data varbinary(max) column in sql server database debugging purposes. what easiest way data local binary file, preferably without having write throw-away console application? i have tried using sql server management studio (with "results file" option) outputs hex encoded binary string file, rather raw binary data. i've found this solution bcp command (run command prompt): c:\temp>bcp "select myvarbinarycol mytable id = 1234" queryout "c:\filename.pdf" -s mysqlserver\myinstance -t enter file storage type of field filedata [varbinary(max)]: enter prefix-length of field filedata [8]: 0 enter length of field filedata [0]: enter field terminator [none]: want save format information in file? [y/n] n starting copy... 1 rows copied. network packet size (bytes): 4096 clock time (ms.) total : 15 average : (66.67 rows per sec.) i used -t option use windows authentication connect db. if use password auth, you'll...

c# - how to shift windows forms controls? -

how can same functionality in windows forms in next example. when have 2 links 1 beneath, , when click first link panel visibleunder , next link shifted. when click again panel invisible , second link shifted back. <script type="text/javascript"> function toggledivstate(divname) { var ctl = window.document.getelementbyid(divname); if (ctl.style.display == "none") ctl.style.display = ""; else ctl.style.display = "none"; } </script> <a href="javascript:toggledivstate('poll<%# eval("id") %>');"> <div style="display: none;" id="poll<%# eval("id") %>"> something this? on click: control1.visible = !control1.visible; control2.visible = !control1.visible; ??

wcf - Exception during secure communication implementation -

im trying implement simple secured client server communiction using wcf. when im launching mt server everty thing ok , when im launching client im getting error: error : error occurred while making http request https://localhost:800 0/exchangeservice. due fact server certificate not configured http.sys in https case. caus ed mismatch of security binding between client , server. this server code : uri address = new uri("https://localhost:8000/exchangeservice"); wshttpbinding binding = new wshttpbinding(); //set binding params binding.security.mode = securitymode.transport; binding.security.transport.clientcredentialtype = httpclientcredentialtype.none; binding.security.transport.proxycredentialtype = httpproxycredentialtype.none; type contract = typeof(exchangeservice.servicecontract.itradeservice); servicehost host = new servicehost(typeof(tradeservice)); host.addserviceendpo...

c++ - Good practice for referencing objects -

i'm working on project several different object semantically linked , i'm looking way let objects refer each other. put pointers in each object , link them together. in special case there no heap objects (at least not create while writing code, vector internally might on page). came idea have class stores list of unique ids , share id objects need them known. is practice? there other, better ways this? background: project settled in academic background. not know students or other people contribute this. skill level not known, not high. not using pointers can @ least ensure objects not deleted accidentally or out of stupidity. edit: what led me idea of unique id our usage of vectors store data. 1 thing stl containers lot copying containees. why i'm not sure pointers work well. same simple indices of vector elements, content and/or it's order might change. is pratice? in experience, no. sort of unique id crap 1 more thing has managed, , managed cor...

MATLAB: How to run a different file than the one being edited? -

i (unfortunately) have matlab project 2 files, main.m , function.m . spent time editing function.m , called several times main.m . when press f5 on keyboard, runs current file ( function.m ) need keep changing main.m run project, irritating. used eclipse run last launched. is there way effect behaviour in matlab? if potential employers reading this, please note forced use program (which charges customers access thread-safe primitives) against will. if you're okay clicking button instead of hitting f5, make "run main" button in shortcuts toolbar. in main matlab window, right-click menu , turn on shortcuts toolbar if it's not on already. right-click shortcut toolbar, "new shortcut", put "run main" in label, , enter "main()" callback. work regardless of file you're editing, , set additional shortcuts alternate run configurations if point. i don't think can define key bindings these shortcuts. if want it, yair alt...

php - Remove non-numeric characters (except periods and commas) from a string -

if have following values: $var1 = ar3,373.31 $var2 = 12.322,11t how can create new variable , set copy of data has non-numeric characters removed, exception of commas , periods? values above return following results: $var1_copy = 3,373.31 $var2_copy = 12.322,11 you use preg_replace swap out non numeric characters , comma , period/full stop follows: <?php $teststring = "12.322,11t"; echo preg_replace("/[^0-9,.]/", "", $teststring); ?>

java - sessionFactory - Spring hibernate integration problem -

i'm new in spring framework (2.5.6) , have hibernate integration problem on glassfish server (open source edition 3). add when use tomcat server (v 7.0) ok. i have following code ( springwebglassfishhibernate-data.xml ): <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="entitymanagerfactory" class="org.springframework.orm.jpa.localentitymanagerfactorybean"> <property name="persistenceunitname" value="carrentalpersistenceunit" /> </bean> <bean id="sessionfactory" class="org.springframework.orm.hibernate3.annotation.annotationsessi...

core data - NSFetchedResultsController change tracking across relationship -

i have model 2 entities linked to-one relationship. want display in tableview entitya objects entityb.myintattribute equals given value. works when create fetchrequest entitya predicate @"entityb.myintattribute == avalue". my problem change tracking. have set nsfetchedresultscontrollerdelegate delegate on nsfetchedresultscontroller associated previous fetchrequest. delegate works because gets notified of deletion if set new entityb doesn't match predicate on 1 of results. if change directly value of myintattribute on entityb object predicate result changes, delegate not notified of change. does nsfetchedresultscontroller change tracking work predicate goes across relationship ? how can fetchedresultcontroller recompute predicate after modification of attribute of relationship ? are implementing of following methods in delegate: - (void)controller:(nsfetchedresultscontroller *)controller didchangesection:(id <nsfetchedresultssectioninfo>)sectioninf...

jquery gallery image show -

http://www.templatemonster.com/website-templates/23060.html possible gallery sample above jquery? , can grab jquery plugin! if mean images half shown util mousing on looking horizontal accordion slider, example of below. http://www.alohatechsupport.net/webdesignmaui/maui-web-site-design/create_image_menu_with_jquery.html

c++ - How to reverse an std::string? -

this question has answer here: how reverse string in place in c or c++? 27 answers im trying figure out how reverse string temp when have string read in binary numbers istream& operator >>(istream& dat1d, binary& b1) { string temp; dat1d >> temp; } i'm not sure mean string contains binary numbers. reversing string (or stl-compatible container), can use std::reverse() . std::reverse() operates in place, may want make copy of string first: #include <algorithm> #include <iostream> #include <string> int main() { std::string foo("foo"); std::string copy(foo); std::cout << foo << '\n' << copy << '\n'; std::reverse(copy.begin(), copy.end()); std::cout << foo << '\n' << copy << ...

c# - More control over instantiation of generic types? -

i trying use structuremap register types implement generic interface , instantiated via factory. my code: public interface imanagerbase<t, tkey> : idisposable { // methods t getbyid(tkey id); } public partial interface iserverhostmanager : imanagerbase<serverhost, int> { // serverhost specific methods } partial class serverhostmanager : managerbase<serverhost, int>, iserverhostmanager { // implementation } public class managerfactory : imanagerfactory { public iserverhostmanager getserverhostmanager() { return new serverhostmanager(); } } this works fine: for<iserverhostmanager>().hybridhttporthreadlocalscoped() .use(new managerfactory().getserverhostmanager()); my factory called , new instance of iserverhostmanager returned. is there way can scan generic types , have them instantiated via factory? this not work due serve...

session - Rails app generating extra output -

im trying fool around rails application learn proper way of doing things, , i've gotten great start, theres thing bugging me. pretty cosmetic, bugs h*** out of me. i've made session controller , session helper take care of logging in , out, , believe works fine (havent tested yet), yet when want use if !signed_in?, output in view (where im using haml), below code believe involved in generating output. sessions_helper.rb: def get_current_user @current_user ||= false end def signed_in? !get_current_user.nil? end partial: _menu.html.haml (im still learning make ruby-isk) %nav #userbox =if signed_in? =link_to 'create user', :signup | =link_to 'log in', :signin =if !signed_in? =link_to "my profile", :root | =link_to 'log out', :signout %ul %li= link_to 'about', :about %li= link_to 'concept', :concept %li= link_to 'home', :root this ends generati...

Creating content input form with custom theme (Drupal) -

i'm creating site want place content input form in custom themed template. opted because wanted whole site looked uniform. said, i'm not sure best approach this. proper invoke hook_insert/delete/update , hook_perm/hook_access myself or there anyway can still use custom theme , write code in way drupal take care of invoking appropriate hooks accordingly? in advance ps : i'm on drupal 6.x you can make website uniform changing looks of site changing in theme's page.tpl.php. , changing css , remove drupal links. if want change default modules user registration or admin part. can require knowledge of php , hard part, have study of drupal's apis. fapi.[called forms api ] if want many changes in site prefer make website without cms. bcz give freedom in anyway. i have made website in drupal have created own theme. site, not big site. have created own page.tpl.php. nitz.