Posts

Showing posts from May, 2015

php - Can we add comment on photos,albums via facebook api? -

Image
is possible to add comment on photo or album via facebook api? , if possible please specify me way. thank guys in advance ;) using php-sdk : $facebook->api("/photo_id/comments","post",array("message"=>"test comment"));

Is Nhibernate is right choice for Enterprise Applications? -

hello planing use nhibernate in dotnet 3.5 application.this application enterprise application provide core services other application of company. question is: is nhibernate right choice kind of application? are there performance issues nhibernate? nhibernate kind of data access applications. as performance enough of apps. thing think won't fit synchronization tasks tons of data transferred. kind of work orm suck.

Search form with acts_as_taggable_on (Rails 3) -

i have searchbox search products. each product has title , tagged multiple tags. i want able search products title or tag. in other words if have product called "green tea" , product tagged "green, red, blue" , type "green" searchbox, i'd both products appear in search results. i using rails 3, acts_as_taggable_on, ruby 1.9.2. in controller, action displays search results (where :q query string search box): def results @products = product.where("title ?", "%#{params[:q]}%") \ | product.tagged_with("%#{params[:q]}%") end

html - CSS how to make <TD> a fixed height? -

<table cellspacing="0" id="contacttable" style="table-layout:table-layout:fixed;; width:100%; font-weight:normal; position: absolute; top:45; left: 0;"> <td height="50" style="padding-left:5px; overflow:hidden; "> <span style="text-transform:capitalize;line-height:100%;"> //names here </span> </td> ...more code </table> this doesn't work. overflow still making cell taller, height addapting content. the best solution put div inside cell height: <td style="padding-left:5px;"> <div style="height: 50px; overflow:hidden;"> ... </div> </td> btw, span for? if need styling, can style cell directly instead.

c# - Dataset output to Excel Problem -

i using following code output data number of tables in database excel document: protected void btnexcelexport_click(object sender, eventargs e) { string strquery = "select s.story, s.storycategoryid, convert(varchar(10), s.creationdate, 103) creationdate, m.companyrole, af.name story s inner join projectiterationmember pm on pm.projectiterationmemberid = s.projectiterationmemberid inner join iterations on i.projectiterationid = pm.projectiterationid inner join member m on m.memberid = pm.memberid inner join projectstoryfactors psf on psf.storyid = s.storyid inner join agilefactors af on af.agilefactorid = psf.agilefactorid i.projectid = '" + proj_id + "'"; sqlcommand cmd = new sqlcommand(strquery); datatable dt = getdata(cmd); gridview gridview1 = new gridview(); gridview1.allowpaging = false; gridview1.datasource = dt; gridview1.databind(); response.clear(); response.buffer = true; response.addheader("content-disposition","

asp.net mvc - mvcscaffolding on Visual Web Developer 2010 Express -

i trying use mvcscaffolding using visual web developer express instead of visual studio 2010. far can install it, can’t work. actions/commands not seen powershell. vwd express limitation, or there must first before expecting work on vwd express? i've tried reach creator steven sanderson (as per advice scott hanselman) no avail.

functional programming - In Python, partial function application (currying) versus explicit function definition -

in python, considered better style to: explicitly define useful functions in terms of more general, possibly internal use, functions; or, use partial function application explicitly describe function currying? i explain question way of contrived example. suppose 1 writes function, _sort_by_scoring, takes 2 arguments: scoring function , list of items. returns copy of original list sorted scores based on each item's position within original list. 2 example scoring functions provided. def _sort_by_score(scoring, items_list): unsorted_scored_list = [(scoring(len(items_list), item_position), item) item_position, item in enumerate(items_list)] sorted_list = [item score, item in sorted(unsorted_scored_list)] return sorted_list def _identity_scoring(items_list_size, item_position): return item_position def _reversed_scoring(items_list_size, item_position): return items_list_size - item_position the function _sort_by_score never called directly; inst

c# - BinaryFormatter does not exist in CF. Solutions? -

i need serialize/deserialize obj in/from byte[] on compact framework there no binaryformatter, should do? thanks. class using on server side , want on client(a device windows mobile 6) public class serializer { public byte[] serializeobject(object obj) { if (obj == null) return null; using (memorystream stream = new memorystream()) { binaryformatter formatter = new binaryformatter(); formatter.serialize(stream, obj); return stream.toarray(); } } public object deserializeobject(byte[] bytes) { if (bytes == null) return null; binaryformatter formatter = new binaryformatter(); memorystream stream = new memorystream(bytes); return formatter.deserialize(stream); } } for scenario, might consider switching protobuf-net ; not same format binaryformatter , both client , server need tweaks, binary serialization api works on both platf

iterate an Array List in Struts2 -

i have list , reach entry in list other list. have list ready me, want display through jsp. how iterate list return 1 more list. any appreciated. regards, senny see: http://struts.apache.org/2.0.11/docs/iterator.html following should work, not tested: <s:iterator value="parentlist"> <s:iterator> <s:property/> <s:iterator> </s:iterator> the inner iterator think should use current value pushed onto stack outer iterator. s2 property tag same. if have more complicated nesting, add var property parent iterator value. value becomes name of pushed value inside iterator. an example of this: <s:iterator value="parentlist" var="referencedas"> <s:iterator value="referencedas"> <s:property/> <s:iterator> </s:iterator>

linq - How do I use LinqPad for updates with CRM 2011 -

i working linqpad , crm 2011, cloud version, , c# snippets. simple select queries work advertised. nonetheless linqpad of real use need updates , inserts , have not been able find sample code works or come real information. several kinds of things show in sample code see around net missing. in particular, testdatacontext appears part of 1 or more assemblies loaded linq-sql projects in visual studio, not in evidence on linqpad. submitchanges not there, , not clear i'd have @ or instantiate new datacontext object , try use submitchanges method. any usable information appreciated. well don't know crm 2011 linq implementation. linqpad have direct support that? anyway, can run c# code in linqpad. here's step-by-step guide how run needed code: you need add required framework assemblies (maybe take @ visual studio project). achieve this, go ‘query’->’advanced query properties’. on dialog, click on ‘add…’, on ‘browse…’. browse assemblies. add required as

c# .wav file over udp -

possible duplicates: c# capture microphone play wav file c# code i need examples how record , send .wav file on udp. if call number hear .wav file response. i have play wav sound in real time. can using udp socket,no? why want send .wav files on network? compressing them before idea. if transmit speech speex codec good, music use vorbis. and why udp? i'd start tcp since it's easier use, , switch udp if necessary. typically udp better if have significant packet loss, because can simpy skip dropped packets. packet loss rather uncommon , tcp sufficies. there many similar questions. example see question: c# capture microphone

c# - Logging changes using LINQ to SQL -

in system creating, customer requires changes data logged database table - changes being logged (i.e. if change 1 value on form full of 10 fields, it'll audit 1 change). need able compare old values new values. this of course easy - i've done before, rather messy - manually check each field in database , compare new 1 decide if should audited. there easier way, of perhaps automatically getting changed column name/values? or have 'messy' way? pretty of changes logged done using linq sql - perhaps there's way compare database table modified one, before calling submit changes? i used article on code project titled automatic event logging in linq . worked us, requested, far logging changes. if record inserted each update appears seperate row in database tracking pk, field name, old value, , new value. of course tracks performed action , when. tracks actions: create, read, update , delete. this method satisfies request dynamically include of tables

String similarity in PHP: levenshtein like function for long strings -

the function levenshtein in php works on strings maximum length 255. alternatives compute similarity score of sentences in php. basically have database of sentences, , want find approximate duplicates. similar_text function not giving me expected results. easiest way me detect similar sentences below: $ss="jack nice boy, isn't he?"; $pp="jack nice boy he"; $ss=strtolower($ss); // convert lower case dont care case $pp=strtolower($pp); $score=similar_text($ss, $pp); echo "$score %\n"; // outputs 29 % $score=levenshtein ( $ss, $pp ); echo "$score\n"; // outputs '5', indicates similar. but, not work more 255 chars :( the levenshtein algorithm has time complexity of o(n*m) , n , m lengths of 2 input strings. pretty expensive , computing such distance long strings take long time. for whole sentences, might want use diff algorithm instead, see example: highlight difference between 2 strings in php having s

windows - Best practice for storing cross domain web service access credentials? -

i'm working on application connect various remote servers using web service retrieve status information ( windows ) machines. it works within single domain can use windows authentication , ensure user calling services has correct credentials. if working across domains not going work- we're going need store set of credentials user requisite rights on application side. is there standard way of storing credentials these purposes, kind of central password store in windows or handy built in library provide kind of functionality? if not, best approach keeping passwords on central machine safe , make sure remote machine credentials available when services need called? i expect application installed on 1 of windows server operating systems- 2003 or 2008 - if makes difference available. i suggest have @ " windows identity foundation ". may overkill you, or prerequisite may not match, it's anyway worth reading instructive in terms of claims based architec

c# - Different version of ReportViewer component in the same application -

in company have application should run @ 2 different sites different database configuration. @ 1 site have sql server 2008 r2, @ other 1 sql server 2005; cannot upgrade sql server 2005 until next yer. application has no problem access different db, have problem reports hosted report server. with sql server 2005 have use 8.0 version of reportviewer dll, while sql server 2008 have use 10.0. is there anyway manage both versions of component in same visual sutdio solution/project , choose runtime version should loaded? if it's not possible, have alternatives in mind? (obviously 2 project not option) thanks lot! you dynamically load assembly dynamically loading assembly @ runtime base on in config file chooses. i think can put in config file determines @ runtime assembly use, i'e never used , don't know there.

c++ - Array of Function Pointers Without a typedef -

arrays of function pointers can created so: typedef void(*functionpointer)(); functionpointer functionpointers[] = {/* stuff here */}; what syntax creating function pointer array without using typedef ? arr //arr arr [] //is array (so index it) * arr [] //of pointers (so dereference them) (* arr [])() //to functions taking nothing (so call them ()) void (* arr [])() //returning void so answer is void (* arr [])() = {}; but naturally, bad practice, use typedefs :) extra: wonder how declare array of 3 pointers functions taking int , returning pointer array of 4 pointers functions taking double , returning char? (how cool that, huh? :)) arr //arr arr [3] //is array of 3 (index it) * arr [3] //pointers (* arr [3])(int) //to functions taking int (call it) , *(* arr [3])(int) //returning pointer (dereference it) (*(* arr [3])(int))[4] //to array of 4 *(*(* arr [3])(int))[4] //pointers (*(*(* arr [3])(int))[4])(double) //to functions taking double , char (*(

asp.net - Do I need a ViewModel to take 1-to-many-data to the view? -

this basic stuff, can't find clear answer anywhere.. lets i'm doing mvc (3) application entity framework (ef4), , have these 3 classes: public class foo { public int fooid public bar bar public icollection<baz> bazes } public class bar { public int barid public string bartext } public class baz { public int bazid public foo foo } what best way of taking foo's related bar's baz's can loop through foo's , making use of related items? need make viewmodel, , should contain? what want end like @model = ienumerable<foo/fooviewmodel> foreach(var foo in model) { @if(foo.bar.barid == 1) { foreach(var baz in foo) { @baz.bazid } } } you don't need view models. pass ef objects directly view, , in simple crud cases fine. in experience though never simple crud. i typically need data many places not contained in 1 object. example, might want show/hide data depending on person'

asp.net - Architect a .net web application to Kick start independent process -

can form idea on how architect web application kick start independent process in server can perform data uploading function flat file oracle table. independent process should keep running until finishes job regardless of web application's sign out or timeout issues. client .aspx page uploads data file server , triggers independent process in server. want implement in asp.net, vb.net, vs 2003. what best way this? thank you! have considered writing service monitors file drop location aspx uploads file to? in aspx add logic interrogate file make sure valid. once interrogation has passed drop file predetermined location. the service, have create, monitors file drop location new files , processes them come in. being service don't have worry timeouts asp.net related issues.

json - Spring3 REST Web Services with Jackson JSONViews -

i got plain spring3 web project set , have controller method this: @requestmapping(method = requestmethod.get, value = "/book/{id}", headers = "accept=application/json,application/xml") public @responsebody book getbook(@pathvariable final string id) { logger.warn("id=" + id); return new book("12345", new date(), "sven haiges"); } it returns new book object transformed json or xml because of transformers setup in spring config: <bean class="org.springframework.web.servlet.mvc.annotation.annotationmethodhandleradapter"> <property name="messageconverters"> <list> <ref bean="jsonconverter" /> <ref bean="marshallingconverter" /> </list> </property> </bean> json generation (and xml) works, able define multiple views data. example i'd specify detailed view less properties in exposed js

ruby on rails - MySQL Gem failure: MysqlCompat::MysqlRes on Snow Leopard -

i trying mysql gem work ... , doesn't want to. every time rake db:migrate, get uninitialized constant mysqlcompat::mysqlres i've installed mysql disk image: mysql-5.5.9-osx10.6-x86_64.dmg i've run gem install infamous archflags setting: sudo env archflags="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config and ruby version i'm using default snow leopard: [~/sites/testdb]$ file `which mysql` /usr/local/mysql/bin/mysql: mach-o 64-bit executable x86_64 [~/sites/testdb]$ file `which ruby` /usr/bin/ruby: mach-o universal binary 3 architectures /usr/bin/ruby (for architecture x86_64): mach-o 64-bit executable x86_64 /usr/bin/ruby (for architecture i386): mach-o executable i386 /usr/bin/ruby (for architecture ppc7400): mach-o executable ppc my database.yml pretty simple: development: adapter: mysql host: 127.0.0.1 database: testdb username: root password: any appreciated.

c - How can structures be used to represent complex numbers -

i need write program uses structures define complex numbers ie z1 = x + yi. , adds 2 complex numbers. need figure out how initalise them before moving on code. i've tried few things far, best have come , it's still not compiling. here's copy of code, need fix part , able rest myself. #include<stdio.h> typedef struct complex1{ float *real1; float *imaginary1; } complex1; typedef struct complex2{ float *real2; float *imaginary2; } complex2; int main(){ struct complex1 real; struct complex1 *realptr; struct complex1 imaginary; struct complex1 *imaginaryptr; struct complex2 real; struct complex2 *realptr; struct complex2 imaginary; struct complex2 *imaginaryptr; printf("please enter variable x1."); scanf("%d", &real.real1); printf("please enter variable y1."); scanf("%d", &imaginary.imaginary1); printf("please enter variable x2."); scanf("%d", &

Compiling PAR for Perl under Windows -

i've downloaded par http://par.perl.org/wiki/main_page , compiled after reading readme file. i've used dmake-4.12-20090907 instead of nmake ('cause 1.5 not work) http://search.cpan.org/dist/dmake/ . no problems during installing proccess (repeating install proccess doesn't farther, no warnings, less text output), there no pp.exe or similar. i'm using windows xp, compilations done on c drive. perl -v "this perl 5, version 12, subversion 2 (v5.12.2) built mswin32-x86-multi-thread" check binary 'pp' under location perl\site\bin

Salesforce integration all-or-nothing -

we have customer makes use of salesforce, want develop own site perform multitude of functions of require integration salesforce data , functionality. in discussions salesforce vendor , our customer, salesforce vendor pushed customer in salesforce itself, in portal solution entire website run through salesforce, or switch basic html pages on own server salesforce pages (skinned customer's site). surely recommendation not in best interests of customer? doesn't restrict , limit salesforce technologies , costs? long term, if company decided in future expand , build web based functionality totally separate salesforce happen? let me know think , possibly give me link or 2 motivate you're saying. i'm hoping system/application architects ones answer, not salesforce vendors. thanks, jacques they may have been talking salesforce sites. allow build lot of custom functionality, , leverage power of salesforce platform. said, lock in somewhat. limit can do.

find the "overlap" between 2 python lists -

given 2 lists: a = [3,4,5,5,5,6] b = [1,3,4,4,5,5,6,7] i want find "overlap": c = [3,4,5,5,6] i'd if extract "remainder" part of , b that's not in c. a_remainder = [5,] b_remainder = [1,4,7,] note: has 3 5's in , b has two. b has 2 4's in , has one. the resultant list c should have 2 5's (limited list b) , 1 4 (limited list a). this gives me want, can't think there's better way. import copy = [3,4,5,5,5,6] b = [1,3,4,4,5,5,6,7] c = [] elem in copy.deepcopy(a): if elem in b: a.pop(a.index(elem)) c.append(b.pop(b.index(elem))) # , b both contain "remainders" , c contains "overlap" on note, more accurate name i'm asking "overlap" , "remainder"? collection.counter available in python 2.7 can used implement multisets want. a = [3,4,5,5,5,6] b = [1,3,4,4,5,5,6,7] a_multiset = collections.counter(a) b_multiset = collections.counter(b) overlap

php - if ($node->type == 'x') not working in theme_upload_attachments function -

i want header uploaded files display different text depending on node type. overrided core function copying theme's template.php file , renamed phptemplate_upload_attachments. <?php function phptemplate_upload_attachments($files) { global $node; $header = array(t('default text'), t('size')); if ($node->type == 'orange') { $header = array(t('orange custom text'), t('size')); } $rows = array(); foreach($files $file) { $file = (object)$file; if ($file->list && empty($file->remove)) { $href = file_create_url($file->filepath); $text = $file->description ? $file->description : $file->filename; $rows[] = array(l($text, $href), format_size($file->filesize)); } } if (count($rows)) { return theme('table', $header, $rows, array(&

x11 - Automation using xdotool and Xvfb -

i'm trying automate getting cpu sampler data visualvm on production system. need way automate tasks inside xvfb. i found xdotool such automation. right have following script: xvfb $display -pixdepths 32 -screen 0 1280x1024x24 >/dev/null 2>&1 & xpid=$! echo "before twm" #twm -display $display & gnome-wm & #$visualvm --openpid $pid_to_open & echo "before gimp" gimp & sleep 5 xdotool search "gnu.*" windowactivate windowfocus key alt+f n sleep 3 display=:0.0 xwd -display :9.0 -root | xwdtopnm | pnmtopng > out.png qiv out.png it should open xvfb, run gimp, , click file->new. when in normal x, when execute script in xvfb looks doesn't pass keyboard events. tested mouse , it's same, xdotool doesn't pass (or xvfb doesn't accept) events mouse. has encoundered problem , know solution?

multithreading - Are Semaphore P and V operations atomic? -

are p() , v() operations can performed on semaphore guarantee atomic? can semaphore prevent 2 processes getting p()? suppose have binary semaphore, s, has value 1, , 2 processes simultaneously attempt execute p on s. 1 of these operations able complete before next v operation on s; other process attempting perform p operation suspended. taken university notes: we can think if p , v controlling access resource: when process wants use resource, performs p operation: if succeeds, decrements amount of resource available , process continues; if resource in use, process has wait. when process finished resource, performs v operation: if there processes waiting on resource, 1 of these woken up; if there no waiting processes, semaphore incremented indicating there more of resource free. note definition of v doesn’t specify process woken if more 1 process has been suspended on same semaphore. semaphores can solve both m

jquery - Javascript AJAX login popup -

does have nice examples of ajax (modal window) login form popups? on note, can't quite figure out how replicate sign in 1 here: http://www.photoshop.com/tools . can't find js, etc. if don't know find examples per above, list of files required sign in example, make work on site, appreciated! thanks! you can use fancybox it's easy use.

css - jQuery chaining -

i don't think i'm correctly understanding jquery chaining. i'm looping through array , trying add div elements wrapper css class each div element having class of 'click' , custom css top , left attributes, this: $('<div></div>').appendto('.wrapper').addclass('click').css('top',click.y).css('left'.click.x); but fails work expected - adds 1 div element, sets .wrapper div's class 'click' , stops. if remove .css('top',click.y).css('left'.click.x); it works expected - adding new div elements wrapper div. how can work properly? thanks use json object .css . .css({ 'left' : click.x, 'top' : click.y });

Import MySQL MyISAM into SQL Server -

caveat: have 0 experience mysql. i've been given series of files data conversion , migrate provided data sql server 2008. files are: *.myd *.myi *.frm these file types, understand it, myisam. believe if had running mysql instance, migrating sql server straightforward. could either use sql server's import wizard or microsoft sql server migration assistant mysql v1.0 . unfortunately, these files i'm stuck -- don't have access original mysql instance. i don't presently have mysql running instance locally , i'm not sure if there compatibility issues files have. can attach them mysql 5.5 goal of performing sqldump or perhaps use either tool mentioned above? missing better way? yes, can attach them mysql 5.5. can dump tables using mysqldump (be aware need either modify dump , remove mysql-specific stuff dump, or customize mysqldump output - check mysqldump documentation details). can try link mysql instance sql server, , copy tables usi

grails - Amazon ElasticBeanstalk vs Cloudfoundry vs other Cloud hosting services -

i looking @ options host grails webapp. being new website don't expect lot of traffic begin have option able expand without jumping through hoops without breaking bank. i have been pondering on cloudfoundry , amazon elasticbeanstalk. can point out pros , cons of these services , point me other services might out there. there stax.net. costs little more cloudfoundry (it adds fees on aws cost) advantage can host more sites on single vpn. (you can make slices of down 256 mb). , hosting development , testing free. recently has been acquired , integrated cloudbees. don't know how cloudbees is, described stax.net on previous experience. i don't have experience in long run bet go amazon elasticbeanstalk. amazon moving fast ahead!

html - How should CDATA block parsing in XML behave? -

given xml snippet: <title><![cdata[resizing & cropping gif , png images issue]]></title> what correct string should parsed xml parser <title> element content? 1. "resizing & cropping gif , png images issue" 2. "resizing &amp; cropping gif , png images issue" note: i'm using rome feed parsing library java, parses #2, understanding of cdata blocks should #1. i've found evidence on web suggests #2 both right (also here ) , wrong - i'm bit perplexed (and curious) this. well can tell there big difference 2nd link think it's "wrong". using titles , not links/urls. use 2nd 1 valid xml. understand cdata ignore it, i'm not sure why want ignore title. what planning on using for? seems me want not cdata everything, beauty in valid xml know should display consistent xml parsers.

sql - mysql: select the last 10 messages and for each message the last 3 replies -

for simplicity lets strip down messages table minimum, sample data message_id reply_to createdate 1 0 123 2 0 124 3 0 123 4 1 154 5 1 165 the reply_to message_id wich message reply to so im looking sql-statement/procedure/function/other table design lets me select last 10 messages , each of last 3 replies, dont mind changing table structure or keeping sort of record last 3 replies just selecting last 10 messages is select * message order createdate limit 10; and each of messages replies are select * message reply_to = :message_id: order createdate limit 3; my attempts far are: a triple outer join on message table replies a plain join mysql doesnt allow limits in joins useing having count(distinct reply_to) <= 3, ofcourse having evaluated last i couldnt either of working my last option atm have separate table track last 3 replies per message message_

Why won't Apache 2.1.7 in WAMP log PHP errors to the PHP error log? -

Image
i have wamp installed , decided use default apache 2.1.7 in latest version of wamp; reason host server site uses 2.1.7. previously, using apache 2.2.11 in wamp, because last host used version. the problem have seem have debugger on or when php error it's shown in image below , error not logged php error log though it's enabled, etc. in php.ini . when switch earlier apache version, errors logged in php error log. so must apache. want php log errors php error log used do. why happening , how can change it? i don't mind way error displayed helps anyway, because can see better, still log php error log well. here's php error looks since switching apache version in wamp; here's image: i managed sort it. re-enable php error logging again following: left click on wamp icon in task bar then move mouse on php > then go down , click on php.ini now for: ;error_log = "c:/wamp/logs/php_error.log" (note location may different on co

symfony1 - symfony 1.4 display images as choices in choice widget -

i have form choice widget (doctrinechoice). choices refer image file in server, , use expander=true option (for checkboxes/radiobuttons) is there way display widget displaying images of each option? default, id of options in database. using firebug, noticed generated html has tag id of each choice, , also, managed change image, i'm guessing need change text label of each choice. though, 'label' option of widget changes label whole select, won't do... thanks! ok, after lot of research, have managed kind of solution, maybe there's more correct? instead of using sfwidgetformdoctrinechoice, used sfwidgetformselectradio (but checkbox can too, don't know if can work other widgets, or select widgets :/ because business rules require it, selectradio sufficient in particular case...) the choices option of widget filled results of previous query using fill previous doctrinechoice widget, processed id of each record key , value of each choice: $im

php - WordPress sidebar: appear only on certain pages -

how can edit php wordpress sidebar appear on select pages (i.e. not on home , pages)? i'd prefer php on css if possible. you can use function is_page() in template , rendering sidebar if need to. small example, in sidebar.php of twentyten theme of wordpress <div id="secondary" class="widget-area" role="complementary"> <ul class="xoxo"> <?php if (is_page('my-page')) { dynamic_sidebar( 'secondary-widget-area' ); } ?> </ul> </div><!-- #secondary .widget-area --> this little snippet outputs sidebar if in page has slug 'my-page'. hope helps!

java - Getting GAE Entity by Key -

i've been trying entity gae datastore key, of type key. here's code i'm using retrieve key: strid = myvideo.getkey().tostring(); the type of myvideo entity. value myvideo.getkey().tostring() method returns "video(121)". here's code tries retrieve entity via entity's key: entity video = ds.get(key); the following exception gets thrown when trying retrieve entity datastore: no entity found matching key: video("video(121)") is there way encoded key object of type entity? the various ways convert between keys , strings documented in app engine docs here . in short, string version of key, want this: string employeekeystr = keyfactory.keytostring(employeekey); to convert key can fetch ds.get() , should this: key employeekey = keyfactory.stringtokey(employeekeystr); the string version you're fetching .tostring() human readable version of key, not intended passed around machine-readable identifier. of course

vb.net - How to manage multiple tables with the same structure (redux) -

i found question, similar problem solve: how manage multiple tables same structure however, due craptastical nature of vb, solution doesn't work. doesn't work because vb.net requires implementation of each method/property in interface explicitly declared. as problem i'm trying solve, here is: i have many lookup/domain tables in database have same structure the items in these tables typically used drop downs in interface i avoid bunch of boilerplate repository methods retrieve contents of these tables (one method per table sucks when have 40 tables) i not using 1 true lookup table anti-pattern , not option does have solution work work in vb? generic repository should work in case. there many available online or can write simpler 1 lookup tables.

vb.net - using Search Server 2010 Express web service results are returning .aspx pages instead of documents -

i have search web reference (from search server 2010 express install) in vb.net application utilizing queryservice class search production sharepoint foundation 2010 site. at previous point in time, had created proof of concept on entirely test system has since been turfed. recollection on test system when documents uploaded specific site content type (that inherits document) , metadata provided, search specific metadata making managed properties each, , search results returned documents (with isdocument flag set true). viewing document became simple, use filename , path display stored file. now developing production system , have encountered new behavior, these results returned aspx results such as http://digitizaton/company/client documents/forms/dispform.aspx?id=1703 this of course makes terribly difficult locate , view document, can extract title give name of file no extension, hardly helps, fileextension data aspx, not documents file extension, don't have full fi

security - X.509 certificate cannot be found by WCF service -

i have wcf service hosted in iis. using certmgr.msc can see x.509 certificate in personal -> certificates still error: cannot find x.509 certificate using following search criteria: storename 'my', storelocation 'currentuser', findtype 'findbythumbprint', findvalue 'b0 5f 3f ...'. i changed storelocation, find type... still same error appears. guess iis cannot use certificate because of lack of permission. how can fix ? right click on cert, select manage private keys, grant rights user under iis app pool running.

the best way to have separate stylesheets for different actions in Rails -

i have 1 app layout includes app wide css stylesheets , js files, controller's actions need additional stylesheets used these action s view? best way include them? if app typically like: <html> <head> <%= stylesheet_link_tag 'application' -%> <%= javascript_include_tag 'yui', 'application' -%> </head> <body> <%= yield -%> </body> </html> you can add other yield blocks wherever like, named whatever want. typically used include page-specific functionality wherever like, degree maybe partials supply own. # layouts/application.html.erb <html> <head> <%= stylesheet_link_tag 'application' -%> <%= javascript_include_tag 'yui', 'application' -%> <%= yield :head -%> </head> <body> <%= yield -%> </body> </html> # views/profiles/show.html.erb <%= title("#{@user.n

c# - Service to ASP.NET Communication -

a little background... have .net webpage communicates 1 way service. (using oncustomcommand()) when user presses button, function called. , dandy, when function done executing need able send message, function call, or communication .net webpage. is there way service call function, send message or update .net webpage? i've looked around , seen .net -> service nothing seems go other way. edit: windows service, , asp page , windowsservice reside on same server. have service write output common area... such shared file, or database. refresh webpage , have query file response output. support more 1 user should have have session id used determine output saved. example, call command line parameter guid this: echo test > c:\some directory\session12345.txt and have aspx page query , refresh using http://example.com/getoutput.aspx?session=12345 from there use asp access file appended sessionid in url. you can extend concept work jquery , wcf needed.

Determine path to source code of current mode in Emacs 23 -

i'm trying out new python mode emacs 23, i'm not sure how tell if i'm using new mode (source code located @ ~/.elisp/python.el ) or bundled python.el mode. is there way find out current (or active) mode loaded from? c-h m not seem provide information, , don't know else look. c-h f python-mode ret tell file lives in, , can browse file following link. you can use m-x find-function ret python-mode ret go there directly. (i find handy have find-function bound c-h c-f ) in general, use following: m-: (find-function major-mode) ret

android - The application has stopped unexpectedly: How to Debug? -

please note, unlike many other questions having subject title "application has stopped unexpectedly", not asking troubleshooting particular problem. rather, asking outline of best strategy android/eclipse/java rookie tackle formidable task of digesting huge amounts of information in order develop (and debug!) simple android application. in case, took sample skeleton app sdk, modified slightly , did moment try run it? the application (process.com.example.android.skeletonapp) has stopped unexpectedly. please try again. ok, know have logcat. it's full of timestamped lines staring @ me... do now? need for? is there way single-step program, find statement makes app crash? (i thought java programs never crash, apparently mistaken) how place breakpoint? can recommend android debug tutorial online, other this one ? i'm eclipse/android beginner well, simple debugging process can help... you set breakpoints in eclipse right-clicking nex

operating system - Perl to set a directory to open, open it, then print the directory opened? -

trying troubleshoot port of perl code centos windows. really know nothing perl, , code i'm porting around 700-1000 lines. 100% sure 1 of issues i'm seeing related how code being rendered result of being on os it's running on. so, i'm looking way troubleshoot debugging how os's rendering filepath apart legacy code; can not post due "ip" reasons. so, looking perl can set directory open within script (for example, c:\data\ or /home/data), script attempts load directory, prints if failed or succeeded, , prints string attempted load, regardless if code failed open directory or not. open suggestions, that's issue, , solution i'm seeing. questions, feedback, requests - comment, thanks!! use io::dir; $dir = io::dir->new($dir_path) or die "could not open directory $dir_path: $!\n"; of course, $dir_path path directory on system want, either var or hard coded. more 'old school' way like: opendir $dir, $dir

Javascript browser shake on Firefox -

is possible use javascript shake firefox browser? find script works on safari script doesn't seem work on firefox. http://www.jhuskisson.com/javascript/earthquake-effect-shake-the-browser thanks, tee because use noscript , code not execute unless allowed on browser. warned, if shake browser window, blacklist site , send flying monkeys devour soul. here implementation works...use caution: <html> <head> <script language="javascript"> function shakescreen(n) { if (parent.moveby) { (i = 10; > 0; i--) { (j = n; j > 0; j--) { parent.moveby(0, i); parent.moveby(i, 0); parent.moveby(0, -i); parent.moveby(-i, 0); } }

c# - Reference to a Silverlight Class Library -

i'm building service-client application using silverlight , wcf, have model project (which contains pocos) on server side, , wanted share same entities silverlight-client application, , thought, hey! can change model project silverlight class library, , should work fine. i did change , now, i'm able add references getting exclamation mark when reference not resolved... , if take @ properties value of "resolved" set "false", causing following code analysis errors: ca0058 [ca0001][2] please note: not typical question referencing typical class library silverlight project (i know can't done), other way arround. it should work fine (unlike wayne says, can reference silverlight assemblies projects target full .net framework). however, may have references in project full .net framework can't load (you need keep references base types). you've got 2 alternative options. create 2 class library projects (one targeting silverlight,

javascript - Escaping HTML in Ruby & adding to DOM with JS -

i'm trying dynamically add contents of div using js. end ruby on rails. having problem. here's included in view file: var product_sidebar_inner = "<%= cgi.escapehtml(render(...some partial...)).gsub(/\r/," ").gsub(/\n/," ") %>"; document.getelementbyid("left_sidebar_wrapper").innerhtml = unescape(product_sidebar_inner); the above inserts html text div#left_sidebar_wrapper. spent time on still can't make work. idea am doing wrong? based on comment macarthy, think want cgi.escape (or cgi.unescape ), that's use url encoding. can use uri.escape (or uri.unescape ) you'll tired of having pass unsafe regex time want. also, on javascript side, should using encodeuri or encodeuricomponent escape deprecated because has problems non-ascii characters.

ezpublish - How to use Custom PHP Functions in eZ Publish Templates? -

hi wondering if use php functions in ez publish templating. if 1 knows how use it. hint greatful. eg:- want use str_replace() php function in ez-publish template. firstly have make extension use php function in ez publish. steps making extension in ezpublish given in link below: http://blog.developeronhire.com/using-custom-php-functions-in-ez-publish-templates/ hope solve porblem.

c++ - How do I setup visual studio to register some #defines globally? -

what mean is, in each of source files have insert #define nogdi stop windows.h including gdi defines (since it's bitmap define conflicts mine). e.g. #define nogdi #include <windows.h> unfortunately, have in every seperate source file includes windows.h, not want do. using visual studio 2005, there way can set #define globally? (i.e. in of source files). project settings -> c/c++ -> preprocessor -> preprocessor definitions here can define symbols applied globally source code in project.

iphone - "Push notification" - feedback, uninstall application -

apple push notification - feedback service how know when user uninstalls application? can remove devicetoken push server. you don't know. can grab device identification string presumably identical same application token string, , track if token has changed specific device. can update device token new one, there no way find out if app removed device. update : correct. can information feedback service, there caveat. need have @ least 1 push-messaging enabled application installed maintain persistent feedback connection. i'd mark these customers potentially non-existant, wouldn't remove these folks customer db. knows why push message can rejected. device may in inconsistent state , remove subscriber forever. if have 10k zombie clients pocket change db. if lost 100k clients have serious problems that.

javascript - JS /JQuery Form Submit Delay? -

i've implemented 'locksubmit' plugin http://blog.leenix.co.uk/2009/09/jquery-plugin-locksubmit-stop-submit.html changes display state of button disabled. want form delayed few seconds before posting form url. what have add in or modify delay form "post" once user has clicked submit button? thanks! cancel default form submit behaviour, , start timeout @ same time: $('form').submit(function (e) { var form = this; e.preventdefault(); settimeout(function () { form.submit(); }, 1000); // in milliseconds }); this should compatible locksubmit plugin. see demo here: http://jsfiddle.net/7gjx6/

Python: Creating a table, what does "none" mean? -

trying build basic multiplication table, , keep getting these "none"s. mean , how can rid of them? >>> def m(n): ... = 1 ... while <= 6: ... print i*n, '\t', ... = +1 ... print >>> def printt(): ... w = 1 ... while w <= 6: ... print m(w) ... w = w + 1 ... >>> printt() 1 2 3 4 5 6 none 2 4 6 8 10 12 none 3 6 9 12 15 18 none 4 8 12 16 20 24 none 5 10 15 20 25 30 none 6 12 18 24 30 36 none replace print m(w) m(w) . printing return value of m(w) none since not returning function.

java me - How do i specify midlet before packaging j2me application? -

i able package application in eclipse.... when install application on mobile phone... says midlet not specified ... how set starting midlet in settings before packaging... there .jad file in project. open , specify midlet class.

logging - How do you save an Android application log to a file on a physical device? -

i want know why android application service goes down (whether it's os killing or crasch) , therefore want save log file on phone. how can done? basically got 2 possibilities , first 1 should finding reason crash without coding since logcat should show error occurred led service end. 1) using logcat command having log.i("your tag", "output text") can intercept messages using android eclipse plugin or calling adb logcat command line, having android device connected , service running. see http://developer.android.com/guide/developing/tools/adb.html#logat 2) writing stdout using system.out.println("...") command can configure device write stdout file: adb shell stop adb shell setprop log.redirect-stdio true adb shell start see http://developer.android.com/guide/developing/tools/adb.html#stdout obviously have spread lot of debug output messages on application, @ critical points. good luck finding error!

c++ - Problem Building Festival(Text to Speech) On Ubuntu -

i set ubuntu vm today build festival on ubuntu (i never ran before) did following setups on terminal window wrote following install gnu c++ compiler sudo apt-get install build-essential to test g++ wrote sample hello world , compiled using g++ , run , worked expected. i downloaded files listed on festival download page unpacked home directory(~) using tar -zxvf *.tar.gz then wrote following 3 commands configure , make speech_tools cd speech_tools ./configure make but make returns following errors /lib -leststring -lcurses -ldl -lncurses -lm -lstdc++ -lgcc /usr/bin/ld: cannot find -lcurses /usr/bin/ld: cannot find -lncurses collect2: ld returned 1 exit status make[1]: *** [ch_lab] error 1 make: *** [main] error 2 can tell me missing, being newbie ubuntu or other unix platform may missed important configuration, before have built festival on windows machine using cygwin. please me kind of urgent. thanks lot mubashar you need install devel

sql server - Problem with SQL transaction isolation level -

i have problem transaction isolation levels. there 2 tables involved, first 1 updated transaction isolation level set serializable , second 1 has foreign key on first one. problem occurs when doing insert or update of second table. once in few hours error message: snapshot isolation transaction aborted due update conflict. cannot use snapshot isolation access table 'dbo.first' directly or indirectly in database 'db' update, delete, or insert row has been modified or deleted transaction. retry transaction or change isolation level update/delete statement. i don't set transaction isolation level when inserting or updating second table, ran command dbcc useroptions , returns read_committed i need eliminate error asap, ahead first: seems, you're not using serializable , snapshot isolation introduced mssql 2005. here article understand difference: http://blogs.msdn.com/b/craigfr/archive/2007/05/16/serializable-vs-snapshot-isolation-le

vb.net - How do I start animating applications in winforms? -

i references or examples on how animate winform applications. when click on button should transform group of objects small or big, move it's position, change color, etc. accept library answer. i have used dot-net-transitions , have no issues far. contains 8 type of animations , allows animate controls them. transitiontype_linear linear animation objects moving @ constant rate throughout transition. transitiontype_acceleration starts transition @ 0 velocity , builds @ constant rate of acceleration @ full-speed end of transition. transitiontype_deceleration starts transition @ full-speed , decelerates @ constant rate @ 0 velocity end of transition. transitiontype_criticaldamping declerating transition, using exponentially decaying velocity. (for example) animating properties such needles on dials. transitiontype_easeineaseout starts @ 0 velocity , accelerates until halfway through transition, decelerates 0 velocity

zend framework - PHPUnit + Doctrine + Versionable + ZF bug -

hi everyone , i've setup versionable behavior 'address' table, when i'm trying run phpunit tests i've got following error: sqlstate[hy000]: general error: 1205 lock wait timeout exceeded; try restarting transaction i have 2 'test*' methods on testcase. if leave 1 works, if > 1 - gets error. here code: class usertest extends dbtestcase { protected $object; protected function setup() { // zf bootstrap here , doctrine connect parent::setup(); // clean/create tmp tables $this->_preparedb(); $this->object = new user; } public function testgetfullusername() { $model = new user; $model->email = $email . time(); ... $model->supplier->address->firstname = $first_name; $model->supplier->address->lastname = $last_name; ... $model->userright[0]->role = 'supplier'; $model->userright[0]->resource = '*'; $model->userr

javascript - g.raphael js(graphaeljs), line, hoverColumn problem -

Image
i using graphael js lib draw line chart. , have problem havercolumn function. simplified hovercolumn function. var line = raphael.g.linechart(50, 20, 650, 120, xary, yary, options).hovercolumn(function (){ ... console.log(this.x+","+this.y); .... } when mouse hovering on chart, hovercolumn function called, , log function executed. but, area doesn't call hovercolumn function. so, did debugging using firebug, found reason. there big rect area on line chart, when mouse on area, hovercolumn doesn't call despite mouse on chart's column. here captured image understanding. fire bug, , rect. when remove rect manually using firebug, hovercolumn function works well~ -_-; the area code made graphael-js automatically. so, there way solve problem? idea please~ i found solution @ last(takes 1 day hacking...=_=;). problem in g.line.js, graphael js library. in source code, there createcolumns function this, function createcolumns

asp.net - RadAsyncUpload in code behind, how to? -

my problem is, nothing happens, code behind doesn't fire...maybe point me in right direction. possible or totaly wrong here? default.aspx: <telerik:radprogressmanager runat="server" id="radprogressmanager1" /> <telerik:radasyncupload runat="server" id="asyncupload1" /> <telerik:radprogressarea runat="server" id="radprogressarea1" /> default.aspx.cs: protected void asyncupload1_fileuploaded(object sender, fileuploadedeventargs e) { const string relativepath = "~/uploads/"; var filename = e.file.filename; var parentid = convert.toint32(gridview1.selectedvalue); var filesize = convert.toint32(e.file.contentlength); var physicalsavepath = mappath(relativepath) + filename; //store file info in database var app_filesadapter = new app_filestableadapter(); app_filesadapter.insert(filename, relativep

android - How to convert an image from URL to Drawable -

i'm having problem converting image drawable object. i'm converting image using: public drawable loadimagefromweboperations(string url) { try { inputstream = (inputstream)new url(url).getcontent(); drawable d = drawable.createfromstream(is, "src name"); return d; } catch (exception e) { system.out.println("exc=" + e); return null; } } i'm trying put drawable in hashmap , insert listadapter , value of drawable android.graphics.drawable.bitmapdrawable@405359b0 instead of integer , message in logcat resolveuri failed on bad bitmap uri". this how put drawable in hashmap : map.put("cover", string.valueof( main.this.loadimagefromweboperations("http://www.asdfasfs.com/dasfas.jpg"))); why expect drawable integer? object can assign imageview . there items in project can refer id, true, else. r.drawable.icon not drawable , in same sense r.view.yo

c# - Is it possible to have multiple services or applications share one single config file -

if have multiple applications or services share 1 configuration value (e.g. access same database), there way have them share 1 single config file instead of having duplicate values throughout each of configs? you can use configsource attribute point specific file. use same file location multiple .config files. you can multiple config sections, 1 file connection strings, 1 app settings etc...

php - How to extract particular fields from an array -

i have array looks $articles = array([0] => array('title' => 'when ....', 'description' => '....', 'created' => '2011-02-21' ), [1] => array('title' => 'something ....', 'description' => 'when ....', 'created' => '2011-02-21' ), ); i want extract titles. there anyway retrieve titles without using , foreach loops. dont mind title becomes single string. thinking implode array adds description , created. you can use example array_map , why not want use loops? in fact every method, able modify array in way want it, iterate on it. function reduce_to_title ($item) { return $item['title']; }; $titles = array_map('reduce_to_title&