Posts

Showing posts from February, 2013

mysql - Python: RE vs. Query -

i building website using django, , website uses blocks enabled page. right use textfield containing paths block enabled. when page requested, django retrieves blocks database , re.search on textfield. however, wondering if not better idea use separate db table block/paths, each row contains single path , reference block, in terms of overhead. i not familiar django, if understanding situation correctly, should use table. in fact kind of use db software designed , optimized for. no worries. faster. by doing search yourself, trying implement part of db logic on own. fun, certainly, not fast. :) here nice links on designing database: http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html http://en.wikipedia.org/wiki/third_normal_form hope helps. luck. :-)

How to write cucumber step definition for sign up page with ref_id in its URL? -

i trying write cucumber step definition when user visit sign page through credit referral.the url of sign page contains ref_id user id of referrer. how write step definition - when /^i visit sign page ref_id: "([^"]*)"$/ |arg1| ....????? end i figured out myself. here's web_step : when /^i visit sign page ref_id "([^"]*)"$/ |id| visit("/users/sign_up?ref_id=#{id}") end

How to create a report in oracle report builder with text displayed only at the bottom of last page -

i having boilerplate text should printed on bottom of last page of report. report builder wouldn't let me have "print object on" property "last" due reason suggested here: http://oracle.ittoolbox.com/groups/technical-functional/oracle-apps-l/error-while-setting-one-frame-property-to-last-page-914513 solution/workaround seems there in link in page isn't displayed site seems. if has workaround please me out here. edit: boiler plate text should outside margin per requirement along page number. thanks. i don't know "workaround" way i'd put object in normal print area, set print object on last page , , change margin printed @ correct location. page number still in margin, can offset page area sit on same line boilerplate text if wish. +------------------------------------------------+ | | | margin | | +-----------------------------------

CSS: set background image with opacity? -

so, can see in css references how set image transparency , how set background image . how can combine these 2 in order set transparent background image? i have image i'd use background, bright - i'd turn opacity down 0.2. how can this? #main { background-image: url(/wp-content/uploads/2010/11/tandem.jpg); } two methods: convert png , make original image 0.2 opacity (better method) have <div> position: absolute; before #main , same height #main , apply background-image , opacity: 0.2; filter: alpha(opacity=20); .

asp.net mvc and jQuery with "Microsoft JScript runtime error: Object expected" -

i've got asp.net mvc view @ end following javascript code <script language="javascript" type="text/javascript"> $(document).ready( function () { alert("this test"); }); </script>   the alert doesn't show when loading page. i've got following error: "microsoft jscript runtime error: object expected"   this section of site.master: <link href="../../content/site.css" rel="stylesheet" type="text/css" /> <link href="../../content/controls.css" rel="stylesheet" type="text/css" /> <script src="../../scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="../../scripts/jquery-ui-1.8.6.custom.min.js" type="text/javascript"></script> <link href="../../content/ui-lightness/jquery-ui-1.8.6.custom.css&

database design - Rails and Data Integrity -

i'm on fence on how implement models. right i'm using polymorphic relationships, feels wrong, though convenient. feel should making use of database level integrity enforcement added layer of security. am grandpa questioning application layer? please discuss. i did find post, not rails specific possible mysql foreign key 1 of 2 possible tables? it depends. if application 1 access database (e.g. there no other tools writing it), can verify data integrity in application code. there things, however, still best done in database. validates_uniqueness_of example here. 2 app instances may report given value unique, there may race condition. having unique index in database here practice. i handle integrity checking in app code, using indices uniqueness constraints. don't bother foreign_key relations, let activerecord handle that.

matlab - Multicolumn grouping and plotting -

i have data contain 55 columns , 24 rows. want plot every 5 columns in 1 figure. (to more specific... columns 1-5 figure 1, columns 6-10 figure 2....and on) every time try loop lost. can me? seems simple i'm still learning how use matlab. thank hep you can loop on groups of 5: my_array = zeros(24,55); % fill my_array k = 1:11 values_to_plot = my_array(:,5 * (k-1) + 1 : 5 * k); figure; plot(values_to_plot); end

java - how to Pass the value of listbox from jsp to servlet? -

my javascript is function takelistboxvalue() { document.frmpartnerlist.submit(); var selectarray = new array(); (i = 0; < partnerlist.length; i++) { selectarray[i] = new array(); selectarray[i][0] = partnerlist.options[i].text; selectarray[i][1] = partnerlist.options[i].value; } document.frmpartnerlist.<%=ratecardconstant.action_mode_parameter%>.value='<%=(new long(ratecardactionconstant.partner_domain_list_action).tostring())%>&datavalue='+selectarray; } you don't need js this. html enough. <form action="servleturl" method="post"> <select name="listbox" multiple="true"> <option value="value1">label1</option> <option value="value2">label2</option> <option value="v

Why would Eclipse not show contents of a new PHP file? -

Image
all of sudden when create new .php file, eclipse shows "error" , not let me edit it. i've create .txt file ok, renamed .php shows error again. other .php files have made before work fine. why happening , how can create .php files again? the default editor "php editor" did install aptana couple days ago. when try open file aptana says: this file has problem far, i've deleted , created again same name still has problem.

php - What is wrong with my function? (new to user defined functions) -

i trying post previous page form on it, , rather typing out code on , on again tried making function it, didnt work. in advance function postorempty($field){ isset($_post[$field]) ? $_post[$field] : ""; } $szfname= postorempty('fname'); you not return value. try add return keyword. function postorempty($field) { return (isset($_post[$field]) ? $_post[$field] : ""); } $szfname= postorempty('fname');

asp.net mvc 2 - Returning Redirect or PartialView from the same Action -

i have problem ajax.beginform. have form submit , button updates partial view. what trying accomplish use following return statements in same action. // button activates return partialview("partialviewname", data); and // submit activates return redirect(model.url); now problem redirect causes problems ajax.beginform <% using (ajax.beginform("action", "controller", new ajaxoptions { onsuccess = "onsuccess", updatetargetid = "container", insertionmode = insertionmode.replace }, new { id = "eventajaxform" })) { %> how can identify result partialview or redirecting user? normally when perform ajax call controller action redirects followed until client gets 200 status code or error. html of url redirecting placed in container div. on other hand in controller action test whether call asynchronous using request.isajaxrequest() , return partial.

How to save current state of canvas as an image in android -

i'm developing application allows user edit image , save edited image new image on sd card want current state of canvas object. please me this. it's hard answer without knowing more how image editor works. guess surfaceview, commonly subclassed allow arbitrary drawing. surfaceview provides easy way render output canvas , bitmap. bitmap bitmap = bitmap.createbitmap(msurfaceview.getwidth(), msurfaceview.getheight(), bitmap.config.argb_8888); msurfaceview.draw(new canvas(bitmap)); try { outputstream out = new bufferedoutputstream(new fileoutputstream(saved.png)); bitmap.compress(bitmap.compressformat.png, 100, out); } catch (ioexception e) { log.w(tag, e); }

Is there a Ruby site like this python.mirocommunity.org (python)? -

is there ruby site http://python.mirocommunity.org (python videos). great python site, love find equivalent ruby site ideas? maybe should start one? thankyou in advance ;-) for rails site popular: http://railscasts.com/

assembly - Asm Beginner help -

hey i`d know more asm, im totally new , dont know yet , happy if explain me or show me video. thanks. download masm32 assembler , take @ examples (for windows). it's start... for linux try http://asm.sourceforge.net/ anyway, here start: http://www.imada.sdu.dk/~kslarsen/dm18/litteratur/intelnatt.htm

syntax - Java - what is "@Override" used for? -

possible duplicate: what's “@override” there in java? i've never put "@override" before method until now. see code examples it, don't understand utility. i'd love explanation. many thanks, jdelage first, can't annotate class @override . annotation indicates method declaration intended override method declaration in superclass. you don't have annotate overriding methods but if use annotation , annotated method does not override superclass method, compiler generate error message.

c# - How can I quickly tell if a list contains only duplicates? -

there multiple related questions, i'm looking solution specific case. there array of (usually) 14 integers. how can tell if each int appears twice (i.e. there 7 pairs)? value range 1 35. main aspect here performance. for reference, current solution. written resemble spec closely possible , without performance in mind, i'm can improved vastly: var pairs = array .groupby (x => x) .where (x => x.count () == 2) .select (x => x.tolist ()) .tolist (); issevenpairs = pairs.count == 7; using linq optional. don't care how, long it's fast :) edit: there special case int appears 2n times n > 1. in case check should fail , i.e. there should 7 distinct pairs. edit: result tested ani's , jon's solutions tiny modifications , found during multiple benchmark runs in target app ani's has twice jon's throughput on machine (some core 2 duo on win7-64). generating array of ints takes long respective checks, i'm happy result. th

iphone - iOS framework to get audio in from dock connector -

how go abouts playing 'audio in' through dock connector in ios app? i'm making app myself , have no plans of putting apple store. have 30pin breakout board, , on there pins l/r audio in, can not find info on how use them? thanks as far i'm aware, officially supported option accessory using dock connector use external accessory framework , requires enrollment in made ipod program (overkill purposes). however, iphone , ipod both support line-in via headphone jack, , there plenty of apps make use of audio input. @ least provides possibilities.

java - printing all the array value -

class arrayapp{ public static void main(final string[] args){ long [] arr; arr= new long[100]; int i; arr[0]=112; arr[1]=111; for(i=0;i<arr;i++) { system.out.println(arr[i]); } } } i error, arrayapp.java:10: operator < cannot applied int,long[] for(i=0;i<arr;i++) { ^ you need use size of array, arr.length . for (int = 0; < arr.length; ++i) as of java 1.5, can use each loop if need access array data. for ( long l : arr ) { system.out.println(l); }

c# - How do I handle outlooks VSTO objects as if they are mailitems -

i have written vsto (2003) code sucessfully applies mandatory subject line changes according attachements of mail items. code written operate on microsoft.office.interop.outlook.mailitem however, need same code operate on other types such microsoft.office.interop.outlook.appointmentitem instance(infact needs work user can send have subject). assuming outlook item types have subject property, attachments property , save method, how can approach writing code works relevant interop.outlook types. i tried addressing via reflection getproperty returing null can't use getvalue on it ? mi.gettype().getproperty("subject") null ?(mi microsoft.office.interop.outlook.mailitem).subject "test subject" there doesn't seem generic outlookitem class can cast to, this. what's correct approach ? edit: clarif code starts this... void application_itemsend(object item, ref bool cancel) { if (item microsoft.office.interop.outlook.mailite

java - Xerces2-j XML Schema Attribute / Element Declaration data type -

i'm using apache's xerces2-j parse xsd. trying datatype information element / attribute declarations in xsd. here's example xsd: <xs:element name="pretzel"> ... <xs:attribute name="flavor" type="xs:string"/> <xs:attribute name="productid" type="xs:nonnegativeinteger"/> ... </xs:element> in case, i'd want datatypes of flavor , productid attributes. according w3c schema api , its xerces2-j implementation , xsattributedeclaration's getactualvctype() me want. me method returns 45, unavailable_dt . bug in xerces2-j, or understanding api wrong? if am, i'd appreciate if point me right direction here. you looking use method xsattributedeclaration.gettypedefinition(); // returns xssimpletypedefinition for simple types and/or possibly xsattributedeclaration.getenclosingctdefinition(); // returns xscomplextypedefinition for complex types. the method get

c# - Best way to remember DataGridView settings when rebinding DataSource -

i have read dgv on tab of application. let users sort column , reorder columns , select row. in part of application can edit data in dgv when go tab dgv i'd refresh data keep user's settings such column order, sort order, , row selection. right i'm setting dgv new list of items , resets of these settings. there anyway persist these after rebind data? thanks, cody store user's settings in internal object. wrap binding logic in suspendlayout() , resumelayout() calls, can apply settings dgv before the visuals redrawn. // pseudo code private void refreshdgv() { saveusersettings(); mydgv.suspendlayout(); mydgv.datasource = mydatasource; applyusersettings(); mydgv.resumelayout(); }

visual studio 2010 - relations between assembly and project in VS -

i'm bit confused. looking @ existing code here @ university, see project somehow related single assembly. i'm new in c# , read bit assemblies , modules didn't find relation between "project" logical unit , "assembly" logical unit, , wondered if convention, , if can somehow control vs. thanks, li yes, that's standard build model visual studio. 1 project produces 1 assembly. 1 solution can contain more 1 project. there no direct support creating modules, you'll have hand can run csc.exe /target:module option. there few scenarios makes sense.

Nhibernate Profiler - Shows no information other than "session"? -

so having problems getting nhibernate intergated in mvc project. therefore, installed nhprofiler , initialized in global.asax.cs file (nhibernateprofiler.initialize();). however, can see in nhprof session # , time took come up. selecting or other operations doesn't show me information connection database or information @ in of other windows such as: - statements, entities, session usage the session factory statistics shows start time, execution time, , thats it. any thoughts. do have custom log4net configuration? thinking might overwriting nhprof's log4net listener after startup. if refresh page (and hence start session*), nhprof display session start? verify hibernatingrhinos.profiler.appender.dll (or hibernatingrhinos.profiler.appender.v4.0.dll if you're using .net 4) same 1 current version of nhprof. * i'm assuming you're using session-per-request since web app.

c# - Use difference XAML pages in XBAP -

how go switching main display xaml page gets used in xbap. different want larger mode , smaller mode, same controls (some hidden). in app.xaml.cs file, can programmatically change window.xaml file want show on startup. here over-simplified example. protected override void onstartup(startupeventargs e) { base.onstartup(e); system.windows.window startupwindow = null; if(uselargemode) { startupwindow = new largemainwindow(); } else { startupwindow = new smallmainwindow(); } window.show(); } you can changing startupuri in app.xaml file going harder change @ runtime. <application x:class="main.app" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" startupuri="mainwindow.xaml" /> <!-- change --> i've haven't tried binding property in application declaration in xaml, vs 2010

entity framework 4 - Problem mapping one to many relationship with EF CTP4 -

i trying define 1 many relationship between category , project (a category can have 1 or many projects, project can have 1 or no category) public class project : entity { public virtual string title { get; set; } public virtual guid? categoryid { get; set; } public virtual category category { get; set; } } public class category : entity { public virtual string name { get; set; } public virtual icollection<project> projects { get; set; } } i have defined following mappings: modelbuilder.entity<project>() .mapsingletype(p => new { projectid = p.id, p.categoryid, p.title, p.slug, p.shortdescription, p.description, p.createdon, p.updatedon }) .totable("projects"); modelbuilder.entity<category>() .mapsingletype(c => new {

real time - Has anybody some advice on programming realtime audio synthesis? -

i'm working on personal project: creating library realtime audio synthesis in flash. in short: tools connect wavegenarators, filters, mixers, etc eachother , supply soundcard raw (realtime) data. max/msp or reaktor. i have working stuff, i'm wondering if basic setup wrote right. don't want run problems later on force me change core of app (although can happen). basically, start @ end of chain, @ place (raw) sounddata goes 'out' (to soundcard). that, need write chunks of bytes (bytearrays) object, , chunk ask whatever module connected 'sound out' module give me chunk. module same request module that's connected input, , keeps happening until start of chain reached. is right approach? can imagine running problems if there's feedbackloop, or if there's module no output: if connect spectrumanalyzer somewhere, dead end in chain (a module no outputs, input). in current setup, such module wouldnt work because start calculating sound-output mod

multithreading - Average latency of atomics cmpxchg instructions on Intel Cpus -

looking reference on average latencies lock cmpxchg instruction various intel processors. not able locate reference on topic , reference help. thanks. there few, if any, references on because there variation. depends on including bus speed, memory speed, processor speed, processor count, surrounding instructions, memory fencing , quite possibly angle between moon , mt everest... if have specific application, in, known (fixed) hardware, operating environment, real-time operating system , exclusive control, maybe matter. in case, benchmark. if don't have level of control on software running, measurements meaningless. as discussed in these answers , locks implemented using cas, if can away cas instead of lock (which need @ least 2 operations) faster (noticeably? maybe). the best references find intel software developer's manuals , though since there variation won't give actual number. will, however, describe how best performance possible. possibly proces

cascading deletes - Why does Entity Framework not properly update OnDelete in CSDL (conceptual model)? -

i updated number of tables in database use ondelete=cascade , however, when went update edmx file via update model database noticed ondelete not updated. after bit of searching, found following 'tip' http://msdn.microsoft.com/en-us/library/bb738695.aspx if update database cascade delete rule , update existing model database, entity framework add cascade delete rule ssdl not csdl. have add manually. specify cascade delete rule in conceptual model, select association on entity designer surface. then, in properties window, select cascade ondelete property. my question why case? updated 15 tables , need go , find each relationship , same update in edmx file... there easier more efficient way? in perfect world should apparently known issue baking documentation. creating, adding, modifying, , deleting objects it's in tip block before in section part. so unless designer programmer coded wants explain it, we'll have accept 

Error calling a UDF from Entity Framework LINQ query -

i'm running issue calling user defined function linq query. i'm using .net 4.0 framework , vs 2010. here snapshot of xml edmx function definition. <schema namespace="mystoredwmodel.store" alias="self" provider="system.data.sqlclient" providermanifesttoken="2008" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/entitystoreschemagenerator" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl"> <function name="regularprice" store:name="regularprice" iscomposable="true" schema ="mystoredwextension.mystore" aggregate="false" builtin="false" returntype="decimal" storefunctionname="fn_getprice"> <parameter name="productid" type="varchar" scale="40" mode="in"/> <parameter name="pricetypeid" type="varchar" scale="10" mode=&

user interface - jQuery Slider Step Attribute Not Working -

here code using create slider: $(".slider").slider({ steps: 10, animate: true, range: true, min: 0, max: 500, values: [range[0],range[1]], change: function() { range = $( ".slider" ).slider("option", "values"); $("#low-price").text("min: $"+range[0]); $("#high-price").text("max: $"+range[1]); } }); the problem step attribute not function properly. above code think each slide change value 10, stepping 1 value @ time. ideas on wrong here? the problem option name, should step not steps , this: $(".slider").slider({ step: 10, //step, singular animate: true, range: true, min: 0, max: 500, values: [range[0],range[1]], change: function() { range = $( ".slider" ).slider("option", "values"); $("#low-price").text("min: $

div boundary jQuery -

http://jsbin.com/ofudi4/3/edit what code can test yourselves. now question if have div-tag around , frame. how make #moveme move inside frame div? checking boundaries after each move, figure doesn't move outside frame. anyone how to? edit: adding code link. $(document).keydown(function(e){ // left if (e.keycode == 37) { $("#moveme").animate({marginleft: "-=100px"}, {queue:false}); return false; } // top if (e.keycode == 38) { $("#moveme").animate({margintop: "-=100px"}, {queue:false}); return false; } // right if (e.keycode == 39) { $("#moveme").animate({marginleft: "+=100px"}, {queue:false}); return false; } // bottom if (e.keycode == 40) { $("#moveme").animate({margintop: "+=100px"}, {queue:false}); return false; } }); html <body> <div id="moveme"></div

Weird value when I declare a string in C -

i want declare string hold 4 chars char st[4]; memcpy(st,"test",4); but when print st ... have "test" , other symbols printed after - wrong in ? thanks lot c strings, "test" string literal, nul-terminated, meaning last character '\0': {'t', 'e', 's', 't', '\0'} you need use st[5] , , copy 5 characters, have room (and include) nul. is, you're not including in copy. aftewards, st looks like: {'t', 'e', 's', 't', x, x, x ... '\0'} when print, c keeps reading gibberish values coincidentally in memory (x'es above) until finds nul. the best solution eliminate memcpy , , let compiler figure out size initialization: char st[] = "test"; sizeof(st) 5.

objective c - Sort Array of NSString By Custom Method -

how go sorting array of nsstring objects custom method. example have method -(int)calculatevalue:(nsstring *)astring i sort array descending order based on returned value method. example have array nsmutablearray *array = [[nsmutablearray alloc] initwithobjects:@"apple", @"bee", @"super", nil]; now if call calculatevalue each of strings might return values such as. "apple" = 15, "bee" = 21, , "super" = 3. i'm trying sort array based on returned value each nsstring calculatevalue method. sorted array like [bee, apple, super] see -sortedarrayusingselector: . you'll pass in selector @selector(mycomparisonmethod:) . comparison method should return nscomparisonresult nsorderedascending, nsordereddescending, or nsorderedsame.

WPF Control Similar to Accordion/Panels, with a single separating clickable bar -

i'm trying find control, or means write 1 works similar how accordion control works. how should work in detail. if have window showing view, , i'd want change alternate view, there bar runs along right side of window. bar similar how panel header works in panel control. example, display "view 2" in text on bar, indicating if user clicks on bar view 2 displayed. upon clicking bar, slide right-to-left, across window, revealing view 2 behind it. upon reaching left side of screen, text on bar change , "view 1", indicating if user clicked again, returned view 1 bar slid across screen returning it's original position on right. basically view similar how xbox displays views. here example of doing vertically. should able modify work horizontally. http://asimsajjad.blogspot.com/2009/06/jquery-accordion-using-wpf-animation.html in system.windows.controls.layout.toolkit.dll there accordianitem control this.

javascript - Initialize jQuery Plugin property with a function instead of a static property? -

i initialize jquery plugin function instead of static property. works this: $("#sliderprice").slider({ step: 1, smooth: true, limits: false, scale: ['24h', '48h', '3&nbsp;days', '1&nbsp;week'] }); what i'm trying this: $("#sliderprice").slider({ step: 1, smooth: true, limits: false, scale: function(){ return custom array; } }); is somehow possible? i'm using slider egor khmelev. you can self-invoke function without modifying original code: $("#sliderprice").slider({ step: 1, smooth: true, limits: false, scale: (function(){ return [5,4,3,2,1]; }()) }); you can within self-invoking anonymous function. create, modify or map existent array , return it. outer parenthesis aren't necessary, it's convenient way tell looking @ code, going on there.

Visual Studio's debugger doesn't display more than 99 elements of a C++ container -

i trying inspect elements of std::set container in c++ app, visual studio 2005/2010 displays first 99 elements. how configure ide show elements? thanks.. fwiw, ability out-of-the-box vs2008 seems have gone away in vs2010. tried in both vs2008 , vs2010: std::set< int > s; for(int = 0; < 400; ++i) { s.insert(i); } setting breakpoint afterwards , using locals or watch panels, if expand s debugger shows me 400 elements below in vs2008 first 100 in vs2010. i don't remember configuring in vs2008 make happen. fwiw, c-style arrays , general pointers, can tell debugger how many elements show. p,200 show 200 elements *p onwards. doesn't seem work std::set objects, though. :(

Ant EXEC failing to run bash script -

i trying use ant run bash script. ive found exec directive tool job i created bash script test.sh , in ant target added: <project basedir="."> <property name="temp.deployment.dir" value="temp_deployment_dir"/> <property name="temp.dir" value="temp_upload_dir"/> <property name="src.dir" value="www"/> <property name="js.dir" value="${src.dir}/public/js"/> <property name="css.dir" value="${src.dir}/public/css"/> <property name="img.dir" value="${src.dir}/public/images/"/> <target name="clean"> <delete dir="${temp.dir}"/> </target> <target name="update-statics"> <mkdir dir="${temp.dir}"/> <!--todo: add statics in --> </target> <target name="dep

Autofac reporting circular dependencies that don't exist -

i added autofac large, existing application manage di. in process, replaced singletons single instance managed container gets injected dependent's constructor. in cases, however, circular dependencies had broken. easiest way found take advantage of onactivated event. intend modify these types eliminate circular dependencies, risk of changing them great. to types involved in circular dependencies, added method called resolvecirculardependencies (this makes obvious method used temporarily , purpose of resolving these cycles). method gets called in onactivated event. so code looks this: public class servicea { private serviceb otherservice; public servicea() { ... } public void resolvecirculardependencies(serviceb other) { this.otherservice = other; } public void somemethod() { ... this.otherservice.somemethod(); ... } } public class serviceb { private servicea otherservice;

How do you center divs using only CSS -

i use way center divs using table , css: <table width="69" border="0" align="center"> <tr> <td width="59"> <div style="position:relative;"> <div style="position:absolute; text-align:left; top: 100px;">div2 content goes here</div> <div style="position:absolute;text-align:left;">div content goes here</div> </div> </td> </tr> </table> here's sample: http://2slick.com/div_center.html notice how expanding browser doesn't change centering of divs. know way similar using css , less code? give div fixed width , set both left , right margins auto. .centereddiv { width: 800px; margin-left: auto; margin-right: auto; }

emacs - emacs23 / elisp: how to properly autoload this library? -

i upgrading emacs23. find emacs.el loads more slowly. it's own fault really... have lot of stuff in there. so trying autoload possible "required" emacs.el. i have module exposes 12 entry points - interactive functions can call. is correct approach have 12 calls autoload in order insure module loaded regardless of function call? there problems approach? present performance issues? if not that approach, what? what want autoloads generated automatically, .emacs file remains pristine. packages have ;;;###autoload lines in them already, , if not, can add them. to manage this, can put packages in directory, ~/emacs/lisp , , in there have file named update-auto-loads.el contains: ;; put path load-path automatically ;;;###autoload (progn (setq load-path (cons (file-name-directory load-file-name) load-path))) ;;;###autoload (defun update-autoloads-in-package-area (&optional file) "update autoloads files in diretory containing file.&

resize - Java Layout Managers -

what benefits of using existing layout manager opposed writing listener handles resizing functions? instance, needed arrange buttons in grid , center grid: int h = component.getheight() / 11; int w = component.getwidth() / 9; int offsetx = w; int offsety = h; int x = (2 * column) * w - offsetx; int y = (2 * row) * h - offsety; setbounds(x, y, w, h); instead of fumbling around layout manager wrote small bit of code activated buttons whenever jpanel resized. if use layout manager, more cumbersome write code arrange , if add component jpanel, things more complex opposed adding few additions or subtractions. so given this, there benefits using layout manager in situation or few customized lines easier use , maintain? your code mimicking gridlayout . setlayout(new gridlayout(11, 9)); // add components ... // profit to center it: jpanel outerpanel = new jpanel(new borderlayout()); jpanel gridpanel = new jpanel(new gridlayout()); outerpanel.add(gridpanel, borderlayou

upload - Connecting to WebDAV with PHP? -

i'd connect webdav using php, , able upload files, etc. however, cannot figure out how connect it. imagine simple opening socket , sending proper headers/commands, don't know i'd need send. i'd without libraries/classes. can point me in right direction? yes, connect webdav server other http server have talk webdav. but, since there enough difference between http , webdav need handle yourself, better off using webdav client or library. http://sabre.io/dav/davclient/ webdav extended http lingo additional verbs propfind, proppatch, report etc. provides support querying, setting , fetching meta-properties of webdav resource via propfind , proppatch using xml payload. while many aspects should similar http notions. there number of small changes / nuances differs http. this above brief introduction webdav can bit misleading read details on webdav rfc , info . see following typical client implementation: php idisk\webdav client

some issue with nested tab while trying to implement jquery ui tab with back/forward/refresh button support -

i'm having problems browser history (using "back" , "forward" buttons) jquery's tab plugin. combined jquery ui tab , jquery bbq: button & query library plugin this. i think problem may deal nested tabs. you can find full code @ http://jsfiddle.net/nqgc8/ if test this, you'll see tabs @ top works fine: can navigate of tabs , go , forward @ point. not case nested tab. nested tab can found inside tab 3. what need make work nested tabs? the following snippets show point: <div id="tabs"> <ul> <li><a href="#tabs-1">tab 1</a></li> <li><a href="#tabs-2">tab 2</a></li> <li><a href="#tabs-3">tab 3</a></li> </ul> <div id="tabs-1">...</div> <div id="tabs-2">...</div> <div id="tabs-3"> <div id="tabs2"> <ul>

sql - How can I take values From a table which is output of a function in a stored procedure -

this statement inside stored procedure gives table output contains date dt: select [dt] dbo.fngetdatesforweekdays(@dafromdate, @datodate, @wkdays) dat how can take date values 1 one? if need process them 1 one you'll need use cursor , loop through cursor: declare @dt datetime declare date_cursor cursor select [dt] dbo.fngetdatesforweekdays(@dafromdate, @datodate, @wkdays) dat open date_cursor fetch next date_cursor @dt while @@fetch_status <> -1 begin --do processing here fetch next date_cursor @dt end close date_cursor deallocate date_cursor just whatever want each of dates comment , you're go.

jquery - How do I get a looping animation to pause when rolled over? -

this have managed far, seems no 1 can me last couple of functions: <script type='text/javascript''> $(document).ready(function () { swing(); }); function swing() { //making div swing $('#share').animate({right: '210px'}, 1000, function(){swingback()}); } function swingback() { //making div swing $('#share').animate({right: '220px'}, 1000, function(){swing()}); } $('#share').mouseenter(function() { // stop animation if mouse enters div $(this).stop(); }).mouseleave(function() { // continue animation once mouse has left div swingback(); }); </script> // flag manage animation var resume = false; $(document).ready(function(){ swing(); }); function swing(v){ // if animation stopped mid-swing resume var total = v ? 210-math.abs(v): 210; $('#share').animate({ right: '+=' + total + 'px&

jquery - JqueryUI Position plugin: collision applied to a container? -

can recommend way use jqueryui position plugin collision logic applied container div rather window viewport? you can't. jquery ui position demo uses <iframe> element achieve same effect.

iphone - logical Operators in objective C? -

logical operators in objective c language? random stab in dark @ you're asking: yes, objective-c has logical operators. same in c && and || or ! not so expression !a || b can read "(not a) or b"

haskell - What are arrows, and how can I use them? -

i tried learn meaning of arrows , didn't understand them. i used wikibooks tutorial. think wikibook's problem seems written understands topic. can explain arrows , how can use them? i don't know tutorial, think it's easiest understand arrows if @ concrete examples. biggest problem had learning how use arrows none of tutorials or examples show how use arrows, how compose them. so, in mind, here's mini-tutorial. i'll examine 2 different arrows: functions , user-defined arrow type myarr . -- type representing computation data myarr b c = myarr (b -> (c,myarr b c)) 1) arrow calculation input of specified type output of specified type. arrow typeclass takes 3 type arguments: arrow type, input type, , output type. looking @ instance head arrow instances find: instance arrow (->) b c instance arrow myarr b c the arrow (either (->) or myarr ) abstraction of computation. for function b -> c , b input , c output. myarr b c

actionscript 3 - Is there a reason a function won't accept a number higher than 4 in AS3? -

you know reason why function won't accept number higher 4? this i'm doing. works 0-4, once hit 5 or higher, "a term undefined , has no properties." if put number 5 in there, works fine, it's not issue xml.. reason function won't accept higher 4. weirding me out..... can't see explanation it. loadepsynopsis(5); function loadcharsynopsis(charnumber:number):void { synopsisbox.titletext.text = bxml.characterlist.character[charnumber].charactername; synopsisbox.descriptiontext.text = bxml.characterlist.character[charnumber].characterdesc; } the value of "bxml.characterlist" 5 characters long, indexing higher returning "null", has no "charactername" property.

what is the date after 30days from current date using javascript -

how can find date 30 days after current day? here 30 fixed value. how can pass dynamic value function.. days = document.getelementbyid('day').value; var d = new date(); d.setdate(d.getdate() + days); it not working..it gives wrong answer you can access time in javascript using date class. try this: var time = new date(); time.setdate(time.getdate()+30); alert(time); edit added test jsfiddle here in case wants test it. sorry forgot adding!!!

html - I'm using button_to with :confirm in my html_options, but no confirmation dialog is appearing (in FF & Chrome) -

i'm creating button this: <%= button_to "remove", { :controller => 'notes', :action => 'destroy', :note_id => @note.id },:confirm => "are sure?" %> this output: <form method="post" action="/notes/destroy?note_id=436" class="button_to"><div><input data-confirm="are sure?" type="submit" value="remove" /><input name="authenticity_token" type="hidden" value="zofuwrh9pllfy+2uqv2qmc9ym20oij3e1zvw/wel/q8=" /></div></form> the button works fine except there's no confirmation popup when button clicked. doing wrong? reading. are using rails 3.0 or above? if include javascript files - in header: <%= javascript_include_tag :defaults %> <%= csrf_meta_tag %> here walk-through: http://www.simonecarletti.com/blog/2010/06/unobtrusive-javascript-in-rails-3/

WPF Contacts Manager -

i need ready-to-use wpf contacts manager source code (possibly in c#). incredibly, web seems poor on side. i've found these links interesting implementation: http://www.johnstagich.com/wpf/publish.htm -> no source code available http://www.paulstovell.com/wpf-model-view-presenter -> source code broken link undetermined time... i don't need fireworks... implementation basic contacts fields, able manage thousands of contacts , embedded search engine. i tempted use microsoft lightswitch, it's in beta 1, , intrinsic limitations of silverlight made me change road. any suggestions? although not answer looking try using karl shifletts xaml powertoys build simple data entry forms in wpf.

Check all checkbox in gridpanel in extjs -

i check of checkbox made ext.grid.checkcolumn in gridpanel, may know if there easy way this? have try add class checkbox(ext.grid.checkcolumn) seem not work. thanks much! if you're rendering store field checbox column, have set field true records in store. store.each(function(rec){ rec.set('field', true) }) never try change grid cell's value directly, change via store's corresponding record. update : if have many records, use this: store.suspendevents(); // avoid view update after each row store.each(function(rec){ rec.set('field', true) }) store.resumeevents(); grid.getview().refresh();

flash - What is <rs: in Flex/Action Script 3? -

i found <rs:page> <mx:image source="@embed('image1.jpg')" /> <mx:label x="400" y="40" fontfamily="verdana" fontsize="9" color="#cccccc" text="butn" /> <mx:label left="100" right="120" y="90" color="#ffccdd" textalign="left" text="label text" /> </rs:page> in mxml file. means? edit: 1 <?xml version="1.0" encoding="utf-8"?> <mx:application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:filters="flash.filters.*" xmlns:rs="com.mybooks.book.*" layout="absolute" backgroundcolor="#333333" creationcomplete="oncreationcomplete()" viewsourceurl="source/index.html" width="600" height="330"> it means custom namespace prefix rs defined. definit

wix - Should the Template string in the ActionText for InstallFiles be overridden to match the installer's content -

i have installer installs 40 files , 2 directories. installer based on wixui_installdir "template", i've included of ui definition within wxs project. <!--uiref id="wixui_installdir"/--> <ui id="wixui_installdir"> <textstyle id="wixui_font_normal" facename="tahoma" size="8" /> <textstyle id="wixui_font_bigger" facename="tahoma" size="12" /> <textstyle id="wixui_font_title" facename="tahoma" size="9" bold="yes" red="255" green="255" blue="255" /> <textstyle id="wixui_font_title_normal" facename="tahoma" size="8" red="255" green="255" blue="255" /> <property id="defaultuifont" value="wixui_font_normal" /> <property id="wixui_mode" value="installdir" />

windows mobile - Problem in Loading NK.bin -

i have 1 weired problem our nk.bin. loading in 1 device , not in other device , both device same. can problem ..?? while loading not giving response flickering , all... if using same nk.bin file there few options: your bootloader of configuration files (if device uses them) between 2 devices different the hardware on non-working device different (a different revision maybe). the board (or connection it) bad. sounds you're oem. check cables, if still fails, send board manufacturing tests - it's has part failure.

objective c - Problem retrieving data from array iphone? -

i declared nsmutablearray , assign object when retrieving object gives memory location.here code. nsmutablearray *arrcondinum = [[nsmutablearray alloc] init]; [arrcondinum addobject:@"2"]; [arrcondinum addobject:@"4"]; [arrcondinum addobject:@"6"]; [arrcondinum addobject:@"8"]; for(int = 0;i<[arrcondinum count];i++){ nslog(@"array number %d",[arrcondinum objectatindex:i]); } output gives array number 20820 array number 20836 array number 20852 array number 20868 you add string in array, display it, have use %@: nslog(@"array number %@",[arrcondinum objectatindex:i]); in code (%d), display address of object. %@ display description of objc object (return of -descriptionwithlocale: or -description )

system.net.webexception C# Vista -

i have object of type webclient connects web server. when run code under vista system.net.webexception socket error. i bit bewildered other program used sockets directly (port scanner) worked under xp , failed work under win7. thought might case in current app, since used webclient - high level class - bewilderment justified) problem solved adding modifying scope in excepion's firefall. thanx time.

javascript - Check if an HTML element with the same id exists -

can done using javascript? if you're trying find out if more 1 element share 1 id, jquery $('[id=blah]').length - return count of elements id equal 'blah'. see the fiddle . if it's greater 1 have duplicate id. edit: i've tested in chrome, ff , ie6, , of them show there 2 elements same id. agree it's bad form have more 1 element share id, code work.

winforms - C#: Get a list of customers and share it on TWO Views -

i have list of customers shown @ top menu every customername menuitem. want have same (same = not want reload data database ) customers in menu. both menus in 2 different usercontrols. in every usercontrol can stuff on customer-menu. how design both menu`s/usercontrols/presenter customerlist 1 time database? i using winforms mvp pattern. you can load customerlist in static list , share list it's sort of caching mechanism.

iphone - Trying to place a UINavigationController as one of the tabs inside a UITabBarController -

i'm writing iphone app has 3 tabs. first 2 uitableviews, third tab want uinavigationcontroller, because used editing list of recipes. i've tried every combination of nibs think of work having problems such as: once click on editing tab, click other tabs, display still shows parts of editing tab such navigation bar when click on editing tab, can see blank navigation controller no contents or title, though nav controller inside tabs has 'nib name' , 'class' set in inspector i know best way of going abouts doing this: putting editor (which think should navigation controller?) inside tab. there glaring i'm missing? thanks guys i use editing buttons navigation controller , woks well, option. if want navigation controller 1 view need hide switching tabs self.navigationcontroller.navigationbarhidden = yes; or no and since don't use ib (it black box) recommend allocate (title, buttons, etc.) navigation controller manually. works gr

c# - Restore a Database Programatically (SQL Server) -

i found link shows great example of backing , restoring sql server database. however, sql server uses windowsauthentication , not require username , password. able this, turned line srvconn.loginsecure = false; srvconn.loginsecure = true; i expecting connect succesfully server. however, example returns exception saying unable connect server. can me please? have learn application me able apply same concept project i'm working on. thank much. first of if want enable remote connection server (i'm not sure if you're after), try this: http://support.microsoft.com/kb/914277 . want make sure mixed authentication option enabled.

android - setBackgroundColor() in Webview is not working -

i have created webview transparent background. browser = new webview(activityactivate.this); browser.setbackgroundcolor(0); browser.getsettings().setjavascriptenabled(true); browser.addjavascriptinterface(new javascriptinterface(), "javainterface"); browser.getsettings().setjavascriptcanopenwindowsautomatically(true); browser.getsettings().setsupportzoom(true); browser.loaddatawithbaseurl("https://checkout.google.com", form, "text/html", "utf-8", null); llpaymentbuttons.addview(browser); here javainterface should change color of background when html form submitted , checkboxes pass test. /** * interface javascript communication */ private class javascriptinterface { //this in fact used javascript @suppresswarnings("unused") public boolean checkboxpass() { if( acceptsconditions() && acceptslicense() && acceptsrefundpolicy() ) { browser.setbackgroundcolor(col

c# - uri manipulation class .net -

is there decent oss uri manipulation class .net? please dont suggest bcl uri class, or other manner of manual hacks around useless thing. i'm looking robust library handle taking uris of different forms (relative, absolute, with/without query string etc) lets me access , manipulate fragments in elegant way. thanks is system.uri bad? use extensively, along uribuilder, , have never had issues it...

asp classic - How to ignore errors from nested stored procedures in a SQL Server 2000 procedure called from ASP -

i working on "classic" asp application sql server 2000 database. we have stored procedure (let's call sp0) calls other stored procedures (let's sp0.1, sp0.2 ...) call stored procedure called spx. all procedures generate errors when goes wrong using raiserror() . we want able launch sp0 parameter @errorsinresultset change behaviour : instead of "re-raising" errors far, each sub-procedure log errors in temporary table #detectedproblems , return @ end. adding errors temporary table not problem, can not figure out how ignore errors generated nested stored procedures. i have done far : exec @rc = [sp0.1] @errorsasresultset = @errorsasresultset if (0 <> @@error) or (0 <> @rc) begin if (@errorsasresultset <> 0x1) begin raiserror('sp0.1: error table tests in db %s.%s', 16, 1, @@servername, @db) end goto failure end this works fine, still generate errors lowest spx

.net - Why Color.FromArgb(255, 255, 255, 255) != Color.White? -

why color.fromargb(255, 255, 255, 255) not equal color.white ? there built-in way compare a,r,g,b values , not color names? thanks. see http://msdn.microsoft.com/en-us/library/e03x8ct2(vs.85).aspx this structure comparisons other color structures. compare colors based solely on argb values, should use toargb method. because equals , op_equality members determine equivalency using more argb value of colors. example, black , fromargb(0,0,0) not considered equal, since black named color , fromargb(0,0,0) not.

c# - Can you databind an asp.net gridview to a field in a base class? -

i have following classes (pseudocode): item ( int field1 ) itemdetail : item (int field2, string field3) if set itemdetail datasource asp.net gridview: grid.datasource = new list<itemdetail>(); grid.databind(); can use field1 in gridview? if so, correct databinder syntax? following code blows trying cast item: <%# databinder.eval(container.dataitem, "field1") %> thanks in advance help. edit: , i'm moron. had copied gridview , calling rowdatabound event handler different grid... sorry have wasted everyones time, there info here regardless if has same question. in end, public properties of base class binding correctly. thanks! if base class property public, shouldn't have issue long you're initializing in child constructors. also, i'm not sure if example binding pseudocode or not, have bind grid ilistsource, ienumerable, or idatasource, need collection, list, iqueryable, etc. of itemdetails.

What are some good PHP performance tips? -

i've heard of performance tips php such using strtr() on str_replace() on preg_replace() depending on situation. as far using functions on others, , code style, of performance tips know of? edit: i'm not talking use of things make code less readable, !isset($foo{5} on strlen($foo) < 5 , i'm talking things using preg_ functions on ereg_ functions regex. edit: reason ask not nitpicking on when optimize, general idea of tends efficient in limited set of alternatives. instance, checking if mysql statement returned error arguably better practice suppressing errors begin with. this question vague. when want optimize script, first check database , try optimize algorithms. there aren't many pure php performance tips going matter. let's see : concatening variables faster putting them in double-quotation mark string. $var = 'hello ' . $world; // faster $var = "hello $world"; // or $var = "hello {$world}"; yes, it&#