Posts

Showing posts from June, 2014

How to manipulate jQuery calendar -

i short of idea of how can achieve following: i need customize jquery calendar following criteria: depending on dates retrieve database, need deselect or change color of display of dates on calendar upon clicking on date need able readings of date monday friday of date week. e.g click on 12 feb, must able supply date 7 13 if click range of dates, must able give me number of business work days, e.g if select 8 feb , 10 feb, must able give me 3 days. can have guide of how above. thanks. you need find out first, component use. i suggest fullcalendar it's has built in of points, , plenty more . fullcalendar jquery plugin provides full-sized, drag & drop calendar 1 below. it uses ajax fetch events on-the-fly each month , is configured use own feed format (an extension provided google calendar). visually customizable , exposes hooks user-triggered events (like clicking or dragging event). it open source , dual licensed under mit or gpl version 2...

c# - .net XmlSerializer on overridden properties -

i have base class abstract property: public abstract int id {get;set;} now, have subclass, xmlserialized. so, has: [xmlelement("something")] public override int id { { //... } set { //... } } i cannot move xmlelement attribute baseclass, since every subclass have different xml elementname. now, when deserialize class following error: member 'subclass.id' hides inherited member 'baseclass.id', has different custom attributes. what can do? serialization , deserialization of derived types works when overridden properties have [xmlelement] , [xmlattribute] attributes, adding [xmlignore] attribute. the base class can made abstract can never instantiated , therefore serialized or deserialized. [serializable] public abstract class base { [xmlignore] public abstract int32 id { get; set; } }

HTML/JavaScript: mouseover effect for image maps? -

i'm trying out nonprofit doing website. want (ugh) logo serve html image map. in other words, when click on different parts of logo, you're directed different web pages. also, however, want mouseover effects: when mouseover particular portion of image map, piece of graphic should highlighted. if logo simple, slice rectangles , attach mouseover , click events appropriate rectangles. complexity of logo, not possible, however. has done without flash? i'm not flash developer looking difficult task in html/javascript. any ideas? thanks! you need handle mouseover event of <area> tag.

sql - InnoDB and creating relationships for table - one will not join -

Image
this database: -- host: localhost -- generation time: feb 04, 2011 @ 01:49 pm -- server version: 5.0.45 -- php version: 5.2.5 set sql_mode="no_auto_value_on_zero"; -- -- database: `myepguide` -- -- -------------------------------------------------------- -- -- table structure table `channel1` -- create table if not exists `channel1` ( `id` mediumint(255) not null auto_increment, `channel` varchar(255) default null, primary key (`id`), key `channel` using btree (`channel`) ) engine=innodb default charset=latin1 auto_increment=4 ; -- -- dumping data table `channel1` -- insert `channel1` (`id`, `channel`) values (1, '<a href="channel/bbcone.php">bbc one</a>'), (3, '<a href="channel/itv1.php"><i>itv1</i></a>'), (2, '<a href="channel/itv2.php"><i>itv2 </i></a>'); -- -------------------------------------------------------- -- -- table stru...

Handling Java stdout and stderr in Perl -

i trying run java program perl script. avoid using system.exit(1) , system.exit(-1) commands in java. printing stdout , stderr java. in perl script, reading java's stdout , using line line output. how print stderr , fail if ever see stderr? have far: my $java_command = ...; open(data, ">$java_command"); while (<data>) { chomp($_); .... .... } look @ perl documentation faq how-can-i-capture-stderr-from-an-external-command . brief details capturing , discarding stdout , stderr.

wpf controls - How to retain default hover effect for my custom WPF RepeatButton -

when create custom wpf control, retain usual default appearance , effects. example, includes default blue hover on button. i have created custom tabcontrol scrollable tabs. whatever reason, repeatbutton on each side (i.e. left , right scroll arrows) have no hover effect. have found several tutorials tell me how create own hover effect controls, unfortunately these examples replace background different color (and looks different having animation fades in transparent blue while keeping underlying background). how can hover effect? there way can access standard hover effect (might storyboard?)? edit: have discovered if remove custom style put on repeatbutton, default hover effect. perhaps question -- how did destroy hover effect, , how mildly modify appearance without destroying it? below style borked hover effect- <style x:key="tabscrollerrepeatbuttonstyle" targettype="{x:type repeatbutton}"> <s...

C# manipulating video -

i want take folder of pictures, , turn slideshow video music in background. i have no idea how this, or help, cos isnt kind of thing can search in google. idk if there api's it, or if can done in c#. maybe ill have move project c++ or something, first need know hell start. thanks. this kind of thing can search in google. try "creating avi files in c#" , pick 1 of answers. recommend this one personal experience. creating avi file pretty easy - set frame rate , dump in bunch of bitmap files, add wav or mp3 file (or files) audio, , that's it. the avi file can played is, or compressed mpeg or whatever (although won't size compression slideshow-type video file, don't need much).

android - shaking between images inside Java? -

so have viewflipper links .xml file , when shake it, switches images, simple. want switch images inside java. how go this? here main java package www.straightapp.com.shakertest.html; import android.app.activity; import android.os.bundle; import android.util.log; import android.widget.viewflipper; public class shakertest extends activity implements shaker.callback { private shaker shaker=null; viewflipper flipper; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); flipper=(viewflipper)findviewbyid(r.id.flipper); shaker=new shaker(this, 1.25d, 500, this); } @override public void ondestroy() { super.ondestroy(); shaker.close(); } public void shakingstarted() { log.d("shakerdemo", "shaking started!"); flipper.shownext(); } public void shakingstopped() { log.d("shakerdemo", "shaking stopped!"); } } thanks -chistian ...

android - Getting Reference to Calling Activity from AsyncTask (NOT as an inner class) -

is @ possible, within asynctask not inner class of calling activity class, reference instance of activity initiated execution of asynctask? i aware of this thread , doesn't address how reference calling activity. suggest passing reference activity parameter asynctask constructor, however, it's reported doing result in nullpointerexception. so, i'm @ loss. asynctask provides robust functionality, , don't want have duplicate inner class in every activity wants use it. there must elegant solution. the "elegant solution" try passing parameter (to constructor or execute() ) , see if works, rather assuming person asked previous question (then answered own question twice) knows doing. can think of nothing intrinsic asynctask cause activity bad constructor parameter , every other object fine. now, haven't passed activity (or other context ) parameter asynctask , because asynctasks private inner classes. in fact, fact want public asynctas...

java - Request attributes in jsf / icefaces behaves strange (survive request end) -

i have following code in listener method: facescontext.getcurrentinstance().getexternalcontext().getrequestmap().put("time", new date()); when button clicked following code executed system.out.println(facescontext.getcurrentinstance().getexternalcontext().getrequestmap().get("time")); one except "time" null when listener not executed while processing current request, but: seems "time" object survives request processing. when "time" has been set in past stays there... can explain this? thanks. found answer here: http://wiki.icefaces.org/display/ice/compatibility scopes by default, icefaces 1.x operated under referred extended request scope . in nutshell, extended request scope refers behaviour new request associated change in view. means ajax requests occur within existing view not treated icefaces new requests. request not considered new request unless results in new view request-scoped beans not recreated until ...

c# - Display gridview in new window -

just bit of advice needed in terms of how should handle current scenario: i have web page searches products/category information results of @ present displayed in gridview on same page. however, said gridview bit of beast , such, have page user searches for, button pressed , subsequent gridview displayed in new window. ultimately, user able make multiple searches new windows can have multiple gridviews containing different data sets. my current thinking create session variables can pulled through onto 'the gridview page'. having said that, i'm not sure work if multiple searches created? i thinking might able create said 'gridview window' using javascript concern here potential loss of functionality of gridview i.e. paging, sorting, editing, etc. does have thoughts or theories on this? "best practise"? thoughts appreciated , taken on board. ps: being developed in .net, using c# , linq. pps: i'm noob gentle!! there no need of ...

java - download jdk1.5.0_18 source code -

i'm looking jdk source code java 1.5 update 18 (on win xp). don't want install jdk, don't want source code entire vm, source jdk libs, when navigate java class in eclipse, opens source code. is possible download src.zip (or zip contains src.zip)? don't want install new jdk/jre access src.zip i'm concerned have undesirable side-effects such modifying java_home. thanks, don the best place go old versions of java stuff archive page. jdk 1.5.0_18 there. however, don't think possible download just source code zip file. hey, friend download relevant jdk , copy onto cd/dvd you. edit re concern environment variables being changed. installing jdk not modify java_home environment variable or other environment variable. indeed, jdk / jre installation instructions explain need update java_home , path manually. sun have been careful allow install multiple jdk/jres side-by-side. thing of nature gets changed installer version of java used br...

Windows Phone 7 Developer -

if plan deploy application windows phone 7 , i'm developer, know need register in rtdeveloper.windowsphone.com register windows live. problem that, whenever try finish signing information singapore literally philippines, won't load next page. developers windows phone 7 have limitation on country deploy market with? from faq on registration there's no mention of restrictions on countries. on page have problem ? step 1: choose account type step 2: enter personal details step 3: enter profile information step 4: enter payment information step 5: confirmation page i think can access forum windows live id, there's 1 specific registration: http://forums.create.msdn.com/forums/88.aspx

Sending and getting data from basic HTML -

is there way send data 1 html page using basic html without using javascript , php? it's easy " send " data: <a href="my_other_page?data1=1234567">send</a> but there no way receiving page parse without server-side application or javascript. (or flash, or java applet, or activex control....)

In Rails - How to have one query that has multiple queries? -

in have 3 models here: projects threads (project_id) thread_participations (thread_id, read boolean) right have list of user's projects, , list shows how many threads unread per project. huge problem here if user has several projects (which users do) causes db hit several queries, 1 per project. i use rails build query, 1 db hit, returns unread count each of user's project. here's use today in view: <% @projects.each_with_index |project, i| %> <%=project %>: <%= thread.unread(current_user,project).count %> <% end %> and in thread model: scope :unread, lambda { |user,project| includes(:project,:thread_participations).where(:project_id => project.id, :thread_participations => {:read => false, :user_id => user.id}) } any suggestions on how this? model should live in? maybe user's model since not project or thread specific? thanks there couple of ways structure query, here one. you can perfo...

c# - How to make an extension method on an enumeration type still applicable even though the enum object is null? -

scenario: the create action method pass uninitialized instance of person view . view show dropdown control "--select--" highlighted. since property sex nullable, cannot invoke extension method. how fix problem? 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; } } } controller: public actionresult create() { var p = new person(); viewbag.selectlist = p.sex.value.getselectlist();//source of error! return view(p); } partial view: @model mvcapplication1.models.person @html.hiddenfor(model => model.id) <div class="editor-label"> @html.labelfor(model => model.name) </div> <div class="editor-field"> @html.editorfor(m...

html - How do I tell if external javascript is either not running or not echoing? And why -

the code below works on 1 page, not page (the place should - same place on other page) - blank. this code displays facebook button, , copied verbatim facebook website. code there - checked "view page source" in firefox, isn't doing anything. i can put script, "find on facebook" button, either directly above or below code, , shows okay. <script src="http://connect.facebook.net/en_us/all.js#xfbml=1"></script><fb:like href="http://www.facebook.com/pages/[our name]/[our number]" layout="box_count" show_faces="false" width="50"></fb:like> update if use iframe code instead of xfbml code from: http://developers.facebook.com/docs/reference/plugins/like/ works on both pages (but can't format right - wordpress doesn't iframes in widgets). going on? update when disable wordpress facebook share plugin problem goes away. there may problem double initialization of face...

vim - shortcut of making windows equal in height -

i reading byte of vim. here problem encountered. i using vim in macosx. (command line not gui) in book, "want make windows 'equal' in height again? press ctrl-w =" have tried that, not working. and, made sound (which believe indicates there error) in addition, when have looked @ mac vim page window, did found command. tried again---still not work in command line mode, but did works in gui mode (macvim) does have ideas solve that? lot! you wouldn't happen pressing ctrl-w ctrl-= , you? i tried ctrl-w = in vim in terminal, , worked. ctrl-w ctrl-= didn't work in terminal, did in macvim.

iphone - What is a good way to animate UIViews inside UITableViewCell after a callback? -

we couldn't find way animate uiviews inside uitablecell action callback. suppose in scenario click on button on uitableviewcell , fires off asynchronous action download picture. suppose further when picture downloaded want uiview in cell animate picture give user visual feedback new presented. we couldn't find way track down uiview invoke beginanimation on because original cell user clicked on might used row due nature of cells being reused when scroll , down in table. in other words can't keep pointer uitableviewcell. need find way target cell , animate if row visible , don't animate if row scrolled out of range. keep cell object different object being animated cell holds uiview. when animation callback occurs check make sure uiview still exists and, if does, animate changes. when cell object gets bumped off screen , recycled, release uiview have been animated , create new one. when animation callback occurs have nothing because uiview no longer exis...

c++ - How do virtual destructors work? -

few hours fiddling memory leak issue , turned out got basic stuff virtual destructors wrong! let me put explain class design. class base { virtual push_elements() {} }; class derived:public base { vector<int> x; public: void push_elements(){ for(int i=0;i <5;i++) x.push_back(i); } }; void main() { base* b = new derived(); b->push_elements(); delete b; } the bounds checker tool reported memory leak in derived class vector. , figured out destructor not virtual , derived class destructor not called. , surprisingly got fixed when made destructor virtual. isn't vector deallocated automatically if derived class destructor not called? quirk in boundschecker tool or understanding of virtual destructor wrong? deleting derived-class object through base-class pointer when base class not have virtual destructor leads undefined behavior. what you've observed (that derived-class portion of object never gets destroyed , t...

database - Using virtual machines for development -

i've been given role of managing or development environment includes: managing version control system (subversion) in typically have 1 major branch released production every 6 months, maintenance branch released every 2 month fix non-major bugs found users , couple of branches related bugs can't wait maintenance release. managing our databases have development database each branch of code we've not long moved on using version control system , have had following issues: developers work on number of branches concurrently can quite end developing against wrong database (we have around 15 developers) a lack of decent strategy managing release of branches production , propagation other branches a lack of decent strategy managing databases associated each branch (i.e. should keep script aligned production environment , script bring each database user in line needs of branch) i had thought of using virtual machine each branch of code (i.e. vm containing oracle e...

How to get SpecFlow working with xUnit.net as the test runner -

i'm trying use xunit.net test runner specflow. specflow 1.2 binaries official download area don't contain xunit.net provider master branch on github has one, build specflow.core.dll that. i'm using xunit.net 1.5. however, when change unittestprovider name in app.config in spec project, null reference custom tool error , generated .feature.cs file single line: object reference not set instance of object. has succeeded in getting specflow work xunit.net? if so, how? there example specflow xunit in specflow-example repository: http://github.com/techtalk/specflow-examples/tree/master/bowlingkata/bowlingkata-xunit in order run it, have build specflow latest sources on github (master branch). should have installed specflow 1.2 in order proper visualstudio integration. replace assemblies in installation directory (default program files (x86)\techtalk\specflow) assemblies built source. after should able build , run above specflow-example project. hope hel...

python - Google App Engine Task Queues - nasty failure -

i'm developing app gae , trying use task queues. @ present, have thing running on windows box through gae app launcher whenever try enqueue anything, development 'server' crashes on , log full of nasty output. taskqueue.add(url='/processwork', params={'key', mymodel.key()}) i've tried running in transaction other work i'm pretty sure work being enqueued. however, shortly afterwards development server crashes , log full of stuff this: error 2011-02-06 17:04:23,289 __init__.py:395] global name 'true' not defined traceback (most recent call last): file "c:\program files (x86)\google\google_appengine\google\appengine\ext\webapp\__init__.py", line 517, in __call__ handler.post(*groups) file "c:\projects\gae\myapp\main.py", line 114, in post activity.approved = true nameerror: global name 'true' not defined info 2011-02-06 17:04:23,309 dev_appserver.py:3317] "post /processwork http/1.1...

windows - How to deal with Unicode strings in C/C++ in a cross-platform friendly way? -

on platforms different windows use char * strings , treat them utf-8. the problem on windows required accept , send messages using wchar* strings (w). if you'll use ansi functions (a) not support unicode. so if want write portable application need compile unicode on windows. now, in order keep code clean see recommended way of dealing strings, way minimize ugliness in code. type of strings may need: std::string , std::wstring , std::tstring , char * , wchat_t * , tchar* , cstring (atl one). issues may encounter: cout/cerr/cin , unicode variants wcout,wcerr,wcin all renamed wide string functions , tchar macros - strcmp , wcscmp , _tcscmp . constant strings inside code, tchar have fill code _t() macros. what approach see being best? (examples welcome) personally go std::tstring approach see how conversions necessary. i can suggest check library out: http://cppcms.sourceforge.net/boost_locale/docs/ might help, it's boost candidate believe m...

ruby on rails - How to DRY Sass code using variables? -

i have design uses colors identify sections of site. have put file color variables defined, since can change , difficult track them down through css files. $people: #d50000; $galleries: #d500aa; $projects: #d5ba00; //etc... the name of classes matches of variables. example, navigation menu like: <ul> <li class="people">people</div> <li class="galleries">galleries</div> <li class="projects">projects</div> <!-- etc... -> </ul> and find myself writing sass like #nav { ul { li.people { border-left: 5px solid $people; } li.galleries { border-left: 5px solid $galleries; } li.projects { border-left: 5px solid $projects; } } } which i'd dry up. have tried use mixins, don't know how tell sass lookup variable named after argument pass (variable indirection). have like: @mixin menu-states($resource) { li.#{$resource} { // works bor...

Best way to handle Many-to-Many relationships in PHP MySQL -

i looking best way handle database of many-to-many relationships in php , mysql. right have 2 tables: users (id, user_name, first_name, last_name) connections (id_1, id_2) in user table id auto incremented on add , user_name unique, can changed. unfortunately, don't have control on user_name , ability changed, must account it. the connections table obviously, user1 , user2's id. the connection table needs account these possible relations: user1 --> user2 (user 1 friends user 2 not user2 friends user1) user2 --> user1 (user 2 friends user 1 not user1 friends user2) user1 <--> user2 (user 1 , user 2 mutually friends) user1 <-!-> user2 (user 1 , user 2 not friends) that part not problem, problem having keeping these relations unique when , if change in batches. possible solution 1: delete of user 1's relations , readd them updated list. think might slow needs. solution 2? else encounter problem? how should best handle this? u...

asp.net - CodeCharge Application -

i need make small asp.net application in codecharge. please tell me how add server side event app , how can textbox value in server side. have had through examples here: http://examples.codecharge.com/

JQuery find closest to sibling div -

for following: <div class="section"> <div class="row infoon"> <div class="itemwrap clearfix"> <div class="itemtop clearfix"> </div> <label class="">file title:</label> <div class="inputwrap clearfix"> <input type="text" class="text inpbutton" value="upload file first" disabled="true"/> <a id="fileupload" href="#" class="button">browse</a> </div> </div> </div> <!-- filelist --> ...

html - how to change the offsetHeight of a element using javascript? -

hello i'm trying change offsetheight of element. used following document.getelementbyid('id').style.offsetheight = 0; but saw no visible change. can me please? the offsetheight property indicates height of visible area element. it's shorthand contains sum of dimensions padding, scrollbars , borders. however, can't used change actual size , noted in comments, offsetheight property of element, not style. to modify actual size use height , padding or border .

asp.net ajax - What's the difference between $get and $find in JavaScript? -

i'm .net programmer who've started learn more client side scripting, , wondering use $get('value') , $find('value') , i've discovered these shortcuts document.getelementbyid('value') , sys.application.findcomponent('value') , respectively. however, still don't understand: difference between these 2 functions in javascript? looking up/retrieving when invoked? thanks in advance. $get & $find shortcut functions microsoft has built ajax javascript library. $get short standard javascript getelementbyid function . $find short .net's findcomponent() function . not standard javascript function , specific microsoft's ajax javascript library. matt berseth great write of differences & usages here .

linq to sql - Out of memory when creating a lot of objects C# -

i'm processing 1 million records in application, retrieve mysql database. i'm using linq records , use .skip() , .take() process 250 records @ time. each retrieved record need create 0 4 items, add database. average amount of total items has created around 2 million. iqueryable<object> objectcollection = datacontext.repository<object>(); int amounttoskip = 0; ilist<object> objects = objectcollection.skip(amounttoskip).take(250).tolist(); while (objects.count != 0) { using (datacontext = new linqtosqlcontext(new datacontext())) { foreach (object objectrecord in objects) { // create 0 - 4 random items (int = 0; < random.next(0, 4); i++) { item item = new item(); item.id = guid.newguid(); item.object = objectrecord.id; item.created = date...

Perl unit testing deep structures -

tmtowtdi, sure hope - i've been using test::deep last few projects whenever come across multidimensional hashes (sometimes 4-5 levels deep). right usual practice typing out these hashes , filling in expected data running cmp_deeply(actual, expected, msg) . have advice on unit testing deep nested data this? - current method seems grossly inefficient, taking on hour per unit test of data structure. i'm using test::more , is_deeply next commenter. have automated comparison having t/sample/ directory in store expected values running tests hand , using data::dumper appropriate. (oh i'd better have gone yaml -- tmtowtdi!) i.e. run dump-generator once, review dumped structures, commit them, , rely on is_deeply until tests break means either bug, or intended structure change.

wpf - Can we manipulate (subtract) the value of a property while template bidning? -

i defining few grids following: <grid.rowdefinitions> <rowdefinition height="{templatebinding height-height/5}"/> <rowdefinition height="{templatebinding height/15}"/> <rowdefinition height="{templatebinding height/20}"/> <rowdefinition height="{templatebinding height/6}"/> </grid.rowdefinitions> while division works fine , subtraction isn't yielding output. ialso tried following: <rowdefinition height="{templatebinding height-(height/5)}"/> still no result. suggestions plz. thanks, subhen ** update ** in xaml tried implementing ivalueconverter : <rowdefinition height="{templatebinding height, converter={staticresource heightconverter}}"/> added reference <local:medieelementheight x:key="heightconverter"/> in side generic.cs have coded following: public class medieelementheight : ivalueconverter { public ...

Simle regex question, c# -

i know how numbers , _ "{\"id\":\"21432413214_124533451397\"}" using regular expressions in c#. here example, want "21432413214_124533451397"-part. thanks! [0-9]+_[0-9]+ matches 2 numbers underscore between them.

vba - Creating an Equation Editor 3.0 equation in a Word 2003 document using a marco (or through the API) -

i think title descriptive now. anyway, need generate word document delphi application. needs choose 1 of 4 different equations (with specific parameters each document). far have manage create whole document programmatically except equation. is possible create equations programmatically? if so, de api documentation ms? if not, solution can used? going vba route brian suggested give code open equation editor; won't give code creating equation . perhaps mathtype sdk of use you. it's free download.

java - How to set SQL Server Connection pool size -

i using hibernate java web application , want set limit sql server 2005 connection pool size. far have read have use connection string. can specify in hibernate.properties or in hibernate.cfg.xml ? there mandatory fields or can specify max pool size ? edit: reproduce error came production machine: 2011-02-07 17:52:00,282 error [stderr] [warn] jdbcexceptionreporter - sql error: 0, sqlstate: 08s01 2011-02-07 17:52:00,282 error [stderr] [error] jdbcexceptionreporter - i/o error: connection reset peer: socket write error 2011-02-07 17:52:00,282 error [stderr] [error] jdbctransaction - jdbc rollback failed <java.sql.sqlexception: invalid state, connection object closed.>java.sql.sqlexception: invalid state, connection object closed. @ net.sourceforge.jtds.jdbc.connectionjdbc2.checkopen(connectionjdbc2.java:1634) @ net.sourceforge.jtds.jdbc.connectionjdbc2.rollback(connectionjdbc2.java:2027) @ org.hibernate.transaction.jdbctransaction.rollbackandresetautocommit...

Downloading file with ASIHTTPRequest - iPhone app -

i using asihttprequest source code download file remote location. surprisingly, download happens nothing happens after that. have put in log statement in handlebytesavailable method , can see entire file worth of data downloaded in parts , added filedownloadoutputstream variable. but once bytes have been downloaded, nothing happens. delegate methods not called (neither fail, nor success). can please tell me happening? or correct way download file remote server using asihttprequest? thanks. few more details on putting more log statements, appears after bytes have been downloaded, request class gets timeout response. , after delegate methods not called. not sure why timeout should happen because can see logs bytes of file have been downloaded already. help? you can set download location on request: asihttprequest *request = [asihttprequest requestwithurl:url]; [request setdownloaddestinationpath:@"/users/ben/desktop/my_file.txt"]];

javascript - What is context in _.each(list, iterator, [context])? -

i new underscore.js. purpose of [context] in _.each() ? how should used? the context parameter sets value of this in iterator function. var someotherarray = ["name","patrick","d","w"]; _.each([1, 2, 3], function(num) { // in here, "this" refers same array "someotherarray" alert( this[num] ); // num value array being iterated // this[num] gets item @ "num" index of // someotherarray. }, someotherarray); working example: http://jsfiddle.net/a6rx4/ it uses number each member of array being iterated item @ index of someotherarray , represented this since passed context parameter. if not set context, this refer window object.

.net - C#: Custom paint scroll on scrollable panel -

could provide example how custom paint scrollbar in scrollable panel? thanks in advance. check link may help this example of custom scroll bar http://www.codeproject.com/kb/miscctrl/customscrollbar.aspx

c - ODBC - multiple connections from one app to the same data source -

i vaguely remember reading somewhere (in msdn odbc documentation?) 1 application cannot make more 1 connection single data source. seemed me need 1 connection threads of application have share. trying information up, can't seem find anymore. know/remember how works? might become problem in our app, since of threads dynamically connect data sources of choice. don't want see random connection errors if 2 of them connect @ same time 1 source, wanted double check info. maybe statement referring in the msdn documentation , 1 says 1 statement can active on single connection. says: multiple active statements per connection after sql server has received statement, sql server tds protocol not allow acceptance of other statements connection until 1 of following occurs: the client application processes entire result set. the client sends statement telling server can close remainder of result set. this means when odbc application using defa...

parsing - How to handle unknown initializer functions in lua? -

i want load data written in variant of lua (eyeonscript). however, data peppered references initialization functions not in plain lua: redden = brightnesscontrast { inputs = { red = input { value = 0, }, }, } standard lua gives "attempt call nil value" or "unexpected symbol" errors. there way catch these , pass sort of generic initializer? i want wind nested table data structure. thanks! set __index metamethod table of globals. instance, undefined functions behave identity: setmetatable(_g,{__index=function (n) return function (x) return x end end})

javascript - How to divide logic between application + jQuery plugin (with $.widget factory)? -

i'm getting started writing plugins jquery widget factory . from stuff i've read it's not clear divide logic between application , plugin code. for example, in writing slideshow plugin, should click handlers etc. go inside plugin, or should plugin expose public prev/next methods + events application code hooks on to? that depend on how plugin intended used. a plugin novice user should on own plugin directed @ webdesigners might make own gui viewing should expose methods.

running gdb on a child executable -

i have bash script calls bash script calls (very fast) executable. know if there's way of attaching gdb executable without modifying second script or without attaching pid (given quick execution). the way can imagine rename executable (or change path same result if can not modify exe name) , wrap script has executable former name (or first in path order) call gdb. bash script should : #!/bin/bash gdb -q -x gdbcommandsfile --args "$@" with @ least 'run' in gdbcommandsfile , depending on want ... my2c

c++ - window without wndproc -

i curious possible create window without using wndproc. so register window-class lpfnwndproc field set null; , using msg ( given translatemessage(&msg) ) in own way. is there disadvantages of this? thanks ahead, , sorry grammar. edit #1: okay, have window, wrong somewhere. msg msg; while(peekmessage(&msg,null,null,null,pm_remove)) { if (msg.message == wm_quit) return false; else { translatemessage(&msg); switch (msg.message) { case wm_create: createcontext(); break; default: dispatchmessage(&msg); break; } } } return true; the createcontext not getting called. why? wrong? yeah, maybe wm_create message sent wndproc (defwindowproc now), there way outside wndproc? afaik, can't set null . however, you'll notice defwindowproc 's signature matc...

c# - Linq: Search a string for all occurrences of multiple spaces -

i have string , want find position of occurrences of multiple spaces. im writing punctuation checker. parralelise operation using parallel linq in meantime im looking linq method me started. further fredou's answer, regex nicely. regex.matches returns matchcollection (weakly typed) enumerable. can linq-ified after using cast<t> extension : regex.matches(input,@" {2,}").cast<match>().select(m=>new{m.index,m.length})

java - installing python packages on android -

i want install python package source on android. possible? tried in console run py install files, distutils (.core, ccompiler) isn't being found. possible still install them? android not ship python interpreter, nor ship gcc or other compilers. need arm binary somewhere or cross-compile 1 yourself. (btw, i'm assuming arm, substitute in whatever architecture happen running).

mod rewrite - .htaccess working with multiple SEO friendly URL's -

i'm having problem working out how attach multiple "friendly url's" new project. i've never had work multiple ones before don't know start. had play around couldn't come anything. original script one: rewriteengine on rewritecond %{request_uri} \/([0-9a-z]{1,9})$ [nc] rewriterule ^(.*) http://mysite.me/?%1 [l] i want keep exact one, need more handle other files, such couple of lines method; view.php?p=46345 mysite.me/view/46345 hope can help, thanks! i recommend of in code rather in apache. redirect requests 1 file (index.php, or whatever directoryindex file is) , examine url in code , transform url form want. then, return 301 transformed url. if want, can skip process files exist. avoid overhead requested assets. here's sample .htaccess this: options +followsymlinks +execcgi <ifmodule mod_rewrite.c> rewriteengine on # check if file exists. if doesn't redirect main file # comment out rewritecond if don't...

mapreduce - How to use Cassandra's Map Reduce with or w/o Pig? -

can explain how mapreduce works cassandra .6? i've read through word count example, don't quite follow what's happening on cassandra end vs. "client" end. https://svn.apache.org/repos/asf/cassandra/trunk/contrib/word_count/ for instance, let's i'm using python , pycassa, how load in new map reduce function, , call it? map reduce function have java that's installed on cassandra server? if so, how call pycassa? there's mention of pig making easier, i'm complete hadoop noob, didn't help. your answer can use thrift or whatever, mentioned pycassa denote client side. i'm trying understand difference between runs in cassandra cluster vs. actual server making requests. from i've heard (and here ), way developer writes mapreduce program uses cassandra data source follows. write regular mapreduce program (the example linked pure-java version) , jars available provide custominputformat allows input source cassandra (instea...

html - Submenus of the Menu control are hide behind the webpage images in asp.net -

i designing website. have created simple menu(without sitemap) in master page , web page called home. problem when hosted website submenu's of menu control hide behind images of home webpage , if webpage has no image submenus appears. have problem in menu creation. have copy code in window due reason not shown. please shortout problem here code: ...

javascript - Iframe and parent.window return the iframe, not the document -

any ideas why? i've got iframe part of html - not loaded using ajax thought original problem - reason, when try access parent window iframe, can find html iframe, not document. i'm using jquery, have tried straightforward javascript. both give me same response. the browsers i'm testing in chrome , safari.

android - Ideal way to cancel an executing AsyncTask -

i running remote audio-file-fetching , audio file playback operations in background thread using asynctask . cancellable progress bar shown time fetch operation runs. i want cancel/abort asynctask run when user cancels (decides against) operation. ideal way handle such case? just discovered alertdialogs 's boolean cancel(...); i've been using everywhere nothing. great. so... public class mytask extends asynctask<void, void, void> { private volatile boolean running = true; private final progressdialog progressdialog; public mytask(context ctx) { progressdialog = gimmeone(ctx); progressdialog.setcancelable(true); progressdialog.setoncancellistener(new oncancellistener() { @override public void oncancel(dialoginterface dialog) { // set running = false; right here, i'll // stick contract. cancel(true); } }); } @...

Magento saves wrong date when generating or updating products in backend -

i've got problem when add or update product attributeset, date-value in 1 of attributes changes after saving. seems, problem occurs on our live-system. in forum i've read magentos way handling date() function kinda unusual . don't know whether there connection or not. i would appreciate help. please clarify sdek asked for, i'm going make gigantic logical leap here , take guess @ problem. magento stores dates in gmt in database, make no sense whatsoever if adding data system using things strtotime . dates appear off gmt offset (mine -8). how might happen depends on might doing add products other adding them within normal interface. if not @ asking about, feel free disregard :) thanks, joe

Why can't I save my model with a generic relation twice in Django? -

i got model trackeditem generic relation linking model supposed track. if that: t = trackeditem(content_object=mymodel) t.save() t.save() i : integrityerror: (1062, "duplicate entry '1' key 'primary'") indeed, first save has created entry "1" pk. second save should not insert, should update. how suppose update model can't save twice? with ordinary model can save as want. edit : may not related @ generic relations. i'm having overrided save, , call super in it, way : super(trackeditem, self).save(self, *args, **kwargs) if way, works: model.model.save(self, *args, **kwargs) your problem because of wrong use of 'super'. should this: super(trackeditem, self).save(*args, **kwargs)

sql server - run stored proc over resultset -

is possible run stored procedure each record against resultset? for example, select * customers for each record in results above execute stored procedure. and (not important if not possible), have inside main stored procedure? being cursors inefficient, better idea return results select * customers query code base , loop through results in code call other procedure.

php - RESUME Download? Direct Link? -

i wrote code uploading files host.for example upload file server server b , after want download pc, when want download it, example via idm, not support resume download. attention : upload code server b ! <?php require('config.php'); function is_valid_url($link) { $link = @parse_url($link); if ( ! $link) { return false; } $link = array_map('trim', $link); $link['port'] = (!isset($link['port'])) ? 80 : (int)$link['port']; $path = (isset($link['path'])) ? $link['path'] : ''; if ($path == '') { $path = '/'; } $path .= ( isset ( $link['query'] ) ) ? "?$link[query]" : ''; if ( isset ( $link['host'] ) , $link['host'] != gethostbyname ( $link['host'] ) ) { if ( php_version >= 5 ) { $heade...

security - Dynamic SQL: secure a password parameter from SQL injections -

as scary sounds, input password parameter has secured in following dynamic sql: create login newlogin password='mystrongpassword' . @parameter cannot used: password=@pwd (incorrect syntax near '@pwd' error). other parameters table name or user name, more or less simple: allow letters, digits , underscores, validate using simple regex , quotename it. passwords have allow usage of strong chars. should password cleared characters comma, space, etc or there better way? not direct answer, can parametrize sp_addlogin: exec sp_addlogin @user, @password; or can use smo.

dom xml parser java, same tags -

i have xml document has varying number of same named tags. how can count of child elements , value of it. <question> <questiontext>abc?</questiontext> <option>a1 - xyz</option> <option>a2 - wxy</option> <option>a2 - hjk</option> <id>1</id> </question> <question> <questiontext>ery?</questiontext> <questiontext>nnn?</questiontext> <questiontext>kkkk?</questiontext> <id>2</id> </question> the output should read... id:2 has 1 questiontext , 3 option questiontext 1:abc? option 1:a1 - xyz option 2:a2 - wxy option 3:a2 - hjk id:1 has 3 questiontext , 0 option questiontext 1.ery? questiontext 2.nnn? questiontext 3.kkkk? i tried, gives fault results element eelement = (element) nnode; for(int i=0;i<eelem...

packages - iPhone - packaging multiple app in a single app -

i package multiple app in single app. donwloading 1 app , install in iphone install 3/4 apps. java midlet suits having multiple midlets in single jar file. possible using multiple target or bundle, aggregate target etc.? no. don't few reasons: i think it's bad idea. [more on below.] it cannot done. multiple apps cannot installed result of 1 application being downloaded. some apps act bundles of apps, bunch of mini-apps built larger one. highly discourage sort of bundling. there lot of apps out there say, “51 tools all-in-one, $1.99!”, these incredibly trashy , bought unsuspecting noobs no taste. don't contribute that.

gcc - How do you see result of a Macro before the program compiles -

i'm compiling program uses _syscall0 macro. how see result of macro before actual compilation process? http://oldlinux.org/lxr/http/source/include/unistd.h#l133

Grails GIS Application -

i'm working on internal application monitoring outages network national footprint in us. i'm considering overlaying outages region on map. showing outage areas in red example. user clicks on outage area displaying drill down information. technology stack includes grails/jboss/linux. there frameworks provide mapping/gis layer of display on overlay domain specific information? i've looked google map api, unable leverage operates behind firewall. ideas? in advance, steve mapguide open source openlayers ui front end make combination this. there issue finding basemap fits needs of app - data.gov spot information.

iphone - How to move several buttons throughout the screen -

i creating application have several buttons on screen , want make them move throughout screen. user can tap on buttons , buttons on user taps gets removed screen.hence have stop timer moves button. but main concern how make bubbles move i.e. how manage each of them? i have made use of nstimer. nstimer* timer = [nstimer timerwithtimeinterval:1 target:self selector:@selector(movethebutton) userinfo:nil repeats:yes]; [[nsrunloop currentrunloop] addtimer:timer formode:nsrunloopcommonmodes]; but can helpful in case if have 1 button. if there more buttons quite hard manage timers. also number of buttons dynamic. please suggest alternate. i have gone through few threads didnt got expected answer. thanks in advance help..... i suggest using caanimations move buttons. allow animate buttons smoothly without use of nstimers , ideal creating button animations dynamically. caanimations created added views layer. can animate rotation, position , size of view using caan...

ruby - What is the value in having several, equally abstract, syntactic variations for coding something? -

i reading on ruby. think nice language, bit bothered having many equivalent ways, slightly different in syntax, coding same action. example, unless conditional statement, equivalent writing if !conditional . to me, not add expressive power, makes more taxing follow other people's code. there benefit missing (other catering different tastes, don't find convincing, since people don't reject language because syntactic keywords didn't match taste)? there more examples of in every language. using example because though particularly lacking reasonable defense. catering different tastes explanation. philosophy adapted perl , it’s known timtowtdi (there's more 1 way it). this have advantages, example facilitates creation of rich domain-specific languages within ruby, since existing syntax constructs can combined in new, interesting ways. but technique has many detractors, , python in particular strives opposite : there should one-- , preferably...

How can I send XML data from Perl CGI script? -

i have no experience cgi scripts or web development. i'm developing client app , want have small cgi script send , retrieve xml data test out client. right i'm doing http get xml files need. i'm changing client post request containing xml data , expecting xml back. want have small script returns contents of xml file have. can please point me sample code or perl modules help. i suggest giving xml::simple spin.

childwindow - Can an user control be loaded in a child window in Silverlight 3.0? -

can user control loaded in child window in silverlight 3.0? so far seem able to change color , position , size of window. still searching other sources though. edit* my apologies long response time. have continued searching web different sources hoping find solution problem. have been able find date is: i’ve seen few comments/requests incoming lately people childwindow control in silverlight 3 sdk. great control creates modal dialog you. when use it, disables root layout application , shows dialog provide: this great true modal needs. responds normal windows dialogresult type responses if have buttons, etc. – great error dialogs, logins, etc. request i’ve been seeing same functionality, in ‘normal’ childwindow. found here but sites seem child window can have either the size, position, color, dimensions, inner text modified , childwindow can used user control. nothing definite having user controls loaded window. apart link...

datetime - php strtotime() function returns blank/0 -

i have datetime data in string format this: sat mar 24 23:59:59 gmt 2012 i want convert utc timestamp, when try follows: function texttotime($texttime) { if(!$texttime || $texttime=="") return null; // sat mar 24 23:59:59 gmt 2012 $bits = preg_split('/\s/', $texttime); // mar 24 2012 23:59:59 gmt return strtotime("$bits[1] $bits[2] $bits[5] $bits[3] bits[4]"); } it outputs 0 (not null). if change last line to: // mar 24 2012 23:59:59 return strtotime("$bits[1] $bits[2] $bits[5] $bits[3]"); it outputs (but wrong timestamp, off -4 hours or so). not quite sure why you're re-organising existing string, as... echo $timestamp = strtotime('sat mar 24 23:59:59 gmt 2012'); ...works correctly. (it returns 1332633599, can check via date('r', 1332633599); (this result in "sat, 24 mar 2012 23:59:59 +0000...