Posts

Showing posts from August, 2015

php - How to persist a very abstract data type between sessions -

i have abstract data type behaves stack. represents history of "graph objects" made particular user. each "graph object" holds 1 or more "lines", date range, keys, , title. each "line" holds sql generator configured particular subset of data in db. i these "histories" available users between sessions. in form of tab reads "most recent graphs". what believe best way persist type of data between sessions. application rather large, efficiency concern. have had @ serialize: http://php.net/manual/en/function.serialize.php you use in conjunction database.

Multiple delimiters in Scanner class of Java -

how use usedelimiter() method of scanner class use both comma (,) , new line character (\n) delimiters? i parsing text csv file. scanner s = new scanner("hello, world \n hello world"); s.usedelimiter(",|\\n"); while(s.hasnext()){ system.out.println(s.next()); } output hello world hello world javadoc

c# - Textbox padding -

Image
i've searched through internet, must using wrong keywords because can't find anything. want create textbox has text starting little far left. just that. as have discovered, winforms textboxes not have padding property. since panels expose padding property, 1 technique to: create panel set border match textbox (e.g., fixed3d) set background color match textbox (e.g., white or window) set padding satisfaction (e.g., 10,3,10,3) add textbox inside panel set textbox's border none play textbox's dock , anchor properties desired effect this should started. create custom control same thing mentioned above. in case talking textboxes in asp.net, use css: input[type="text"] {padding: 3px 10px}

mobile - Android Custom URI Handler - Gmail App doesn't recognize? -

i'm trying open link gmail application. if send myapp://custom/params, gmail recognizes text. can link open application "myapp" browser, though. how can around this? i'd suggest use uris content: scheme , custom contentprovider. see http://developer.android.com/guide/topics/providers/content-providers.html .

set sound as ringtone or notification in android app -

since, im trying learn code. decided make 1 of soundboards. since, having them on phone. i've been googling source codes of these. i've found 1 main source code of soundboard project. and, seems main 1 out there else talks about. then, wanted learn how set sound on soundboard ringtone, , notification. ive been googling hours , running same codes dont work me. can't figure out codes set sound ringtone, , or else. i've tried scratch no luck. i can't find else on topic. please me, , im googled out find same information. i want able program soundboard set sound ringtone or notification in android/java. thanks. i guess should put in code suppose. :) - know simple, giving me such hard time, , id know part. menu come up, not saving sdcard file. have no clue whats happening here in java/android. im php guy, ty help button btn = (button) findviewbyid(r.id.sound1); registerforcontextmenu(btn); } @override public...

colors - Textmate is garbling Rails test output -

instead of colors see this.. texmate screenshot http://zeke.sikelianos.com/temp/textmate_tests_garbled.png anyone know might causing this? the shell textmate using run tests doesn't seem handling shell text coloring correctly. "[32m" shell color code green. surprising red works, green doesn't. may want try changing shell textmate running tests in, or making sure shell using using colors.

android - handling bluetooth spp pairing request thru app -

my android application in blueotooth spp server mode , listening client devices, application knows passcode required pairing of devices. my question is, possible handle pairing request through application. , regards. no - because security point of view important user aware of pairing. idea devices paired , bonded once, onwards connections happen automatically initiated applications without need re-pairing (or user intervention)

ruby on rails - Trouble with setting custom controller redirect for devise -

i'm having trouble setting devise controllers. i've tried quite things nothing seems work. please not redirect me wiki, know it, have tried things without success. in current situation, after login user redirected properly, after sign up, seems current_user not available. so, question : if have controller named town, how can redirect devise controller after successful login , successful signup ? edit : there seems kind of messing controllers. times, errors : no route matches {:action=>"monster_attack", :controller=>"user/tavern"} although user/tavern never specified, when login sometimes, redirection. if specify :controller => '/tavern', works ok. ideas ? well following works me. given in rails 3 working devise model called "user", in routes.rb file: devise_for :users namespace :user root :to => "town#show" end hope helps.

jquery - Why won't .live() work with my custom event, but .bind() will? -

i'm thinking it's bug, of 1.4.2, .live() supposed support custom events. here's quick little demo: http://jsbin.com/erofi/edit is bug, or doing wrong triggers? .live() must used on selector. whether event target element matches selector string checked @ event time. hinted @ in doc ‘caveats’: dom traversal methods not supported finding elements send .live(). rather, .live() method should called directly after selector, in example above. $(document) isn't selector. if @ $(document).selector , remembered selector string live() uses matching, empty string, hence live() not working. since selectors match elements, can't live -bind against document . again, since document never changes, there no need to: normal binding fine. (this unfortunate api design. should have been $.live('selector', 'event', function() {}); imo. $('selector').live() makes unclear it's doing. , there should have been error when call live...

c++ - Static variable not initialized -

i've got strange problem static variable not initialized should be. i have huge project runs windows , linux. linux developer doesn't have problem suggest kind of wired visual studio stuff. header file class myclass { // other stuff here ... private: static anotherclass* const default_; }; cpp file anotherclass* const myclass::default_(new anotherclass("")); myclass(anotherclass* const var) { assert(default_); ... } problem default_ is null . tried breakpoint @ initialization of variable cannot catch it. there similar problem in class. cpp file std::string const myclass::mystring_ ("sometext"); myclass::myclass() { assert(mystring_ != ""); ... } in case mystring_ is empty. again not initialized. does have idea that? visual studio settings problem? cheers simon edit: i came across static initialization fiasco. i'm not sure if problem because there no problems linux compiler. shouldn't co...

facebook profile pic not working in div tag in firefox -

<div> <img src='http://graph.facebook.com/<?php $user->id ?>/picture'/>; </div> this code m using facebook profile pic in div ,this div tag running in java script ,when run code in chrome works well,but in firefox blink , image comes,pls in advance you need show more code, need echo user id: <img src='http://graph.facebook.com/<?php echo $user->id ?>/picture' alt='' />

bar button disappear on splitview controller when orientation change in ipad application -

i use splitview controller in ipad application, works ok, when change interface landscape portrait disappear bar button , popovercontroller toolbar. just set "animated" parameter no in setitems method of toolbar. - (void)splitviewcontroller: (uisplitviewcontroller*)svc willhideviewcontroller:(uiviewcontroller *)aviewcontroller withbarbuttonitem:(uibarbuttonitem*)barbuttonitem forpopovercontroller: (uipopovercontroller*)pc { barbuttonitem.title = @"clients"; nsmutablearray *items = [[toolbar items] mutablecopy]; [items insertobject:barbuttonitem atindex:0]; [toolbar setitems:items animated:no]; [items release]; self.popovercontroller = pc; } - (void)splitviewcontroller: (uisplitviewcontroller*)svc willshowviewcontroller:(uiviewcontroller *)aviewcontroller invalidatingbarbuttonitem:(uibarbuttonitem *)barbuttonitem { nsmutablearray *items = [[toolbar items] mutablecopy]; [items removeobjectatindex:0]; [toolbar setit...

assembly signing - Do I need to sign my assemblies for an asp.net mvc app? -

if i'm deploying asp.net mvc app, need sign dlls? won't placed in gac. no, microsoft recommend signing every assembly well-recongised practice (you may want deploy gac in future).

asp.net - Membership.Updateuser not really updating the database -

i'm working on membership system web application, based on forms authentication framework. i created users integrated tool, , login working. want give administrator capability create, modify, delete users. so here i've got right now: protected sub page_load(byval sender object, byval e system.eventargs) handles me.load dim muc membershipusercollection = membership.getallusers() combobox1.datasource = muc combobox1.datavaluefield = "username" combobox1.datatextfield = "username" combobox1.databind() end sub protected sub combobox1_selectedindexchanged(byval sender object, byval e eventargs) handles combobox1.selectedindexchanged dim username string = combobox1.selectedvalue dim mu membershipuser = membership.getuser(username) dim userroles string() = roles.getrolesforuser(username) tbcomments.text = mu.comment tbemail.text = mu.email lblusername.text = mu.username end sub protected sub button1_clic...

How to retrieve unicode data stored directly in non-unicode field as varchar format in sql server -

i have create c# application displays unicode data in textbox. but sql server column storage has varchar data contains unicode data. since varchar non-unicode based displays character strings "????????". well problem facing cant change column type there other dependent application running on it. you cannot store unicode data in varchar without conversion column's collation. so, unicode encoded entirely different when stored in varchar column , lost. if seeing ????? means encoding not find character maps ansi value when being stored , stored question mark instead. if want store unicode in database right solution change column's data type. if cannot change column's data type, add column set nvarchar , ensure unicode sources read , write column.

nhibernate - Is it possible to create ICriteria/ICriterion from LINQ or HQL? -

i creating method can create filter understood nhibernate (by filter mean set of icriteria object example) abstract filter object. public static ienumerable<icriterion> tonhcriteria(this mycriteria criteria) { // t4 generated function // lots of result.add(expression.or(expression.eq(),expression.eq)) expression trees - hard generate // there way generate hql/linq query here istead? } then want like session.createcriteria<entity>().add(mycriteria.tonhcriteria()) to filter entities. problem using expression. methods (expression.or etc) quite tedious (the method generated , have multiple or statements have joined expression somehow). there way avoid using expression.or() , create icrietrion / icriteria using linq or hql? hey, did check out this question? shows going linq nhibernate multicriteria (and on way transforms linq query icriteria)

asp.net mvc - Is it possible to pass a ViewModel object encapsulating Person to a Create view but only receive a Person object from a POST Create action method? -

i have domain model , view model follows: domain model: namespace mvcapplication1.models { public enum sex { male, female }; public class person { public int id { get; set; } public string name { get; set; } [required(errormessage="please select either female or male.")] public sex? sex { get; set; } } } view model: namespace mvcapplication1.viewmodels { public class homecreatevm { public homecreatevm() { } public homecreatevm(person p) { person = p; selectlist = p.sex.getselectlist(); } public person person { get; set; } public selectlist selectlist { get; set; } } } the auxiliary extension method defined follows: namespace mvcapplication1.models { public static class utilities { public static selectlist getselectlist<xxx>(this xxx? obj) xxx : struct { var values = xxx x...

.net - Using Mapped Memory Files in C# to store reference types -

i need store dictionary file fast possible. both key , value objects , not guaranteed marked serializable. prefer method faster serializing thousands of objects. looked mapped memory files support in .net 4. however, seems memorymappedviewaccessor allows storage of structs , not reference types. is there way of storing memory used reference type of file , reconstructing object blob of memory (without binary serialization)? memory mapped files fundamentally incompatible garbage collector. why took long such principal operating system feature supported .net. reference types need serialized mmf view, memorymappedviewstream, no way around that. similar restriction exists in unmanaged code, objects pointers need flattened pointed-to objects visible in view well. whether serialize them mmf or file won't make difference, file system cache implemented mmfs well. file writes very fast, long written data fits in available mappable memory. if that's issue @ 64-bit o...

Grails-Write Selenium code inside a EasyB scenario -

i trying write selenium inside scenario's. however, when try start selenium using following code: before "start selenium", { given "selenium , running", { selenium = new defaultselenium("localhost", 4444, "*firefox", "http://www.google.com.my/") selenium.start() } i error: error running easyb tests: org.codehaus.groovy.control.multiplecompilationerrorsexception: startup failed, : 7: unable resolve class defaultselenium i trying implement http://www.theserverside.com/news/thread.tss?thread_id=55184 much appreciated. the code referencing has following import statements: import com.thoughtworks.selenium.* import java.util.regex.pattern your error message suggests not have defaultselenium imported in code.

mootools - javascript: Which is the powerful javascript compressor -

which powerful javascript compressor http://www.bananascript.com/ because bananascript compress mootools uncompressed library(138kb) 40kb. best result compared google js compressor, yui compressor, etc. there pitfalls or cross browser problems should knowing of. 1 should go if want compress mootools uncompressed library. way can determine use compress other custom js files? besides raw size of generated script, thing must keep in mind performance required executed script. if compression done in way requires browser first decompress or regenerate original code creating performance hit maybe choosing of other compressors have been better choice, specially files sent once , cached @ browser, decompression must done everytime page loaded.

wpf - Creating instances of resources? -

i'm brand spanking new wpf , trying play around projects better understand i'm reading. my understanding of resource is instance, can't use factory , create instances of it. example, xaml-defined rectangle. can reference it, can't have numerous instances of on surface. in wpf, way that? if define rectangle resource specific properties , wanted have multiple instances of within dynamically-generated grid, how should going it? or there different way should trying this? purely academic exercise no real-world application. actually there's nothing resources in particular prevents using multiple times. perfect example of brush resources, style resources, etc. define them in xaml , xaml parser creates single instance of resources , stores them in resource dictionary , these brushes, styles, etc can used property values many times though single instance of resource created. but having said that, noted, can't define rectangle resource , use mul...

asp.net - dotnet nuke error -

hi there trying debug dot net nuke server error , iam not sure start. don't have code locally else debug (no familiar dnn setup). this bug affects making cms updates site message 'a critical error has occurred' , i have been unsuccessfully trying find out cause , throwing hands, i don't need fix , want find out causing error can provide estimate fix , can seem that. please help!! if head on menu in dotnetnuke under admin | event viewer/log , drill down supplied drop down lists, somewhere. choose portal , type, might want choose general exception type begin unless you've spotted hint when bombs out.

c# - How do I Data-Bind dual DateTimePicker to a single DateTime object -

i have simple form, 2 datetimepicker-controls: 1 date, , 1 time. thing these 2 controls supposed represent single point in time. hence "bind" them single datetime property on form (for simplicity). did following: // start datetime property on form _startdate.databindings.add("value", this, "start"); _starttime.databindings.add("value", this, "start"); but hooking "valuechanged" event, yields mixed results... want, updates of property "sluggish". figured way of splitting 2 datetimepicker's common. how it? update: there possibly multiple questions in there: how bind datetimepicker (format: date) datetime property on form? then, how bind yet datetimepicker (format: time) same property? i'm using visual studio express 2008 (.net 3.5), , seemingly valuechanged events datetimepickers before value changed? unfortunately, think may finding writing custom control includes both, can data bin...

c++ - Is this not downcasting? -

if do double d = 34.56; int = (int)d; am not "downcasting"? or is term used in terms of classes , objects? i confused because in case "downcasting" bigger double smaller int , in case of classes, "downcast" smaller base class bigger derived class . aren't these 2 conventions, in sense, opposite? no, not down casting. casting, , you're chopping off after decimal. down casting doesn't apply here. primitives int , double not objects in c++ , not related each other in way 2 objects in class hierarchy are. separate , primitive entities. down casting refers act of casting 1 object object derives it. refers act of moving down root of class hierarchy. has nothing sizes of types in question.

c# - DotNetOpenAuth OpenID Provider "Sequence contains more than one element" -

i'm having trouble implementing openid provider dnoa 3.4.3. going absolutely peachy until needed ax support well. set axfetchassregtransform in web config, recommended andrew @ http://groups.google.com/group/dotnetopenid/browse_thread/thread/5629a24c0a7e8d99 . doing caused me exception "sequence contains more 1 element" on decide.aspx page, however, , haven't been able past it. the following line throwing exception: edit: strangely enough, not line throwing error anymore. sendresponse() triggering exception claimsrequest requestedfields = providerendpoint.pendingrequest.getextension(); providerendpoint.sendresponse() any thoughts on why may be? appreciated! the logs leading error follows: 2010-04-28 12:38:20,247 (gmt-7) [5] info dotnetopenauth.messaging.channel - scanning incoming request messages: https://myprovider/provider.ashx?openid.ns=http%3a%2f%2fspecs.openid.net%2fauth%2f2.0&openid.claimed_id=http%3a%2f%2fspecs.openid.net%2fauth%2f2.0%2...

python - What is the problem with ODBC as a technology? -

recently zed shaw (a programmer blogs) mentioned odbc references should removed popular python book dive python. have never worked odbc , wanted understand why odbc "bad". pros , cons of technology? alternatives there? the biggest issue 64 bit support not entirely available across different data sources. problem people bridge odbc technology eliminate unnecessary layers of complexity. example, jdbc->odbc when go jdbc direct.

c# - how to convert avi file to an jpg's images array using .net -

how convert avi file jpg's images array using .net , need develop task take avi file , save jpg images on folder you can command line ffmpeg . see this part of documentation. example, ffmpeg -i infile.avi -f image2 image-%03d.jpg will save frames infile.avi numbered jpegs (image-001.jpg, image-002.jpg,...). can use other command line options frames want or other post processing resizing or deinterlacing. you create program in .net calls ffmpeg executable right command line , moves resulting files correct place. easier trying use video library directly.

CheckBox Command Behaviors for Silverlight MVVM Pattern -

i trying detect when item checked, , which item checked in listbox using silverlight 4 , prism framework. found example on creating behaviors, , tried follow nothing happening in debugger. have 3 questions: why isn't command executing? how determine item checked (i.e. pass command parameter)? how debug this? (i.e. can put break points begin stepping this) here code: view: <listbox x:name="mylistbox" itemssource="{binding panelitems, mode=twoway}"> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal"> <checkbox ischecked="{binding enabled}" my:checked.command="{binding check}" /> <textblock x:name="displayname" text="{binding displayname}"/> </stackpanel> </datatemplate> ...

How to use a servlet filter in Java to change an incoming servlet request url? -

how can use servlet filter change incoming servlet request url from http://nm-java.appspot.com/check_license/dir_my_app/dir_abc/my_obj_123 to http://nm-java.appspot.com/check_license?contact_id=my_obj_123 ? update : according balusc's steps below, came following code: public class urlrewritefilter implements filter { @override public void init(filterconfig config) throws servletexception { // } @override public void dofilter(servletrequest req, servletresponse res, filterchain chain) throws servletexception, ioexception { httpservletrequest request = (httpservletrequest) req; string requesturi = request.getrequesturi(); if (requesturi.startswith("/check_license/dir_my_app/")) { string toreplace = requesturi.substring(requesturi.indexof("/dir_my_app"), requesturi.lastindexof("/") + 1); string newuri = requesturi.replace(toreplace, "?contact_id="); ...

What does $this generally mean in PHP? -

i new php, kind of confused seeing these different operators day. here code came across when watching video tutorail, i'd appreciate if explain little bit: class email extends ci_controller { function __construct() { parent::__construct(); } function index() { $config = array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.googlemail.com', 'smtp_port' => 465, 'smtp_user' => 'username@gmail.com', 'smtp_pass' =>'password', ); $this->load->library('email', $config); $this->email->set_newline("\r\n"); $this->email->from('username@gmail.com', 'jerry'); $this->email->to('username@gmail.com'); $this->email->subject('this email test'); $this->email->message('this test message!'); if(...

Hiding and showing fields still validates hidden fields with ASP.NET MVC 2 Client Side Validation -

i've got form part of e-commerce checkout process has section billing address allows user use delivery address or fill in address in form. if user selects use delivery address don't show address fields. i've added validation fields on server side check option selected , remove validation errors fields hidden. works fine on server site i'd use mvc 2's client side validation , need way of doing same on client side. what i'd way of getting javascript validation ignore hidden fields. there way of doing or case of hacking microsoftmvcjqueryvalidation.js file? jquery validation ignore hidden's? $("#myform").validate({ ignore: ":hidden" }) elements can considered hidden several reasons: they have display value of none. they form elements type="hidden". their width , height explicitly set 0. an ancestor element hidden, element not shown on page. source: here

python - Google App Engine deferred.defer() failing when method returns -

i'm trying use google.appengine.ext.deferred run task. passing method defer() method, , method runs successfully, upon returning, valueerror thrown: file ".../admin.py", line 73, in post result = deferred.defer(meeple_tasks.buildgames()) file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/google/appengine/ext/deferred/deferred.py", line 198, in _curry_callable raise valueerror("obj must callable") valueerror: obj must callable here call defer: result = deferred.defer(meeple_tasks.buildgames()) buildgames() return true when completed. you should use: result = deferred.defer(meeple_tasks.buildgames) if use buildgames() , invokes function right , there , passing return value defer() . removing parenthesis, pass function defer.

sql - Porting join from Oracle to Postgres -

insert mission_objective( msn_int_id, mo_int_id, mo_msn_class_nm, mo_msn_class_cd, mo_msn_type, mo_priority, mo_comment, mo_start_dt, mo_end_dt, asp_airspace_nm, mo_obj_location, mo_alo_leg_id, mo_alo_arrive_loc) select '1025', '1', 'airdrop', 'adp', 'lapes', null, coalesce( null, ' '), to_timestamp( '1002260900', 'yymmddhh24mi'), to_timestamp( '1002260915', 'yymmddhh24mi'), 'transit alpha', 'transit alpha', '1', 'transit alpha' airspace asp, apsmain .mission_class mc asp.asp_airspace_nm(+)= 'transit alpha' , mc.mcs_mission_class_name= 'airdrop' , 'transit alpha' not null the part confusing me asp.asp_airspace_nm being right joined constant. how can port use normal right join? tidied formatting bit. insert mission_objective ( msn_int_id, mo_int_id, mo_msn_class_nm, mo_msn_class_cd, mo_msn_type, mo_priority, mo_comment, mo_s...

objective c - Cocoa @sum array operator too slow - alternatives? -

i've got text field value bound key path uses @sum. when array controller filtered, text field updates properly, extremely slowly, lagging ui or outright beachballing after every key press (less number of items in arrangedobjects decreases). there no lag if don't use @sum; i've narrowed down this. is there faster way same thing? this should have answer: http://cliffhacks.blogspot.com/2007/03/cocoa-bindings-sum-is-on-even-if-youre.html

sql - Help to the way to write a query for the requirement -

i need write sql-server query don't know how solve. have table realtimedata data: time | value 4/29/2009 12:00:00 | 3672.0000 4/29/2009 12:01:00 | 3645.0000 4/29/2009 12:02:00 | 3677.0000 4/29/2009 12:03:00 | 3634.0000 4/29/2009 12:04:00 | 3676.0000 // eod of day "4/29/2009" 4/30/2009 12:00:00 | 3671.0000 4/30/2009 12:01:00 | 3643.0000 4/30/2009 12:02:00 | 3672.0000 4/30/2009 12:03:00 | 3634.0000 4/30/2009 12:04:00 | 3632.0000 4/30/2009 12:05:00 | 3672.0000 // eod of day "4/30/2009" 5/1/2009 12:00:00 | 3673.0000 5/1/2009 12:01:00 | 3642.0000 5/1/2009 12:02:00 | 3672.0000 5/1/2009 12:03:00 | 3634.0000 5/1/2009 12:04:00 | 3635.0000 // eod of day "5/1/2009" i want eod's data of days exist in table. (eod = end of day). sample's data, need reture table following: time | value 4/29/2009 | 3676.0000 4/30/2009 | 3672.00...

c# - Mono https webrequest fails with "The authentication or decryption has failed" -

i'm making simple rest client use in c# applications. in .net on windows works great http:// , https:// connections. in mono 2.6.7 (also tested 2.8 same results) on ubuntu 10.10 http:// works. https:// connections throw exception on request.getresponse() method: unhandled exception: system.net.webexception: error getting response stream (write: authentication or decryption has failed.): sendfailure ---> system.io.ioexception: authentication or decryption has failed. ---> mono.security.protocol.tls.tlsexception: invalid certificate received server. error code: 0xffffffff800b010a @ mono.security.protocol.tls.handshake.client.tlsservercertificate.validatecertificates (mono.security.x509.x509certificatecollection certificates) [0x00000] in <filename unknown>:0 @ mono.security.protocol.tls.handshake.client.tlsservercertificate.processastls1 () [0x00000] in <filename unknown>:0 @ mono.security.protocol.tls.handshake.handshakemessage.process () [0x00000] in...

c - what is use of .exp and what is the difference between .lib and .dll -

during compilation , linking, use of .exp? difference between .lib , .dll? know .lib used, while linking , .dll used when running program. difference between .lib , .dll? does .lib file not contain code functions coming .dll files? need using 2 separate files? please clarify. in advance in case of import library dll, .lib file not contain actual code @ all. contains list of functions in associated dll -- enough linker embed reference dll linked library, not else. a .exp file export file -- same .lib file. it's used (at least primarily) when have circular dependency. example, assume have dll acts plug-in executable. executable supplies exported functions use plug-in dlls, needs able call functions in plug-ins (e.g. load , initialize plug-in). the dll won't link until executable built provide .lib file -- executable won't link until dll built provide .lib file. break dependency, run linker against executable, fails (because can't find .lib file dll),...

cruisecontrol - How to integrate ClearCase client CCRC 7.1 with Cruise Control build integration (java)? -

what needed have build integration (cruise control) on workstation ccrc installed? the principle of build scheduler trigger build based on criteria: scm, criteria typically detection of new versions. the local workstation cannot ake simple 'lshistory' in local view, because local view isn't view (it copy of snapshot 'web' view created/maintained on ccrc server). the idea use ccrc java api (as in your previous question ), in script made update ccrc view , see if new version detected.

javascript - How do I slow down the banner transitions on my homepage? CSS -

on homepage banner transitions going quickly- know how slow them down. here page: www.sevenbarfoundation.org it written in css under: http://assets.sevenbarfoundation.org/wp-content/themes/sevenbar/js/slideshow.js you need change values in line 14 , 15 have effect want (timeout , speed): $('#slideshow').cycle({ timeout: 1000, speed: 1000, pager: '#slideshow_controls_num' });

javascript - auto fill form and submit -

i have form on 404 page auto filled address user tried find. have javascript auto submits form. the problem is, once auto submits keeps looping , page keeps reloading. i trying wright javascript code fire once , stop. script fires on page load that's whats causing loop. outcome: need fire on page load, page reloads, code checks see if reloaded once stops. for test trying make pop alert says "i reloaded once" know worked. this code far <script type="text/javascript"> window.onload = function() { var grabedurl = window.location.href document.getelementbyid('badurl').value=grabedurl; if( history.previous != history.current ){alert('i reloaded once')} else settimeout("document.getelementbyid('errorsubmit').click()", 3000);} </script> what can add state of page having been reloaded or not query string part of url. should done in form 's action , e.g. action="?submitted" window.onl...

ajax - jQuery plugin, unbind elements and rerun the plugin -

i'm making simple plugin activates when hyperlinks clicked example: // actives plugin anchor class mylink jquery('a.mylink').c_podsystem(); // plugin (function($){ $.fn.c_podsystem = function(opt) { var opt = $.extend(opt); return this.each(function() { jquery(this).click(function(e){ // } }); }; })(jquery); in instances need rerun plugin after ajax success (so anchors might returned in ajax class mylink work plugin). however, if run jquery('a.mylink').c_podsystem(); in ajax callback, reruns items on page binded, causes plugin run twice. so combat need unbind elements affected return this.each() then rerun jquery('a.mylink').c_podsystem() actives anchors on page class mylink from fresh dom. how unbind affected elements, can rerun plugin? would possible adjust plugin use .live() ? attach handler event elements match current selector, , in future. using live r...

.net - Start Word and monitor if document closed -

we need our school project way start word instance , track if document closed. com api word doens't have event this, there other ways this? currently we're using com api word, else fine. we're programing in c#. if using microsoft.office.interop.word library there event can subscribe too: microsoft.office.interop.word.application wordapp = new microsoft.office.interop.word.application(); wordapp.documentbeforeclose += new applicationevents4_documentbeforecloseeventhandler( wordapp_documentbeforeclose); ... private void wordapp_documentbeforeclose(document doc, ref bool cancel) { // thing } edit: to take care of file lock ==> take @ this post . can see there few things done in documentbeforeclose: check if document saved. if not ==> ask save , yourself. close document yourself close word after these things taken care of, can stuff. lock should released.

Does "epsilon" really guarantees anything in floating-point computations? -

to make problem short let's want compute expression a / (b - c) on float s. to make sure result meaningful, can check if b , c in equal: float eps = std::numeric_limits<float>::epsilon(); if ((b - c) > eps || (c - b) > eps) { return / (b - c); } but tests show not enough guarantee either meaningful results nor not failing provide result if possible. case 1: a = 1.0f; b = 0.00000003f; c = 0.00000002f; result: if condition not met, expression produce correct result 100000008 (as floats' precision). case 2: a = 1e33f; b = 0.000003; c = 0.000002; result: if condition met, expression produces not meaningful result +1.#inf00 . i found more reliable check result, not arguments: const float inf = numeric_limits<float>::infinity(); float x = / (b - c); if (-inf < x && x < inf) { return x; } but epsilon , why saying epsilon use? "you must use epsilon when dealing floats" knee-jerk reaction of p...

php - Routing in Symfony2 -

how setup default routing in symfony2? in symfony1 looked this: homepage: url: / param: { module: default, action: index } default_symfony: url: /symfony/:action/... param: { module: default } default_index: url: /:module param: { action: index } default: url: /:module/:action/... i looking through cookbook answer this, , think i've found here . default, route parameters have hidden requirement match character except / character ([^/]+), behaviour can overridden requirements keyword, forcing match any character. the following should create default route catches others - , such, should come last in routing config, following routes never match. ensure matches "/" well, default value url parameter included. default_route: pattern: /{url} defaults: { _controller: acmebundle:default:index, url: "index" } requirements: url: ".+"

Get zipcode from google api? -

how zipcode google api ? got lat.,long.,but want zipcode you can call api: https://maps.googleapis.com/maps/api/geocode/json?latlng=37.383253,-122.078075&sensor=false full documentation here: docs

.net - Utility to combine querystrings? -

is there utility combine querystrings? i'm looking like: input: combine("test=a&test2=b", "test3=c") result: "test=a&test2=b&test3=c" input: combine("test=a&test2=b", "") result: "test=a&test2=b" input: combine("", "test3=c") result: "test3=c" and maybe weird ones: input: combine("&test=a&test2=b", "?test3=c") result: "test=a&test2=b&test3=c" i use following class me modify , set query strings. while doesn't solve exact problem, can use , add more functions of own accomplish whatever want. find handy treat query strings idictionary when want modify them. public static class querystringextensions { /// <summary> /// creates dictionary query string or other parameter collection /// </summary> /// <param name="querystring"></param> /// <retu...

Ruby: How to get the first character of a string -

how can first character in string using ruby? ultimately i'm doing taking someone's last name , creating initial out of it. so if string "smith" want "s". you can use ruby's open classes make code more readable. instance, this: class string def initial self[0,1] end end will allow use initial method on string. if have following variables: last_name = "smith" first_name = "john" then can initials cleanly , readably: puts first_name.initial # prints j puts last_name.initial # prints s the other method mentioned here doesn't work on ruby 1.8 (not should using 1.8 anymore anyway!--but when answer posted still quite common): puts 'smith'[0] # prints 83 of course, if you're not doing on regular basis, defining method might overkill, , directly: puts last_name[0,1]

Mysql, SubQuery problems -

select rating_id, average_rating (select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50) having average_rating > 4 ; after running query, error every derived table must have own alias i know section here works: select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50 what doing wrong in subquery? searched , searched , searched couldn't find mistake, no matter corrected, still errors put "as somealias" after subquery: select rating_id, average_rating (select rating_id, avg(rating_num) average_rating ratings group rating_id having count(*) > 50) having average_rating > 4 ;

user interface - How do I load random levels? -

i'm using unity 3 build game. have basic gui button when clicked, user taken random level. there 10 levels in game. below copy of code i'm trying implement. function ongui () { // make background box gui.box (rect (10,10,100,90), "oracle"); if (gui.button (rect (20,40,80,20),9)); { application.loadlevel(random.range(0,9)); } } it's not happening. i've tried: function ongui () { // make background box gui.box (rect (10,10,100,90), "oracle"); if (gui.button (rect (20,40,80,20))); { application.loadlevel(random.range(0, application.levelcount 9)); } } i've never used random.range function before , confused @ proper format. also have ez gui available , wondering if enter correct random range script 'script' dropdown or 'script method' drop down work it, i'd rather use custom button. assistance appreciated. here code worked. rebuilding , adding few m...

java - How can "this" of the outer class be accessed from an inner class? -

is possible reference this within java inner class? i.e. class outer { void amethod() { newclass newclass = new newclass() { void bmethod() { // how access "this" (pointing outer) here? } }; } } you can access instance of outer class this: outer.this

python - Extending a form field to add new validations -

i've written app uses forms collect information sent in email. many of these forms have filefield used attach files email. i'd validate 2 things, size of file (to ensure emails accepted our mail server. i'd check file extension, discourage attaching file types not useable our users. (this python class i'm trying extend) class filefield(field): widget = fileinput default_error_messages = { 'invalid': _(u"no file submitted. check encoding type on form."), 'missing': _(u"no file submitted."), 'empty': _(u"the submitted file empty."), 'max_length': _(u'ensure filename has @ %(max)d characters (it has %(length)d).'), } def __init__(self, *args, **kwargs): self.max_length = kwargs.pop('max_length', none) super(filefield, self).__init__(*args, **kwargs) def clean(self, data, initial=none): super(filefield, self)....

vb.net - In ASP.NET MVC, can someone give me an example of Visual Basic code for HTML.HiddenFor? -

i'm working on asp.net mvc2 web application, , i'm having trouble getting html helpers work. prefer work in visual basic, , have not been able find examples in language of, say, html.hiddenfor. have tried converting c# examples have seen it's though vb methods expect different parameters. can help? the asp.net mvc site contains many tutorials both c# , vb.net. , particular example of hiddenfor : <%: html.hiddenfor(function(m) m.name) %>

PHP Define security issues? -

index.php: define("included", true); included pages: if (included !== true) header('http/1.1 404 not found'); the purpose codes disallow access directly allow if included. not sure if opens risks. not allowed override .htaccess stuck php alternative. any appreciated! a sexier way is... defined('included') or exit; that is, use correct function ( defined() ) see if value defined, , exploit short circuit evaluation . also, can use existing define rather create 1 specifically, e.g. bootstrap file may define like... define('docroot', realpath(basename(__file__))); ...in case safe use docroot . you should keeping php files besides bootstrap above document root, , ensuring site safe directory traversal attacks :)

c# - ASP.NET/MVC: Inline code -

Image
what doing wrong? how come <%= %> isn't being interpreted c#? here's code : and here renders (notice firebug display): what think going on? mvc newb here. :( and static site class: (if cannot see screenshots on page, view source , use urls <img> tags.) <%: %> starts .net v4 for pre-v4 it's equivalent <%= html.encode(...) %>

javascript - jQuery: is element.click(func) or element.attr('onclick','func()') more efficient? -

i'm populating list cloning elements it. change attrs make each item unique. need call function on click, i'm wondering if it's more efficient use new_element.click(func); or new_element.attr('onlick','func();'); new_element.attr('onclick','func();'); is: inefficient (needlessly creating new inline function string, nothing except call func , lose this reference); aggravating put complex code in, since has js string escaped; broken in ie, due bugs in setattribute . avoid. click() / bind('click') there reason.

sql - What is wrong with this query? I am not getting correct results -

what wrong query, please let me know. inner query want select top 1 group on basis of eventid. please suggest do. select top 1 * ( select e.eventid, etd.eventname, ed.eventdate [3rdi_eventdates] ed inner join [3rdi_events] e on ed.eventid=e.eventid inner join [3rdi_eventtypedetails] etd on e.eventtypeid=etd.eventtypeid e.eventid in ( select eventid [3rdi_events] eventid in (select distinct eventid [3rdi_eventdates] eventdate between '2/9/2011' , '3/11/2012') ) order etd.eventname, ed.eventdate ) temp group eventid you want 1 record per eventid, in case, use row_number() , partitioning. your 2 levels of subquery not needed, inner joins involve both tables in subqueries can filter directly in main query. the last point make date literals best written using yyyymmdd robust against regional or dateformat settings. select eventid, eventname, eventdate ( select e.eventid, etd.eventname, ed.eventdate, ...