Posts

Showing posts from 2014

Dto/TransactionScripts and Odata Services -

with odata service, can query clientside without using dto. need dto layer if use odata svc? cons , pros if don't use dto. in our old system querying mechanism there many query service-methods returns dto collection. odata services confuses mind... seems like; responsibility of server moves client. same confusion goes on, transaction scripts. i'm curios thoughts. when on server side - thing matters odata either edm model or poco models. when genrate edmx file can considered business object or model layer , pump in namespaces. in way there no business logic applying in there. but on client side can centralize odata method invocation. since support callbacks can have view model call repository , pass call back. in way dont bloat view model extensive odata query invocation. sort of repositroy pattern talking about. hope gives direction. regards :)

iphone - Two UINavigationControllers side-by-side on iPad iOS 4 without UISplitViewController -

how can create interface settings app on ipad left side not collapse in uisplitviewcontroller? i need create ui left (master if will) uitableviewcontroller , right pane (detail) uinavigationcontroller. any appreciated. had ui using uisplitviewcontroller of ios 4 on ipad regardless of hides master (left) view. thank you you may wish check out matt gemmell's mgsplitviewcontroller .

c++ - kill after sleep -

i couldnt make program sleep() after using kill(pid,sigterm) can ? the code i'm using: kill(pid_of_process_to_be_killed,sigterm); sleep(5); --> not working sleep(5); --> working the solution is: kill(pid_of_process_to_be_killed,sigterm); sleep(sleep(5)); but why first sleep after kill return 0 ? your sleep() call may terminating due receiving signal. check return value. if it's positive, might want sleep() again on value. http://www.manpagez.com/man/3/sleep/ : if sleep() function returns because requested time has elapsed, value returned zero. if sleep() function returns due delivery of signal, value returned unslept amount (the requested time minus time slept) in seconds

dom - Removing everything from string outside specified tags (PHP) -

question has been updated exclude regex possible solution. i'm trying build php function allow me strip outside of specified tags while preserving specified tags , content , not sure how this... for example: $string = "lorem ipsum <div><p>some video content</p><object></object></div><p>dolor sit</p> amet <img>" some_function($string, "<div><img>"); returns: "<div><p>some video content</p><object></object></div><img>" thanks help! ok, think figured out way based on modified version of explode_tags function posted link above: function explode_tags($chr, $str) { ($i=0, $j=0; $i < strlen($str); $i++) { if ($str{$i} == $chr) { while ($str{$i+1} == $chr) $i++; $j++; continue; } if ($str{$i} == "<") { if (strlen($res[$j]) > 0) $

iphone - Objective C - Setting variables in a Request Object -

i trying debug iphone application created contractor no longer us. background c#, , not familiar objective c @ all. wondering if here interpret piece of code me. to give little bit of background, application providing latitude/longitude coordinates .net service through request object. (void)shownearestpoi:(cllocationcoordinate2d)coordinate { asiformdatarequest *therequest = [asiformdatarequest requestwithurl: [self urlbuilderfunctionwithendpointname:kserviceidgetnearestpoi] ]; /* nsstring *tmpgeolatstring = [[nsstring stringwithformat:@"%2.6f", coordinate.latitude] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; nsstring *tmpgeolongstring = [[nsstring stringwithformat:@"%2.6f", coordinate.longitude] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; [therequest setpostvalue:tmpgeolatstring forkey:@"latitude"]; [thereq

multithreading - How to use threads in python -

i want use reading values in 17770 files , add of them @ end 1 dictionary object. have machine 8 cores. this code def run_item_preprocess (): scores = {}; in range(1,17771): filename1 = "x_" + str(i) + ".txt"; lines1 = open(filename1).readlines(); item1 = {}; line in lines1: tokens = line.split(','); item1[int(tokens[1])] = int(tokens[2]); j in range(1,17771): if j == i: continue; filename2 = "x_" + str(i) + ".txt"; lines2 = open(filename2).readlines(); item2 = {}; line in lines2: tokens = line.split(','); u = int(tokens[1]); r = int(tokens[2]); if u in item1: item2[u] = r; if not in scores: scores[i] = {}; scores[i]= (s(item1,item2),j); here wond

c# 4.0 - clr.dll!LogHelp_TerminateOnAssert in a .NET 4.0 process -

background: working on winform based .net 4.0 desktop application has few threads , timers , uses gdi processing user controls. during development peep sysinternal's process explorer make sure there isn't unusual application such count of gdi handles or user objects etc. problem: while using process explorer, found threads tab application's property in process explorer shows lots , lots of entries of "clr.dll!loghelp_terminateonassert+0x58f68". normal? think not because non of other .net application (that had written in past) shows same entry in properties in process explorer. whats loghelp_terminateonassert()? (i believe function in clr.dll) why loghelp_terminateonassert() getting called many times? any pointers helpful. thanks in advance. clr.dll!loghelp_terminateonassert+0x58f68 the large number (+58f68) indicates actual method in clr.dll far away loghelp_terminateonassert(). should fix symbols , try again in order correct call s

performance - Comparing Value of one list inside Gigantic Two Dimen list in python, Fastest way? -

i want compare if value of 1 list exist in value of other list.they huge (50k + items, database). edit: i want mark record duplicated duplicate=true , keep them in table later refrence. here how lists are: n_emails=[db_id,checksum id,checksum in search_results] #i want compare checksum if exist inside same list or other list , retrieve id (db_id , if exist) #example : n_emails= [[1,'cafebabe010'],[2,'bfeafe3df1ds],[3,'deadbeef101'],[5,'cafebabe010']] #in case want retrive id 1 , 5 coz same checksum m in n_emails: dups=_getdups(n_emails,m[1],m[0]) n_dups=[casesdb.duplicates.insert( **dup ) dup in dups] if n_dups: print "dupe found" casesdb(casesdb.email_data.id == m[0]).update(duplicated=true) def _getdups(old_lst,em_md5,em_id): dups=[] old in old_lst: if em_md5==old[0] , old[1]!=em_id: dups.append(dict(org_id=old[1],md5hash=old[0],dupid=em_id,)) return dups but

Dealing with FK constraints - Emptying and refilling sql server 2008 db -

i have sql db in ms sql server 2008 r2 for development purposes, trying clear data - add in dummy data. after struggles fk constraints, , using alter table ? nocheck constraint delete ? alter table ? check constraint i managed clear data. now want add dummy data. lets have 3 tables, country , address , country_address (linking address country). i have added data country , address but when try add country_address : no row updated. the data in row 1 not committed. error source: .net sqlclient data provider. error message: insert statement conflicted foreign key constraint i not quite sure why happening, because doing linking newly added country , addresses - both exist - why conflicting fk constraint? from googling has hinted reseeding tables may required fix this. firstly i'm not 100% sure reseeding means, assuming talking resetting autogenerated id column. i did notice when adding new records country or address use int incremented last record

expandablelistview - Implementing a Multidepth ExpandableList Android -

i trying display multi-depth expandable list. is, have table header id | school | grade | name and want show expandable list has school - grade - name where schools 1st depth, grade's second depth, , name leaf node. understand how grade display, unable figure out how additional leaf below it. any appreciated! thanks! jon as of now, there no more-than-two levels expendablelist. however, expandablelistview source, should able make custom class achieving need.

visual studio 2010 - 0x80131700 Build Error on .NET Micro Framework -

the following build error occurs when using .net micro framework project, whether in emulator mode or not. 0x80131700 or error mmp0000: 0x80131700 solution way of drop-in file available on codeplex (click here) , contains suggestions frameworks. note: ran problem during electronics class, googled above answer, posting solution here people find, archive , easy future reference. description metadataprocessor fails above error during build of .net micro framework project on computer .net framework 4.0 installed (e.g. visual studio 2010 on clean windows xp mode virtual machine). workaround issue copy attached metadataprocessor.exe.config file directory .exe file located (default %programfiles%\microsoft .net micro framework\v4.1\tools); alternatively install .net framework 2.0+ (3.5 sp1). file attachment - metadataprocessor.exe.config contents: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup usel

email - 555 5.5.2 Syntax error. gmail's smtp -

do know syntax error refering? here's code i'm using cakephp $user = $this->user->read(null,$id); $this->email->to = array('name@gmail.com');; $this->email->from = 'name@gmail.com'; $this->email->subject = 'welcome our cool thing'; $this->email->template = 'simple_message'; $this->email->sendas = 'both'; $this->email->smtpoptions = array( 'port'=>'465', 'timeout'=>'30', 'auth' => true, 'host' => 'ssl://smtp.gmail.com', 'username'=>'name@gmail.com', 'password'=>'********', ); $this->set('user', $user); $this->email->delivery = 'smtp'; $this->email->send(); note i'm sending email myself test porpuses this question asked here: cakephp smtp emails syn

MySql underscore wildcard optimization -

hey, i'm trying optimize select char statement in mysql. i aware using like '%text%' not optimizable, can underscore wildcard used in sort of optimization? for instance want such as: select * tbl col '_a_b_' is there way optimize sort of query if never use % wildcard? no. thing can in case - create field, contains same data without first letter , find where col_cut 'a_b_' . , maintain triggers.

python - Error after creating exe with Py2exe -

Image
py2exe seems run fine although mention few modules maybe missing. i had been using windows option (in py2exe script) remove console window realized process still remained open after closed down gui window i.e. still see process still in task manager... switched using console option , found below error printed there. believe error preventing the app closing. apart app runs fine. iv tried creating exe simple wxpython gui app still error have no problem creating executables apps not include wxpython. debug: src/helpers.cpp(140): 'createactctx' failed error 0x0000007b (the filename, directory name, or volume label syntax incorrect.).) python: 2.6.6 wxpython: 2.8.11.0 windows 7 py2exe: 0.6.9 # -*- coding: utf-8 -*- distutils.core import setup import py2exe import glob excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', &

iphone - Oscillating View Animation -

can 1 please guide me how create oscillation animation on imageview. i have tag image , want animate it.. any code snippets of cabasicanimation it??? you use: + (void)animatewithduration:(nstimeinterval)duration delay:(nstimeinterval)delay options:(uiviewanimationoptions)options animations:(void (^)(void))animations completion:(void (^)(bool finished))completion and use ease in , ease out transitions accelerate , decelerate toward end. note: blocks based animation valid in 4.0 , later if want earlier need use + (void)beginanimations:(nsstring *)animationid context:(void *)context and simple matter of editing frame of view.

iphone popViewController -

i having button on application hitting on have go previous page. think work using popviewcontroller. can me this?? please provide more information on problem , code well. judging question if navigation controlled app, yes popviewcontroller method work pop current view stack , go previous view on navigation stack.

c++ - QT slots and inheritance: why is my program trying to connect to the parent instead of the child class? -

in qt program, have qwidget class superclass of class declared so: class renderer : public qglwidget { q_object .... } class : public renderer { .... } now have slot class not present in renderer, when try run program, fails make connections class a: object::connect: <sender name: 'push_button'> object::connect: <receiver name: 'a'> object::connect: no such slot renderer::loaddialog() in <file path> why trying connect renderer , not a? supposed have slot in renderer of same name? thanks edit: here's declaration of slot in a: public slots: void loaddialog(); and connections, i'm relying on qt creator mostly, here's in ui_windows.h file: qobject::connect(pushbutton, signal(clicked()), a, slot(loaddialog())); hope clears things bit :) can show code connect signal , slot? maybe helpful see slot declaration in class a. edit: try add q_object macro in subclass a. thing slot not virtual (but acco

How to search LDAP by person's name? -

i'm getting error message org.springframework.web.util.nestedservletexception: request processing failed; nested exception org.springframework.ldap.namenotfoundexception: [ldap: error code 32 - no such object]; nested exception javax.naming.namenotfoundexception: [ldap: error code 32 - no such object]; remaining name 'cn=kirsi' org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:659) org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:552) javax.servlet.http.httpservlet.service(httpservlet.java:617) javax.servlet.http.httpservlet.service(httpservlet.java:717) org.springframework.security.web.filterchainproxy.dofilter(filterchainproxy.java:143) org.springframework.web.filter.delegatingfilterproxy.invokedelegate(delegatingfilterproxy.java:237) org.springframework.web.filter.delegatingfilterproxy.dofilter(delegatingfilterproxy.java:167) org.jasig.cas.client.session.singlesignoutfilter.dofilter(singlesign

Java sandbox. Using SecurityManager to redirect I/O access -

currently i'm trying write sandbox running untrusted java code. idea isolate java application accessing file system or network sockets. solution have @ moment rewritten securitymanager, forbids access io or network. now want not forbid, redirect calls file system, i.e. if application wants write "/home/user/application.txt" path file should replaced "/temp/trusted_folder/application.txt" . want allow applications access file system in particular folder , redirect other calls folder. so here method class fileoutputstream , sm asked, whether there permission write given path. public fileoutputstream(file file, boolean append) throws filenotfoundexception { string name = (file != null ? file.getpath() : null); securitymanager security = system.getsecuritymanager(); if (security != null) { security.checkwrite(name); } if (name == null) { throw new nullpointerexception(); } fd = new filedescriptor(); fd.

c# - How to pass a string inside a query -

i have pass string value inside query...here code string = configurationmanager.appsettings["var"]; sqldataadapter da = new sqldataadapter("select codesnippet edk_custombrsnippet_vw partnerid = 'a'", con); datatable dt = new datatable(); da.fill(dt); i got value in string a..but dont know how pass string in query..any suggestion? use parameterized query, example: string = configurationmanager.appsettings["var"]; sqldataadapter da = new sqldataadapter( "select codesnippet edk_custombrsnippet_vw partnerid = @partnerid", con); da.selectcommand.parameters.addwithvalue("@partnerid", a); datatable dt = new datatable(); da.fill(dt); you should not embed string value sql - opens sql injection attacks. admittedly in case it's not user-provided value, it's still better not include directly. edit: adapted example this msdn page appears sqldataadapter doesn't have parameters property far can see.

iphone - CoreData - select specific entry from one to many relationship -

Image
damn short titles! :p basically have entity named "threads" , have entity named "messages". have 1 many relationship threads ->> messages (and 1 one inverse relationship). what need records threads entity , each 1 need message latest timestamp (this int in "lastupdated" attribute, highest number guess suffice). i'm not sure other information may want, here screenshot of entities: i'm sure there must better way iterating through records , comparing threadids? thank you. once have individual thread objects, need sort on messages objects , take topmost message object. the easiest solution create method in thread class this: - (messages *) lastupdatedmessage{ nssortdescriptor *sort=[nssortdescriptor sortdescriptorwithkey:@"lastupdated" ascending:no]; nsarray *sortedmessages=[self.messagesinthread sortedarrayusingdescriptors:[nsarray arraywithobject:sort]]; return [sortedmessages objectatindex:0];

Why is initialization of integer member variable (which is not const static) not allowed in C++? -

my c++ compiler complains when try initialize int member variable in class definition. tells "only static const integral data members can initialized within class". can please explain rationale behind restriction (if possible example). the rationale "low-level" nature of c++. if allow this, compiler need generate initialization code constructors not entirely clear developer. after might necessary initialize members of base classes on construction of derived class when base class constructors not explicitly invoked. static const integral variables not need intitalization upon object creation.

delphi - Localizing SAPI Text-To-Speech to spanish -

i have managed use sapi text-to-speech in delphi/lazarus using following code: procedure tform1.button1click(sender: tobject); var spvoice: variant; begin spvoice := createoleobject('sapi.spvoice'); spvoice.speak('hello world!', 0); end; this code automatically chooses english standard voice. since need localize spanish investigated if system (windows xp standard spanish) had spanish voice or needed install it, , how change default voice, no luck far. therefore questions are: how can know if system has spanish voice installed or need install it? supposing have voice need installed, how can make sapi use voice instead of standard one? i guessing can spanish voice using following code (c0a code spanish language): spvoice.getvoices('','language=c0a').item(0) but not know how set voice used. edit : avoid confusions, need make compatible delphi , lazarus, being last 1 primary development tool. no freely available version

javascript - Funny behaviour of Array.splice() -

i experimenting splice() method in jconsole a = [1,2,3,4,5,6,7,8,9,10] 1,2,3,4,5,6,7,8,9,10 here, simple array 1 10. b = ['a','b','c'] a,b,c and b a.splice(0, 2, b) 1,2 a,b,c,3,4,5,6,7,8,9,10 when pass array b third argument of splice, mean "remove first 2 arguments of index zero, , replace them b array". i've never seen passing array splice()'s third argument (all guide pages read talk list of arguments), but, well, seems trick. [1,2] removed , [a,b,c,3,4,5,6,7,8,9,10]. build array, call c: c = ['one','two','three'] one,two,three and try same: a.splice(0, 2, c) a,b,c,3 one,two,three,4,5,6,7,8,9,10 this time, 4 (instead of 2) elements removed [a,b,c,3] , c array added @ beginning. knows why? i'm sure solution trivial, don't right now. array.splice not support array third parameter. reference: https://developer.mozilla.org/en/javascript/reference/global_objects/array/splice u

programming languages - When do you call yourself a programmer -

"a programmer, computer programmer or coder writes computer software" wikipedia if frontend development using jquery/css/html call programmer? if develop php applications deal databases, call programmer? are programmer if write applications desktops , mobiles? web place line between developer , programmer stops? i imagine question might closed off or moved if @ viewed question on stack overflow question free c learning material :) if writing significant amount of javascript code, i'd programmer. (if copying snippets of javascript you've found elsewhere, doesn't count.)

javascript - How to force 'select' event in jQuery Tabs if tab already selected? -

the main issue if tab selected 'select' event doesn't fire if set same tab id again. reason required in update content located in tab. need way fire 'select' if specify selected tab id. in theory should work like: tabcontrol.tabs('select', -1); tabcontrol.tabs('select', selectedtab); but 'select' takes 0 based index, doesn't reset tabs desired , doesn't raise event again. any solution? i wouldn't recommend selecting tab twice because need reload contents. instead solved same issue calling tabs() 'load' method instead of 'select'. var selectedtab = tabcontrol.tabs('option', 'selected'); tabcontrol.tabs('load', selectedtab);

Streaming audio from Android to desktop application -

what title says really. need stream audio microphone on telephone , play in desktop application (also java code) on computer. using udp or tcp not matter me, whatever works best. phone , computer on same nat anyway transmission work fine. i have fair idea of how send stream data device using code: mediarecorder recorder = new mediarecorder(); recorder.setaudiosource(mediarecorder.audiosource.mic); recorder.setoutputformat(mediarecorder.outputformat.mpeg_4); recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb); string host = "10.0.2.2"; int port = 5740; socket socket = null; try { socket = new socket(inetaddress.getbyname(host), port); parcelfiledescriptor pfd = parcelfiledescriptor.fromsocket(socket); recorder.setoutputfile(pfd.getfiledescriptor()); recorder.prepare(); recorder.start(); log.d(tag, "sending audio 20 seconds.."); thread.sleep(20000); } catch (exception e) { // todo auto-generated catch blo

c - An Abstrusing printf() expression -

while reading random code, happen encounter printf() expression bit strange me, statement this void printdiceface(int n){ printf("%d 0 %d\n%d %d %3$d\n%2$d 0 %1$d\n\n",n>50,51%n%2,n>53,n%2); } this obfuscated version of snippet prints face of electronic dice . example . please explain printf() statement in detail. http://en.wikipedia.org/wiki/dice the format results in: <num1> 0 <num2> <num3> <num4> <num3> <num2> 0 <num1> with numbers being either 0 or 1 depending on result of operations later on. unusual thing in format string use of %<n>$ - says parameter, arg<n> of function (instead of 'the next' in order) should used. example, if specify: printf("%d %1$x\n", 10); it prints '10 a'.

Python: Delete a character from a string -

i want delete i.e. character number 5 in string. did: del line[5] and got: typeerror: 'str' object doesn't support item deletion so no wonder whether there different efficient solution problem. strings immutable in python, can't change them in-place. but of course can assign combination of string slices same identifier: mystr = mystr[:5] + mystr[6:]

python - webbrowser modules only opens url in mozilla? -

import webbrowser webbrowser.open(url) i using open url in browser. opens in 'mozilla' why? just @ the docs . uses default browser. @ webbrowser.get() instructions on using different browser.

security - Is it safe to give the Asp.Net user account modify permissions to the root of the website? -

if give asp.net user account (network service win 2003) modify rights root folder of public website can user send request server somehow modify .aspx files of website? risks of doing this? short answer: don't it long answer: still don't, here 1 scenario followed through might make think twice (there prob many many more): if have file-upload control anywhere on site, image uploads, , attacker manages compromise security (don't forget not mean breaking site - might hijack someone's session or manage guess/steal password) can upload malicious script (.aspx page). site has "modify" permissions can write file disk. i see tagged question .net, imagine upload .aspx page <script runat="server">...</script> reads contents of web.config file , displays them. did put database connection strings passwords in clear text in web.config file? cos' if did, imagine next step upload new .aspx file connects databases... can read dat

entity framework 4 - Visual Studio 2010 Windows Forms Designer Problems -

isn't crazy error? i when trying open form containing usercontrols assebly , using entity framework , sql ce on visual studio designer. object of type namespace.t[] cannot converted type namespace.t[]!!! call stack: at system.runtimetype.trychangetype(object value, binder binder, cultureinfo culture, boolean needsspecialcast) @ system.runtimetype.checkvalue(object value, binder binder, cultureinfo culture, bindingflags invokeattr) @ system.reflection.rtfieldinfo.internalsetvalue(object obj, object value, bindingflags invokeattr, binder binder, cultureinfo culture, boolean dovisibilitycheck, boolean docheckconsistency) @ system.runtime.serialization.formatterservices.serializationsetvalue(memberinfo fi, object target, object value) @ system.runtime.serialization.objectmanager.completeobject(objectholder holder, boolean bobjectfullycomplete) @ system.runtime.serialization.objectmanager.donewlyregisteredobjectfixups(objectholder holder) @ system.runtime.serialization.objec

java - Android recognize cell phone with keyboard or not? -

in android app, want detect user's device if device has keyboard(like motorola milestone) , show corresponding user interface. guys know how that? ! regards justicepenny http://developer.android.com/reference/android/content/res/configuration.html public int keyboard the kind of keyboard attached device. 1 of: keyboard_nokeys, keyboard_qwerty, keyboard_12key. that's it!

php - Managing timezones -

i have gone through many timezone/php posts, , suggest storing datetime fields in utc, using application users timezone offset when storing , displaying datetime information. the problem have i've inherited application wasn't timezone aware, , need cater this. the server set "est +11:00 australia/melbourne" , , there applications running server. can't change this. fortunately, know users timezone offset, ie -05:00 , etc,. the application takes javascript dates , parses them using php's strtotime() function , stores in mysql database, this: $event_starts = date('y-m-d h:i:s', strtotime('thu dec 02 2010 11:15:00 gmt+1100 (aus eastern daylight time)'); so have suggestions best way on how can make application timezone aware considering server isn't set utc? many thanks, j. this not going easy. first of all, consider existing stored dates in local time of server, observes daylight saving time. code has these da

ios - How to get iPhone app users to submit crash reports? -

possible duplicate: iphone how crash log customers? some of users reporting crashes. best way explain them how send me crash reports, show in itunes connect list of crash reports? sent when users sync phone computers? thanks! they show in itunes connect automatically if users have enabled that. when user synchronizes device using itunes, crash reports copied directory on user's computer. if application distributed via app store , user has chosen submit crash logs apple, crash log uploaded , developer can download via itunes connect. see: http://developer.apple.com/library/ios/#technotes/tn2008/tn2151.html

iphone - DatePicker Stopping CoreData Work -

i have app saves text , date uidatepicker , shows note if got date in uidatepicker. its works great! have found setting uidatepicker date today stops coredata working! its when run setdate line stop core data working. app runs fine without crashing, doesn't save data. if comment line out, works charm. need have uidatepicker on today when app loads. i use when application starts: nsdate *now = [[nsdate alloc] init]; [datepicker setdate:now]; this fetch note: nsfetchrequest *fetch = [[nsfetchrequest alloc] init]; nsentitydescription *testentity = [nsentitydescription entityforname:@"datedtext" inmanagedobjectcontext:self.managedobjectcontext]; [fetch setentity:testentity]; nspredicate *pred = [nspredicate predicatewithformat:@"datesaved == %@", datepicker.date]; [fetch setpredicate:pred]; nserror *fetcherror = nil; nsarray *fetchedobjs = [self.managedobjectcontext executefetchrequest:fetch error:&

c# - How to retrieve the full url of the item -

i working sharepoint 2010 , ecmascript. i have added customaction context menu of document inside document library. how possible retrieve full path url of document using ecmascript? i trying (but fails if im in subsite or site collection) my custom action: <urlaction url="javascript:opendialog('miopiaggo/shoot.aspx?id=' + '{siteurl}' + document.getelementbyid({itemid}).firstchild.getattribute('href'),'shooter');"/> and opendialog function is: function opendialog(dialogpage,dialogtitle) { var options = sp.ui.$create_dialogoptions(); options.url = sp.utilities.utility.getlayoutspageurl(dialogpage); options.url += "?source=" + document.url; options.title = dialogtitle; options.dialogreturnvaluecallback = function.createdelegate(null, closecallback); sp.ui.modaldialog.showmodaldialog(options); } the problem, querystring supposed me full path of document url not good, messed duplicates whe

C# Implementing Abstract factory pattern -

ive abstract factory pattern in 1 of projects: http://www.dofactory.com/patterns/patternabstract.aspx code: public class questaoresposta : questaobaseresposta, iquestao,iquestionario { public int idquestaoresposta { get; set; } } public class questaofactory : questoesfactory { public override questaobaseresposta createquestao() { return new questaoresposta(); } } public abstract class questoesfactory { public abstract questaobaseresposta createquestao(); } public class questaobaseresposta : iquestao, imarcas, iquestionario { // constructor want create concrete instance // of class inherits questaobaseresposta using questoesfactory // abstract class, , assign current instance of // questaobaseresposta class public questaobaseresposta(questoesfactory qf) { = qf.createquestao(); } } problem cant assing value current class using "this" keyword. example: questaobaseresposta qs = new questaobaserespo

php - How to pass value to popup window using codeigniter? -

i know can use anchor_popup() open new window in codeigniter, cant figure out how pass values using that. here code using, $attr = array('width'=>'800','height'=>'700'); echo anchor_popup('friends/'.$uid.'/'.$suid.'','add friend',$attr); now popup window links friends/34/34 friends controller , rest values want give controller. iam getting error 404, 404 page not found page requested not found. using uri segment grab values. could tell me doing wrong? the link friends/34/34/ looking controller called "friends" , method called "34", hence why can't found. if friends controller has no other methods, change link this: echo anchor_popup('friends/index/'.$uid.'/'.$suid,'add friend',$attr); else, add appropriate method.

sql - Bending the rules of UNIQUE column SQLITE -

i working extensive amount of third party data. each data set has items unique identifiers. easy me utilise unique column in sqlite enforce data integrity. out of thousands of records have id third party source matching 2 unique ids third party source b. is there way of bending rules, , allowing duplicate entry in unique column? if not how should reorganise data take care of single edge case. update: create table "trainer" ( "id" integer primary key autoincrement, "name" text not null, "betfair_id" integer not null unique, "racingpost_id" integer not null unique ); problem data: miss beverley j thomas http://www.racingpost.com/horses/trainer_home.sd?trainer_id=20514 miss b j thomas http://www.racingpost.com/horses/trainer_home.sd?trainer_id=11096 vs. miss beverley j. thomas http://form.horseracing.betfair.com/form/trainer/1/00008861 both racingpost entires (my primary data source) match single betfair entry

When did colspan and rowspan become available for usage in HTML tables? -

a co-worker , curious when colspan , rowspan became available usage in html tables. we tried google , wikipedia, answer still seems elude us. i thought might have been since html 2, or early-to-mid-90s, insists wasn't until 2000 or later.... rfc 1942 introduced tables in may 96, rfc includes rowspans earliest official document implementing them. http://tools.ietf.org/html/rfc1942 edit - should mention refinement html 2.0

WCF REST - how to read Stream to text -

i have wcf rest service. xml body of each incoming message deserialized objects follows: private static message mymethod(stream stream) { try { var serializer = new xmlserializer(typeof(myobject)); var myobject = (myobject)serializer.deserialize(stream); //do stuff } catch (invalidoperationexception invex) { //write stream (xml) error log } //etc } i able write xml log when deserialization fails. have tried results in empty string. possible? thanks! you bring whole thing in string rather stream , , load/deserialize that. there particular reason stream ? alternatively (better, imo), can specify object want de-serialized datacontract , require xml in operation contract , let wcf framework work for you.

caching - Determining C code's processor cache efficiency -

i'd determine how efficiently given c code utilises processor cache, , if possible, determine data present in cache , stored in main memory (though more of nice-to-have) - there software out there can this? i know may not fit remit of stack overflow, though of course highly related programming intend use tool test code writing. if there more appropriate place, please let me know/mods move question. additionally, i'd (much) prefer software mac os x/unix. thanks! there various profilers can capture profiles based on cache misses alternative regular time interval based sampling. give idea in program not using cache effectively. on mac os x check out shark (free - part of chud tools package). on linux try zoom (commercial, there's free 30 day evaluation license).

binding - Set Properties of object in ContentControl DataTemplate within Silverlight -

i need access properties of object, cougar, in code behind. set value of drink yellow. i'm not sure how access cougar object in code behind. thanks <contentcontrol x:name="ccprogress" grid.row="0" grid.columnspan="3" horizontalcontentalignment="left" content="{binding}"> <contentcontrol.contenttemplate> <datatemplate x:name="dtprogress"> <local:cougar x:name="localprogress" drink="brown"> </local:cougar> </datatemplate> </contentcontrol.contenttemplate> </contentcontrol> those 2 links may you: http://pwnedcode.wordpress.com/2009/04/01/find-a-control-in-a-wpfsilverlight-visual-tree-by-name/ http://abubakar-dar.blogspot.com/2010/09/find-control-inside-silverlight.html http://www.mostlydevelopers.com/mostlydevelopers/blog/post/2009/06/

silverlight - Exceptions thrown from the binding type converter -

assume doing validation on text box bound property. on setter property might decorate property following [regular3xpression("^[0-9]$", errormessage = "must integer.")] however, if user types in letter in textbox, validation never happen because exception type converter. in other words, if had validation summary connected; display error "input string not in correct format." not desired "must integer". am missing something? seems broken, there way work around this?

c# - WPF - Trouble binding ToolTip text on custom user control -

i'm in process of creating simple user control; imagebutton. i've bound image button , i've decided add tooltip. i'm having troubles. seems can hard-code text tooltip in xaml control, when it's bound it's returning empty string. here's xaml control: <button x:class="bcocb.dacms.controls.imagebutton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="300" d:designwidth="300" name="this" style="{staticresource disabledbutton}"> <image source="{binding elementname=this, path=source}" /> <

java - JSP Validator is not appearing in my Properties -

on old computer, eclipse validate jsp files. new installation, no longer , there not option apply jsp validator under project->properties->validation. missing configuration, plugin, or package? appreciated. my suspicion don't have eclipse java ee developers installed. have eclipse java developers. you need web tools contains jsp validators. check comparisons of eclipse here .

c# - Preserve exception when continuing Task<T> -

i've got task<t>: task<a> sometask = ... this task can result in being successful, faulted or cancelled. i want transform result when task successful, , preserve outcome if not. this seems difficult when sometask throws exception. what i've tried: task<b> resulttask = startmytask().continuewith<b>( t => foo(t.result), taskcontinuationoptions.onlyonrantocompletion); this results in resulttask being cancelled if sometask faults. want fault. task<b> resulttask = startmytask().continuewith<b>( t => foo(t.result)); this breaks visual studio debugger because .result throws exception. if press f5, resulttask faults expected, smells. is there way let resulttask have same outcome sometask if sometask faults? essentially i'm trying express tasks: int f() { throw new someexception(); } string g(int x) { return x.tostring(); } try { string result = g(f()); } catch (someexception e)

c++ - Why is T&& instantiated as int&? -

can please explain why compiles , why t end type int& ? #include <utility> void f(int& r) { ++r; } template <typename fun, typename t> void g(fun fun, t&& t) { fun(std::forward<t>(t)); } int main() { int = 0; g(f, i); } i see on gcc 4.5.0 20100604 , gdb 7.2-60.2 because of perfect forwarding, when argument p&& lvalue, p deduced argument's type plus having & attached. int & && p being int& . if argument rvalue p deduced argument's type, would int&& argument p being int if pass, example 0 directly. int& && collapse int& (this semantic view - syntactically int& && illegal. saying u && when u template parameter or typedef refering type int& , u&& still type int& - i.e 2 references "collapse" 1 lvalue reference). that's why t has type int& .

django - How to serve several Web Socket -

i have 30 smart-sensors distributed in several private networks internet access (all of them). have establish persistent connection (socket) between sensors , server has public ip. a user can access each sensor through website (django) , send or data. from point of view, how can ensure several persistent , private connections? found https://github.com/gregmuellegger/django-websocket , think not suitable application because cannot recover existent socket connection other django views. any suggestions received. i found approach using twisted perspective broker json-rpc in server providing methods support each smart sensor, , other side each sensor use json library authenticate (basic) , send data. what think? solution? post results test it. set seperate server keeps persistent connections, , allow django application query it. twisted can provide great framework writing simple, single purpouse servers, , there tutorial on how write xml-rpc server here . python has e

sql server - Nonclustered index with include vs nearly same Nonclustered index without; Multiple query coverage -

i have 2 existing indices in db below create nonclustered index indextable1 on table (fkanothertable) create nonclustered index indextable2 on table (fkanothertable) include (pktable) i had hunch , research seems point queries call #1 satisfied #2 , #1 wasteful. couldn't find definitive answer though. is assumption correct , can drop #1 , potentially improve performance? yes. #2 entirely covers #1 , possibly vice-versa in fact. pktable clustered index key? if included in #1 (at key level because non clustered index not declared unique). if pktable not clustering key queries seeking on #1 still satisfied #2 #2 may occupy more pages making scans have used #1 tad less efficient.

Save output from Prolog execution -

i running tool in prolog, , after execute it, result appear on screen, inside prolog shell. how can copy result file? you never said prolog interpreter you're using. code works edinburgh-compatible version of prolog, swi-prolog (on fedora) in case. if have file hello.pl: hello_world :- write('hello world!'). then consult('hello'). qsave_program(hello,[stand_alone(true),goal(hello_world)]). quit interpreter , in shell: $chmod +x hello ./hello > output_file it doesn't return shell when it's done, need find way check whether or not program finished execution , ctrl-d , check output_file hope helps

c - non-buffering stdin reading -

my test application is #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> int main(int argc, char *argv[], char *envp[]) { int fd[2]; if(pipe(fd) < 0) { printf("can\'t create pipe\n"); exit(-1); } pid_t fpid = fork(); if (fpid == 0) { close(0); close(fd[1]); char *s = (char *) malloc(sizeof(char)); while(1) if (read(fd[0], s, 1)) printf("%i\n", *s); } close(fd[0]); char *c = (char *) malloc(sizeof(char)); while (1) { if (read(0, c, 1) > 0) write(fd[1], c, 1); } return 0; } i want see char-code after each entered char. in fact *s printed after '\n' in console. seems stdin (file desc 0) buffered. read function buffer-less, isn't it? wrong. upd: use linux. so solution is #include <stdio.h> #include <stdlib.h> #

Jquery-ui, redirect to some page after you click on close button -

how redirect after click close button? $(document).ready(function() { var $dialog = $('<div></div>') .html('this dialog show every time!') .dialog({ autoopen: false, title: 'basic dialog' }); $('#opener').click(function() { $dialog.dialog('open'); // prevent default action, e.g., following link return false; }); }); you define callback close event in following way well: $(document).ready(function() { var $dialog = $('<div></div>') .html('this dialog show every time!') .dialog({ autoopen: false, title: 'basic dialog', close: function(ui, event) { $(this).dialog('close'); // redirect on here. } }); });

php - Tweak a URL and make the JQUERY trick work FULL CODE 100% FINISHED -

well, scenario may familiar because ve been @ quite while though closer ever still has never worked. going put extremely clear , detailed definitively nail it. scenario we have 1 long url line upon clicking 2 things should happen @ once (the current situation ony happens 1 of them 1 or 2) 1) jquery sensitive click , opens slide panel 2) same jquery has line makes div inside panel populated (thanks php sql powered file) so, issue line. 2 have been proposed, none trick 1 , 2 mentioned above. although both syntactically correct, is, order of dots , quotes correct, none of lines opens slide , and populates div. 1st line proposed: this line lets slide panel open not transmit id_cruise value $soutput .= '"<a href=\"#\"' .' id=\"' .addslashes($arow['id_cruise']) .'\" class=\"flip\">'.addslashes($arow['from_country']).'</a>",'; 2nd line proposed this line not open , not p

c# - DataContext Accessed After Dispose -

i'm using asp.net 4.0. i've got following code returns error of "cannot access disposed object. object name: 'datacontext accessed after dispose.'." public ienumerable<batchheader> getheaders() { using(nsfchecksdatacontext context = datacontext) { ienumerable<batchheader> headers = (from h in context.batchheaders select h); return headers; } } if change to: public ienumerable<batchheader> getheaders() { using(nsfchecksdatacontext context = datacontext) { return context.batchheaders.tolist(); } } it work fine. i'm using method populate radgrid. can explain why second method work not first? thanks.

Comparing functions in Haskell -

is there way compare 2 functions in haskell? my thought answer no since functions not derive eq type class. i'm trying write pretty trivial function , seems normal sort of thing do: search :: ((enum a) => -> a) -> card -> [card] search op x list = if (op == succ && rank x == king) || (op == pred && rank x == ace) [] else let c = [ n | n <- list, rank n == op (rank x)] in if length c == 1 x : search op (head c) list else [] error message: no instance (eq (rank -> rank)) arising use of `==' basically either searches or down list of cards looking match either next or previous ranked card x, building list. taking 'pred' or 'succ' function operator works both forwards , backwards. however, need check doesn't go out of bounds on enum otherwise throws exception. so i'm looking way pre