Posts

Showing posts from March, 2011

osx - Uninstall python 3.2 on mac os x 10.6.7 -

according documentation python.org, python 3.2 install on mac os requires upgrade tcl/tk 8.5.9 (for use of idle). in haste, have done both. friend told me python 3 not recommended yet because built-ins , few modules have been released 3. stable 1 far 2.7 (especially if 1 wants make extensive use of variety of modules). machine has both 2.6.1 , 3.2 (because os services make use of 2.6.1 comes default os). 1. how remove 3.2 avoid compatibility issues? tcl/tk 8.5.9 installed , not default. there no verbose mode during installation, don't know whether replaced default one. if did how bad can os? , hence 2. if above bad, how downgrade old version of tcl/tk? in short, how bring machine original state? if knows paths directories , files can manually. thanks since python installs using package manager, can use suspicious package @ install script , installed. be aware demonstration purposes only. environment osx 10.6.8 , uninstalling python-3.2.2-macosx10.6.dmg. ...

java - Weird mysql beahviours with timezones? How to control them? -

i wrote webapp using spring+hibernate. developed on windows , moved linux virtual server (aruba, italian provider). noticed annoying thing: when dates saved on windows time same of "wall clock", if read 13:45 have same hour in mysql row. doesn't happen on linux anyway. in fact linux machine on cest (my timezone), got typing "date" in shell. dates saved in db offset relative gmt. again, app displays in gmt (including gmt time zone if choose format dates display time zone) , mysql saves in format. how control this? i post solution myself, because think it's worth having in site. first of all: mysql doesn't store timezone information. running on gmt+4 , write couple of records contain date fields. move system in gmt-2 read records (perhaps importing data mysqldump). if system , vm have gmt-2 timezone dates read taken if written in gmt-2 , not adjusted. solution: take control of vm timezone using -duser.timezone="gmt" command li...

static - How to add text over the top of a google map so that the text does not move when panning -

i working on html5 application designed run google map takes entire screen on mobile phone. sake of simple debugging, , perhaps later legitimate informational purposes, position text in bottom right hand corner of map, reports information, such current lat/lng of user. have looked through v3 api, , best of knowledge there's nothing in there this. there kind of workaround permit done? pretty easy really. add div control. define empty div anywhere in html. add control, , maps sucks map display. write dom functions wish. <div id="debug"></div> -- code goes here -- var x = document.getelementbyid("debug"); mapname.controls[google.maps.controlposition.right_bottom].push(x); -- code goes here -- $("#debug").html("debugging info") hope enough idea across. in example put in right_bottom. other options here . skip

xslt - How to group at more than one level? -

i have xml file: <document> <line id="0"> <field id="2">x111</field> <field id="3">1</field> <field id="4">222222222222</field> </line> <line id="1"> <field id="2">x111</field> <field id="3">1</field> <field id="4">111111111111</field> </line> <line id="2"> <field id="2">x222</field> <field id="3">1</field> <field id="4">111111111111</field> </line> <line id="3"> <field id="2">x222</field> <field id="3">1></field> <field id="4">111111111111</field> </line> <line id="4"> ...

VBA, Outlook, Seeing 'People's Calendars -

i tring programmatically (with vba) access calendars others share me. listed in outlook under 'people's calendars.' have searched web , suggestions have done little more confuse me. how can listing of calendars shared me, , 1 calendar in specific, among 'people's calendars'? check out returned values following code. searches person name, same way when typing recipient new email, , grabs persons shared calendar , enumerates shared appointments. dim _namespace outlook.namespace dim _recipient outlook.recipient dim calendarfolder outlook.folder set _namespace = application.getnamespace("mapi") set _recipient = _namespace.createrecipient(name) _recipient.resolve if _recipient.resolved set calendarfolder = _namespace.getshareddefaultfolder(_recipient, olfoldercalendar) 'this display calendar on screen: 'calendarfolder.display dim oitems outlook.items set oitems = calendarfolder.items 'oitems set of appoi...

hibernate - Removing proxy part of grails domain object? -

i want @ actual instance of domain object. is, need serialize object, , i'm trying use domain object on 2 sides of httpinvoker chain. there way fully-loaded domain object doesn't have grails wiring, can serialize it? we grailshibernateutil.unwrapifproxy(obj) . won't rid of grails injected methods , such - of hibernate/gorm proxy, should sufficient. edit : sorry asking, did declare domain class implements serializable ? it might add/inject class, in grails non-bug 6379 . this piece of code (got here ) worked me in grails console on small domain class: . import org.codehaus.groovy.grails.orm.hibernate.cfg.grailshibernateutil import com.somegroup.domain.* def loc = somedomainclass.get(1) loc = grailshibernateutil.unwrapifproxy(loc) bytearrayoutputstream bos = new bytearrayoutputstream() objectoutput out = new objectoutputstream(bos) out.writeobject(loc) byte[] yourbytes = bos.tobytearray()

c# - How to force window to redraw? -

i have full-screen window, using code: windowstyle = system.windows.windowstyle.none; windowstate = system.windows.windowstate.maximized; topmost = true; it works ok under win7, under winxp window elements don't redrawn when window goes fullscreen. there way force window make full redraw , layout update? upd redrawn ok, if switch app atl-tab , mine you force window repaint using windows api. example class implementation: public static class windowsapi { private const int wmpaint = 0x000f; [dllimport("user32.dll")] public static extern int64 sendmessage(intptr hwnd, uint msg, intptr wparam, intptr lparam); public static void forcepaint(this form form) { sendmessage(form.handle, wmpaint, intptr.zero, intptr.zero); } } usage: form testform = new form(); testform.forcepaint();

how to write c/c++ extension for adobe air(or flex) -

is there official sdk c/cpp programmer write extension air or flex? this happen soon. adobe posted document today : http://www.adobe.com/content/dam/adobe/en/devnet/devices/pdfs/developingactionscriptextensionsforadobeair.pdf it's air tv yet said available air mobiles next

sql server - Have table-valued function in T-SQL return table with variable number of columns -

is possible have table-valued function in t-sql return table variable number of columns? column names may 1, 2, …, n . right have "string split" function returns single-columned 1 x n table, , pivot table afterwards n x 1 table, i'd rather streamline process returning correct table format begin with. i intend use clr procedure in c# function, don't know how set user-defined function return data in format want: variable number of columns, dependent on input string. it not possible return non-static result set table-valued function (tvf), whether written in t-sql or .net / sqlclr. stored procedures can dynamically create result set. basically, function needs return consistent result type, whether scalar value or collection (i.e. result set). however, in sqlclr stored procedure, can create dynamic result set via sqlmetadata . long don't have explicit need select ... from it, maybe stored procedure work. of course, might able away doing in ...

php - facebook iframe application redirect -

i have made iframe style facebook application uses php , javascript (jquery). when browser looking @ canvas page how redirect browser window url? thanks you need reference window 'top' window.top.location.href="your link here"; that ensure break out of iframes.

c# - fighting spam bots -

i have c# form in site , want prevent spam bots filling it. trick is, want avoid captha or other user input avoid loosing single registration. here techniques have in mind: hidden input field (question: still effective?) track time, since first user input (focus on firstname) till posting form.. humans take more 3 seconds complete form (even auto-fill), bots take second or less fill in registration , post it. (question: if start timer first user input, when should stop it?) put in form tag fake post url, or post form itself, , on submit button click action add real post url javascript. (question: wonder if new spam bots can cheat this?) i glad hear other techniques adopt, again, without using captcha, spam filters, form verifications , validation. thank you would have sort of flash asks reconnect dots (so interactive , doesnt require typing), , when user correctly, can post submit check. never liked captcha, wierd ones humans have problem intepreting :)

Can anyone with access to the new "Matlab Coder" product show some output of the translation to C? -

matlab coder released mathworks product. understanding is matlab-to-c compiler biggest advantage on previous solutions being resulting program not need linked against matlab shared library. can access product confirm above? dependencies of translated programs , kind of performance talking about? see example outputs, know if resulting c programs can understood , improved without access matlab source. if done right powerful, allowing rapid prototyping in matlab , instantaneous conversion c when things getting serious. kind of whish doesn't work python+numpy+scipy.weave still superior ^^. matlab coder can allocate memory using malloc, can generate c code matlab functions operate on dynamically sized data. can choose option of static allocation maximum size variables. re: using blas matrix multiplication – while generated c code doesn’t automatically include processor/platform specific optimizations, there feature called target function library, allows users write o...

SMTPRecipientsRefused in django -

when trying send mails through django getting above error . can please tell cause of error , how avoid it? the cause smtp server refusing of recipients you're sending email to. fix either not send email recipients, reconfigure smtp server accept them, or find different smtp server use.

swing - Deleting node childs of a Java JTree structure -

i have ftp program retrieve folder data each time expanded. using model this: private void filestreetreeexpanded(javax.swing.event.treeexpansionevent evt) { string path = new string(""); defaultmutabletreenode chosen = (defaultmutabletreenode) evt.getpath().getlastpathcomponent(); string[] patharray = evt.getpath().tostring().replaceall("]", "").split(","); (int = 1 ; < patharray.length ; i++) path += "/"+ patharray[i].trim(); // aded chosen.removeallchildren(); without success ftp.goto(path); arraylist listdir = null; listdir = ftp.listdir(); arraylist listfiles = null; listfiles = ftp.listfiles(); defaultmutabletreenode child = null , dir = null , x = null; //this add files tree (int = 0; < listfiles.size(); i++) { child = new defaultmutabletreenode(listfiles.get(i)); if(listfiles.size() > 0) model.insertnodeinto(child,...

ActionScript 3 - Add and remove child from stage -

i learning actionscript 3, probaly eazy question pro's. created movie clips want add stage (from library) use of buttons. have total of 6 buttons (and 6 moviclips) trying first 2 work before move on next buttons. problem can't seem remove movie clip when button clicked, or same button... said new @ , think created mess of things... getting error 2007 now import flash.events.mouseevent; import flash.display.movieclip; mix_btn.addeventlistener(mouseevent.click, addbear); function addbear(event:mouseevent):void { var movieclip:bear1 = new bear1(); addchild(movieclip); movieclip.x = 240; movieclip.y = 45; mix_btn.removeeventlistener(mouseevent.click, addbear); mix_btn.addeventlistener(mouseevent.click, removebear); } function removebear(event:mouseevent):void { var movieclip:bear1 = null; removechild(movieclip); mix_btn.removeeventlistener(mouseevent.click, removebear); /* mix_btn.addeventlistener(mouseevent.click, addbear);*/ } shake_btn.adde...

android - [File Export]No such file or directory -

i want export file sdcard, have log message: 04-11 18:34:22.383: debug/carburant(5734): /mnt/sdcard/carburant/alaa.peugeot.settings.dat (is directory) i want have alaa.peugeot.settings.dat not directory, file. here code: try{ final sharedpreferences preferences = preferencemanager .getdefaultsharedpreferences(context); string filename = context.getresources().getstring(r.string.filename); string filedir = "" + preferences.getstring("login", "") + "."+ preferences.getstring("marque", "") + "."; file dir = new file (sdcard.getabsolutepath() + "/carburant"); dir.mkdirs(); file file = new file(dir, filedir+filename); outputstream out = new fileoutputstream(file); file f1 = new file(context.getfilesdir(), filedir+filename); inputstream in = new fileinputstream(f1); what going on code? thank much....

c++ - Namespace Scope Question -

i have quick question namespace scope: i have 2 namespaces, , b, b nested inside a. i declare typedefs inside a. i declare class inside b ( inside ) to access typedefs (declared in a), inside b, need "using namespace a;" ie: b.hpp: using namespace a; namespace { namespace b { class myclass { typedeffed_int_from_a a; }; } } this seems redundant... correct? to access typedefs (declared in a), inside b, need "using namespace a;" no. however if there typedef or other symbol same name typedef, defined in namespace b , need write this: a::some_type a; lets simple experiment understand this. consider code: ( must read comments ) namespace { typedef int some_type; //some_type int namespace b { typedef char* some_type; //here some_type char* struct x { some_type m; //what type of m? char* or int? a::some_type n; //what type of n? char* or int? ...

.net - How should messages (not exceptions) be passed from the Model/Business Object layer to the UI? -

using vb.net 4.0 i have winforms application loosely based on mvvm. i'm looking easy way layer (even ui has no reference to) pass messages ui display user. i have accomplished in past creating "communicator" class in "common" assembly every other assembly reference. public class communicator public shared sub notifyuser(message string) raiseevent sendmessage(message) end sub public shared event sendmessage(messagetosend string) end class the ui subscribe sendmessage event @ program startup. class wanting pass message user call shared notifyuser method , communicator class relay given message ui through sendmessage event. the upside method is trivial implement , super easy use anywhere in code. i suppose downside calls notifyuser spread throughout code, making many classes dependent on communicator class , shared method. reason, feels wrong. so, question is, typical ways achieve same effect without significant increase in complexity? ...

html - Dynamic width in table column for webkit -

Image
i want create looking separator web app: here code: http://jsfiddle.net/sauvk/ it works fine firefox (v4) chrome (v10) shows middle column. when set width of left , right column manually works too, want them fill space left. ideas? the left , right cells collapsing. adding content give them width, adding padding in css: j sfiddle.net/sauvk/1/ edit: why not set colspan=3 ?

database - What are the settings that SQLite is complied with for PHP 5? -

sqlite 3.7 comes new write-ahead logging (wal) , there lots of settings can be configured . however, there doesn't seem way change php pdo sqlite lib . sqlite3.ini file included php extension has 1 configuration option. is there somewhere can see options php project complies sqlite with? there way build own sqlite extension php can configure these settings? using phpinfo() , should able see version of sqlite library php has been compiled against. instance, here's have on php 5.3.2 install (the default version of not too-recent ubuntu) :     http://extern.pascal-martin.fr/so/so-5625435-2.png and, pdo :     http://extern.pascal-martin.fr/so/so-5625435-1.png suppose have more recent recompiling php source -- and, probably, using more recent version of sqlite development library. for example, here's screenshot of relevant section of phpinfo() 's output php 5.3.99 build did week-end (on ubuntu 10.10) :     http://extern.pascal-m...

javascript - ASP.net MVC and checkboxes -

hi, i know possible use html.checkboxfor(c=>c.mybool) default binder bind correct value model object parameter in control action(strong typed view). if need add "rememberme" checkbox in form on masterpage, mean there no strong type use. say logon action takes object of following class public class logonmodel { [required] [displayname("user name")] public string username { get; set; } [required] [datatype(datatype.password)] [displayname("password")] public string password { get; set; } [displayname("remember me?")] public boolean rememberme { get; set; } } to default binder map username , password create inputs has correct names (username/password). not possible rememberme property. working hade ad hidden field name rmemberme , set input javascript : $(document).ready(function () { $('input[id*=chkbremember]').click(function (...

playframework - play framework inter-app communication -

since play supports using 1 database per application, what's best way 1 play application access data of another? there better methods fetching data in json format? i believe best method use rest call interact other application (if other application calling play one) or use ws library call webservices of target application if want call play. personally, dislike idea of writing stuff "common database/table" means both applications must aware of structure of table, , changes on 1 end imply changes on table , other side. means create specific channel between these 2 applications hard reuse if, in future, want more applications take part in it. i favor using rest (preferably) or soap this. decouple applications , make simpler (specially play). , if reason target app doesn't support rest/soap, simple wrapper application manage communication solve this.

ajax - Prototype plugin need for expanding and hiding divs and remembering state of choices for user -

while viewing or editing in rather complicated form, i'd love able have user close , open "sections" of page depending on using for. the trick i'd keep track of choices preferences, next time @ record of same sort, see same sections. what envisioning like: <div class='expandable'> <h2>some heading</h2> <div id='some-stuff-you-might-not-want-to-see' class='expandable-body'> ... </div> </div> when page loaded, you'd see section, if clicked on toggle button on div, you'd hide it, , if go record of same type, section remains hidden. i don't want roll own, , i'm okay if entirely client-side, using cookies determine sections hide. know of this? rails 2.3.5, ruby 1.8.7, using prototype. i think answered yourself. use cookie remember choice, use prototype hide div(s). don't think you'll find full fledged plug-in you.

cocoa - Singleton & Notification -

i have been developing cocoa apps while , have conceptual question regarding singleton "pattern" , use of nsnotificationcenter communication. suppose have class responsible storing credentials of user in app. lets call useraccountcontroller . such class exposes public methods perform login/logout operations , notify any interested object such operations performed (e.g.: in tab bar application, i'd update uiviiewcontrollers when user logged out). in opinion, wouldn't make sense have more 1 useraccountcontroller object in application, also, second useraccountcontroller object post notifications nsnotificationcenter , may cause troubles objects registered receive such notifications. given situation have 2 questions: what pattern use in classes useraccountcontroller . any class uses nsnotifications information flow in application should, necessarily, implement singleton "pattern"? by analyzing apple's classes have found question 2) makes...

html - How can I vertically center side-by-side anchor and anchor-image tags? -

Image
i having trouble centering these 2 elements. i'm not sure problem is. can me out. first here screenshot of going on: so how these elements vertically centered? here html , css: <div class="vcenter"> <p> <a href="http://www.google.com">jimdaniel</a> <a href="http://www.cnn.com"><img src="icon.png"/></a> </p> </div> .vcenter { padding:10px; background-color:darkblue; min-height: 25px; display: table-cell; vertical-align: middle; } thanks help! like this? http://jsbin.com/opifu5 .vcenter img { vertical-align: top }

linq to sql - Specify ConnectionString for MVC DataContext globally -

i have mvc3 application allows user choose database want use on initial login. various connection strings available in web.config every datacontext use chosen connection. i aware can supply parameter 1 instance of named datacontext this: mydatacontext db = new mydatacontext(connectionstring); or can override oncreated event instances of named datacontext public partial class mydatacontext { partial void oncreated() { connections connections = new connections(); this.connection.connectionstring = connections.getcurrentconnectionstring(); } } how instances of datacontexts throughout application?

regex - Extracting a subsection from a String in java -

i have 1 huge string form: markerbeg 1 ... ... markerend 1 markerbeg 2 ... markerend 2 i have information in string , want extract string between each markers(...), there way using regex or simple strings methods looking each marker. regards, [edited because question became clearer] here's problem understand it: have long string blocks of text in delimited "markerbeg [identifier]" , "markerend [identifier]". not text in string inside 1 of these blocks, , blocks cannot nested. identifiers can arbitrary string (here i'm assuming contain characters in \w class: letters, numbers, , underscores). need extract both identifiers , strings inside blocks. here's code want: import java.util.regex.*; public class hello { public static void main(string[] args) { string s = "markerbeg 1\n text\nmarkerend 1\nxxx\nmarkerbeg 2\nhi there :) \nmarkerend 2\nxyz\nmarkerbeg hello\nzgfds\nmarkerend hello"; syst...

java - Jboss 5 - log file per application? -

i want have custom configuration logs in web application uses jboss 5 application server. i've done following steaps. added log4j.xml custom config. ear/war/web-inf/classes folder custom code (most important section log4j.xml file): <appender name="file" class="org.jboss.logging.appender.dailyrollingfileappender"> <errorhandler class="org.jboss.logging.util.onlyonceerrorhandler"/> <param name="file" value="${jboss.server.log.dir}/serverss.log"/> <param name="append" value="true"/> <!-- in 5.0.x server log threshold set system property. in 5.1 , later instead using system property set priority on root logger (see <root/> below) <param name="threshold" value="${jboss.server.log.threshold}"/> --> 2.created jboss-classloading.xml file content: <classloading xmlns="urn:jboss:classloading:1.0" do...

android - set two titles? -

i can settitle("my title"), i'm looking set 2 titles... 1 on left side , 1 on right. how might that? i have 2 textviews, aligned parent left , right... textappearance changed. i'm hoping titlebar using code don't have use background simulate titlebar. you can define custom view layout , tell system use with: getwindow().setfeatureint(window.feature_custom_title, r.layout.text_title); you can make title view relativelayout 2 children positioned like. should done in oncreate() before calling setcontentview() . see this thread more discussion of using custom view.

Processing dynamic MP3 URL using Yahoo Media Player -

i using yahoo media player playing mp3 songs on website. i have put static mp3 links on site. e.g. song1 song2 and have put ymp js api code also. now, want load songs dynamically... for example if user clicks on button want load complete new play list player. //something var clickeventhandler = function(){ ymp.removeallsongs(); ymp.addsongs(mp3_links); ymp.play(); } please me .thanks. this may you, use this: <script> /** on yahoo media api ready **/ var yesready = false; yahoo.mediaplayer.onapiready.subscribe(function(){ yesready = true; }); function play(){ //capture url of song var url = document.getelementbyid('url').value; //put in href of song link document.getelementbyid('link').href = url; //after play song using ymp if(yesready){ yahoo.mediaplayer.addtracks(document.getelementbyid('song-div'), 0, true); yahoo.mediaplayer.play(); } } </script> <div id='song-div'> ...

visual studio 2005 - Updating a SQL table where items to change are identified in another table that is linked -

everywhere can find how update table data in table not looking that. have 2 tables table1 , table2. table1 has column pulldate , column jobnmbr. table2 has column jobnmbr , column project. 2 tables link @ jobnmbr column. need bulk update table1.pulldate per project number, project number stored in table2.project. using visualstudio 2005 , in vb code not c+, know code (if there any) links tables , allows me update table1.pulldate records grouped table2.project? providing trigger update using textbox [txtbox_pulldate] , nearby button [button_updatepulldate]. thanks bunch chuck vensel i think understand want update table1 given matching column in table2? write sql update select except replace select clause update clause. update table1 set [pulldate] = your_value table1 join table2 on table2.[jobnmbr] = table1.[jobnmbr] table2.[project] = your_project_id

Building android app -

hey guys, researching android app development, , cant find on building app in c or c++, question is, possible build android app using c or c++ ? you might consider 1 of other cross-platform services (e.g. mosync ), realize limited in sense give access more generic language features. advanced or new features, such nfc not yet supported. further, if planning on deploying app commercially, may have pay them royalty. can better amount of information @ site.

user interface - How can I make a GUI for my C# XNA game? -

my game has basic functionality , playable command line, put gui on top of it. it platformer type game written in c# xna framework. i have googled , found few libraries, seem gum , duct tape. there mature or standard way of making gui situation? i found http://www.3dbuzz.com did wonderful tutorial section xna, did breif hyperion game akin old infocom games great fun make, , lead me make networked muck based on of ideas involved. it goes on make various things, covering sound, gui, sprites , on. done humor , attention details.

java - JavaMail - Parsing email content, can't seem to get it to work! (Message.getContent()) -

for few weeks have been developing email client android, have been ignoring parsing email content while have never been able work. thus, time has come ask help! i have been looking around , have come across few methods have tried never had success with! closest attempt have be: private string parsecontent(message m) throws exception { //multipart mp = (multipart)c; //int j = mp.getcount(); /*for (int = 0; < mp.getcount(); i++) { part part = mp.getbodypart(i); system.out.println(((mimemessage)m).getcontent()); content = content + part.tostring(); //system.out.println((string)part.getcontent()); }*/ object content = m.getcontent(); string contentreturn = null; if (content instanceof string) { contentreturn = (string) content; } else if (content instanceof multipart) { multipart multipart = (multipart) content; bodypart part = multipart.getbodypart(0); pa...

Android ARM v7 emulator -

can please guide me on how start android arm v7 emulator eclipse. understand android eclipse based emulator arm v5. lot help. sorry! avd arm7 not supported yet! need use real device development. http://groups.google.com/group/android-ndk/browse_thread/thread/a19fc6df3d661d79?pli=1 if there pre-compiled arm7 avd image intel, please leave message here!

c++ - Unexpected behavior from unsigned_int64; -

unsigned__int64 difference; difference=(64*33554432); printf ("size %i64u \n", difference); difference=(63*33554432); printf ("size %i64u \n", difference); the first # ridiculously large. second number correct answer. how changing 62 63 cause such change? first value 18446744071562067968 second value 2113929216 sorry values 64 , 63, not 63 , 62. unless qualified otherwise, integer literals of type int . assume on platform you're on, int 32-bit. calculation (64*33554432) overflows , becomes negative. cast unsigned __int64 , gets flipped very large positive integer. voila: int main() { int a1 = (64*33554432); int a2 = (63*33554432); printf("%08x\n", a1); // 80000000 (negative) printf("%08x\n", a2); // 7e000000 (positive) unsigned __int64 b1 = a1; unsigned __int64 b2 = a2; printf("%016llx\n", b1); // ffffffff80000000 printf("%016llx\n", b2); // 000000007...

Download old version of package with nuget -

is there way download previous version of package nuget, not latest one? bring package manager console in visual studio - it's in tools / nuget package manager / package manager console. run install-package command: install-package common.logging -version 1.2.0 see command reference details. edit: in order list versions of package can use get-package command the remote argument and filter: get-package -listavailable -filter common.logging -allversions by pressing tab after version option in install-package command, list of latest available versions.

objective c - Get notifications when a Dailymotion video is played into a UIWebView -

i'm showing dailymotion url directly uiwebview. when tapping on thumbnail image, video starts playing in fullscreen mode. the problem is: when video stops playing or user tapps "done" button, original thumbnail has disapeared uiwebview, making impossible launch video again. control when video has finished playing or user has tapped done button reload uiwebview. i've been looking around , playing notification center couldn't response, can tell me code should use ? loading video nsurlrequest *requestobject = [nsurlrequest requestwithurl:[nsurl urlwithstring:@"http://www.dailymotion.com/embed/video/xh7cgv_cine-pocket-a-candidate_creation"]]; [self.webv loadrequest:requestobject]; notification catch [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(movieplayerdidexitfullscreen:) name:mpmovieplayerdidexitfullscreennotification ...

Export Data into excel using SSIS 2008 with 5000 length column -

i need create ssis package in 2008 export query result excel sheet. comment column has length 5000 , whenever try export data getting following error message: "error 0xc0204016: ssis.pipeline: output column comments (255) has length not valid. length must between 0 4000." i need apply formating on excel sheet word wrap possible thourgh ssis package. highly appricaited. thanks, yogi put data conversion component in between source , destination. should able stipulate data size.

iphone - Importing Objective-C JSON Framework in Xcode 4 -

the instructions installing json framework seem older versions of xcode. i'm relatively unfamiliar xcode , can't figure out how import framework project. selected of files in "classes" folder (json.h, nsobject+json.h, etc.) comes in download, dragged them main area of project, , added #import <json/json.h> viewcontroller's .h , .m files, , no such file or directory error json/json.h what doing incorrectly here? if you’ve placed files under classes group , haven’t taken further action, they’re @ root of project directory. such, import as #import "json.h"

html - Getting rid of the list item marker. And the margin -

i have normal html <ol> i need rid of number though. i know can rid of list-style-type: none; leaves huge margin left of item. need rid of them both. anyone know how? not using list not option. well, said want rid of margin ... how about: ol, li { margin: 0; padding: 0; list-style-type: none } if don't want reset margins, have @ least reset left margin , padding of ol , lis result want: ol, li { margin-left: 0; padding-left: 0; list-style-type: none } note, value of 0, units not required (ie. 0px). if goal have items flush left, , suspect is, you'll need reset padding i've indicated. as side note, if use css reset ( ie: http://meyerweb.com/eric/tools/css/reset/ ) you'll have style things explicitly. not better cross browser consistency you'll learn quite bit too.

javascript - Can you define jquery's $(function(){...}) twice on a page? -

i working on web page pulls external javascript file has of functions in it. i'll call file "functions.js". functions.js has jquery has $(function(){...}); operations when page ready. question is, possible write $(function(){...} on body of same page calls functions.js, whatever in both of domready functions happens on page? example, if functions.js is: $(function(){ $('div').css('color','green'); } and put code in tags on page calls functions.js: $(function(){ $('div').css('background-color','red'); } will page end making divs have both green text , red backgrounds, or 1 override other, or neither work? i hope makes sense! yes, can add many $(document).ready() calls want: http://docs.jquery.com/tutorials:multiple_$(document).ready()

Does java provide capped collection -

for example, capped list automatically delete first inserted items if total items pass specified amount? builtin or 3rd party support? answered here in stackoverflow question: is there bounded non-blocking collection in java?

c# - How to display a PNG from a file? -

i want switch image displayed on toolstripbutton. juste can't find how that. i think should like: btsearch.image = new image("myimage.png"); but doesn't work ( new image seems not exist). thank help i recommend image.fromstream() method doesn't lock actual file. for example: using (var stream = file.openread(path)) using (var image = image.fromstream(stream)) { //black magic here. } note must keep stream open lifetime of image. stream reset 0 if method called successively same stream. here's previous discussion answer jon skeet.

json - Can't parse Date with DateTimeFormat -

i can't string parsed datetimeformat format. here input string : thu apr 07 00:00:00 edt 2011 and format: datetimeformat.getformat("eee mmm dd hh:mm:ss vvv yyyy"); i've read correct format string, me it's not parsing correctly. here code: public class ycdatecolumn extends textcolumn<jsonobject> { datetimeformat fmtc = datetimeformat.getformat("dd-mmm-yyyy"); datetimeformat fmtb = datetimeformat.getformat("mmm dd, yyyy hh:mm:ss a"); datetimeformat fmta = datetimeformat.getformat("eee mmm dd hh:mm:ss vvv yyyy"); private string key = null; private string def = null; public ycdatecolumn(string akey, string adefault) { super(); key = akey; def = adefault; } public ycdatecolumn(string akey) { this(akey, null); } @override public string getvalue(jsonobject aobj) { system.out.println("ycdatecolumn - object= " + aobj); ...

c# - Spoof IP address for HTTP web request? -

i have web service on server in company have restricted access 1 other server on our network. i need make calls machine. there way can spoof other servers ip address in order send http request web service? need send info don't need returned data. it's logging hits server on our main server. i using this ipendpoint endpointaddress = new ipendpoint(ipaddress.parse(ipaddress), 80); using (socket socket = new socket(endpointaddress.addressfamily, sockettype.stream, protocoltype.tcp)) { socket.sendtimeout = 500; socket.connect(endpointaddress); socket.send(bytegetstring, bytegetstring.length, 0); } but exception a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond 23.202.147.163:80 in general, not possible establish tcp connection server without being able receive , process reply packets server. http built upon tcp, , tcp s...

How to create multiple wiki pages in Bitbucket and see/edit them later? -

i create multiple wiki '+new' link, after creating it, there no easy way see new page repository home page. 'home' (default) wiki available. missing ? in github, feature intuitive , pretty straight forward. can see wiki pages 'pages' link. you can more or less reproduce "pages" page github replacing text in root page following: <<toc / >>

What is the impact of switching in and out of the PHP render engine? -

is there substantial impact in performance (both in browser , on server) exiting , entering php render engine? example: <p>lorem ipsum..</p> <?php myphpfunction(); ?> <p>more html</p> <?php anotherphpfunction(); ?> if big impact in terms of performance, how can bundle of php together, if majority of pages static html? in terms of performance, there isn't downside of doing this. when use these echo statements, php building internal ouput buffer flushed browser once page done executing. there ways around this, such ob_flush . however in terms of separation of concern , overall software design, bad put business logic(not view logic brenton pointed out below) views. code becomes harder maintain if have type of setup.

osx - Mass replace characters in filenames from terminal? -

i have 50 files in directory contain spaces, apostrophes, etc. how can go mass-renaming them remove apostrophes , replaces spaces underscores? i can ls | grep '*.txt' | xargs .... but i'm not sure in xargs bit i use ren-regexp , perl script lets mass-rename files easily. you'd ren-regexp 's/ /_/g' *.txt . $ ls -l total 16 -rw-r--r-- 1 marc marc 7 apr 11 21:18 that's wrap.txt -rw-r--r-- 1 marc marc 6 apr 11 21:18 what's time.txt $ ren-regexp "s/\'//g" "s/ /_/g" *.txt that's wrap.txt 1 thats wrap.txt 2 thats_a_wrap.txt what's time.txt 1 whats time.txt 2 whats_the_time.txt $ ls -l total 16 -rw-r--r-- 1 marc marc 7 apr 11 21:18 thats_a_wrap.txt -rw-r--r-- 1 marc marc 6 apr 11 21:18 whats_the_time.txt

recursion - XSLT grouping recursive problem -

guys, recursion grouping not working. using xslt 1.0. need figure out. in advance. background: have 3 different types (common, category, & complex) in xml. goal to. 1 - group xml nodes based on types. 2 - create sub-group complex under type=common. 3 - type=complex create number of collections depending upon source xml. in each collection should list 4 elements name='a' or 'b' or 'c' or 'd'. i'm having problem. grouping , sub-grouping working fine. however, when try create collection using recursion not giving me intending output. reference please see expected out xml sample. source xml: <?xml version="1.0" encoding="windows-1252"?> <xml> <attributes> <attribute> <name>buyer id</name> <type>common</type> <value>lee</value> </attribute> <attribute> <name>enviornment</name> <type>comm...

PHP: How to exec 'svn up' in Linux -

i want visit url via http://xxxxx.php server update automatically i try many way use php execute "svn update" on server like: system('./svn.sh', $retval); //svn.sh contain svn .... system('svn .', $retval); system('/usr/bin/svn --username xxx --password --- /my_path', $retval); ps :i don not want use third party php extension subversion !!! i wouldn't use php type of task. rather use ssh publish localhost remote host bring server date ssh my_user@my_host.com "/usr/bin/svn /my_path" this more secure , more suited system level task.

c++ - Extension of STL container through composition or free functions? -

say need new type in application, consists of std::vector<int> extended single function. straightforward way composition (due limitations in inheritance of stl containers): class { public: a(std::vector<int> & vec) : vec_(vec) {} int hash(); private: std::vector<int> vec_ } this requires user first construct vector<int> , copy in constructor, bad when going handle sizeable number of large vectors. 1 could, of course, write pass-through push_back() , introduces mutable state, avoid. so seems me, can either avoid copies or keep immutable, correct? if so, simplest (and efficiency-wise equivalent) way use typedef , free functions @ namespace scope: namespace n { typedef std::vector<int> a; int a_hash(const & a); } this feels wrong somehow, since extensions in future "pollute" namespace. also, calling a_hash(...) on vector<int> possible, might lead unexpected results (assuming impose co...

java - Typical Requests/Second a "server" can handle? -

i want implement ajax client polling server. leads millions of small requests... do have rough estimates (based on hardware , experiences, currenlty not have dedicated server hardware yet), how man requets sever can handle example tomcat 7 standard server hardware (8gb ram, 4 cores, 2,5ghz each)? internal processing of 1 request estemated finish within 50 millisecons (only data put ram cache, counters incrementd, light textprocessing , data read memory again return client. fit in ram). i thankfull experiences made how requests think or able handle on server in comparable environment. thanks!! jens 50ms gives quite lot of processing, actually... if of these requests polling, presumably changes. how did come estimate? keep 4 cores busy 80 requests per second, of course... that's not awful lot, , wouldn't want run servers @ full capacity whole time, , there'll some overhead simple handling of networking. to honest, estimates relatively pointless compared ...

ruby on rails - Not able to create notebook and transfer files in evernote -

i developing web application , need create evernote notebook , transfer files in it. i able authenticate user evernote not able create notebook. i'm confused how transfer files in notebook. here authentication code. api url for creating notebook: notestore.createnotebook(access_token.token, "my_notebook") error: an error occurred: undefined method `write' "my_notebook":string edit following seth's lead notebook = evernote::edam::type::notebook.new() notebook.name = "my_notebook3" x= notestore.createnotebook(access_token.token, notebook) note = evernote::edam::type::note.new() note.notebookguid = x.guid note.title="my note" y=notestore.createnote(access_token.token,note) working on file transfer in note. the second parameter notebook structure, not string. need like: notebook = evernote::edam::type::notebook.new() notebook.name = "my_n...

display files and dir in linux as graphic mode -

how display directories , files in graphic way i forget command in linux linux command can displayed root directories recursive directories this root | sbin etc var ... | | | dir dir dir dir ........ | | | | | | | | i recommend use tree program. it's distributed along popular gnu/linux distros , more durable shell pipeline.

mysql - How can I get the yesterday's data and show it to my form today? -

the idea have 'present' form textbox 1 user can input data. now, want show yesterday's data(readonly) comparing result yesterday vs result today. ex: attendance: (yesterday- readonly textbox) andy shrob paula guinto mylene miles attendance (today) paula guinto mylene miles how can yesterday , show can see who's present yesterday , who's present today? i'm coding php , javascript i thinking of this: mysql_query("select prestoday, presyesterday attendance ???) all ideas welcome. ;) whether php code or javascript or mysql query table structure: mysql_select_db("csdcon", $con); $sql="insert attendance (prestoday, presyesterday, userdateinp, yesterdate) values ('$_post[prestoday]','$_post[presyesterday]','$_post[userdateinp]','$_post[yesterdate]')"; mysql_query("select prestoday, presyesterday attendance date(`datetimefield`) = date(date_sub(no...

unit testing - Fluent NHibernate - PersistenceSpecification of HiLo scheme -

not sure if i'm asking right question please bear me! bit of nhibernate noob. we're using fluent nh , have following id generation scheme tables public class idgenerationconvention : iidconvention { public void apply(iidentityinstance instance) { var = string.format("tablekey = '{0}'", instance.entitytype.name); instance.generatedby.hilo("hiloprimarykeys", "nexthighvalue", "1000", x => x.addparam("where", where)); } } we have sql script generates hiloprimarykeys table , seeds data gets run during deployment. working fine. i'm trying write unit tests verify our persistence layer, ideally using sqlite in memory configuration speed. how configure nh tests: [setup] public void setupcontext() { config = new sqliteconfiguration() .inmemory() .showsql() .raw("hibernate.generate_statistics", "true"); var nhconfig = ...

database design - Which approach is better - comment attribute in each table vs one comment table -

currently, have bunch of tables in system need store 1 comment per row (not content type or else - simple 1 comment per row , no history tracking). there advantage creating comment table , having fk other tables need comments opposed directly creating comment column in each of tables? is there advantage on physical db side - in terms of database performance these 2 approaches? it's impossible comment (cough) meaningfully on performance without testing. you're 1 in reasonable position that. at logical level, comment data in row should stored row. some dbms move wide columns internally secondary storage area. speeds access rows when don't select comment column (fewer physical reads), slows down access when select comment column (reads different part of internal data structures). might not notice difference unless you're selecting many thousands of rows out of millions of rows. (but, again, testing . . .)

javascript - jqGrid: fixed row -

Image
is possible set row on fixed position? example, have total row, , want total on top, after sorting etc. is there plugin this? we have tried in onloadcomplete redrawing whole table so: var rowids = $(this).getdataids(); var rowid, columnid; $(this).cleargriddata(); (rowid in rowids) { (columnid in data.rows[rowid]) { $(this).addrowdata(rowids[rowid], data.rows[rowid], (data.rows[rowid][columnid].first ? 'first' : null)); break; // first column } } but bad performance, have thousands of rows. after oleg's comment: the total row row our dataset. dataset has format: columns: 'network', 'clicks', 'views' data = [ { 'network': {value:'google'}, 'clicks': {value:38392882}, 'views':{value:3939922} }, { 'network': {value:'sanoma'}, 'clicks': {value:177883}, 'views':{value:39293} }, ... , { 'network': {value:'total'}, '...

design patterns - Repositories / Lazy Loading / Persistance -

i have trouble repository pattern. or maybe unclear points. sake of these questions have simple example domain 2 entity aggregates. public class category { string name {get;set;} category parent {get;set;} ilist<category> children {get;set;} } public class transaction { category owner {get;set;} string name ... bla bla } in particular domain model these 2 not form single aggregate. such, have 2 standard irepository implementations each of 2 entities. question one : when dealing validation, such deletion of category, repository needs relational checks. common practise repositories talk (and such injected references) other repositories , generate errors, keeping neatly disconnected other layers or delegate database layer? question two : similarly, when updating entity (aggregate) save/change/delete validation needs done on various components. presumably reasonably doable when have unit of work buffers changes , commits when validation succeed? question t...

java - What is the Best practice for try catch blocks to create clean code? -

possible duplicate: best practices exception management in java or c# i've read a question earlier today on stackoverflow , made me think best practice handling exceptions. so, question what best practice handle exceptions produce clean , high quality code . here code, think it's quiet straight forward please let me know if i'm wrong or not clear! i've tried keep in mind testability , same abstraction level in methods. every constructive comment welcomed. :) import java.awt.point; import java.io.closeable; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.ioexception; import java.io.objectinputstream; import java.util.list; import org.slf4j.logger; import org.slf4j.loggerfactory; import com.google.common.base.preconditions; /** * <p>this dummy code.</p> * aim present best practice on exception separation , handling. */ public class exceptionhandlingdemo { // system.out not practice. usin...