Posts

Showing posts from September, 2015

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

html - Difference between button and input? -

possible duplicate: <button> vs. <input type=“button” />. use? are there major differences between <button type="button" name="thebutton">submit</button> , <input type="submit" value="submit" name="thebutton" /> also, can use <button type="submit" name="thebutton">submit</button> ? here's page describing differences (basically can put html <button></button> and other page describing why people avoid <button></button> (hint: ie6) reference: <button> vs. <input type="button" />. use? also have @ slideshow button .

architecture - WCF service, how to mapp the objects runtime -

i have design wcf service gives outut in standard model(which think better give string/xml).but standard model is/may subjected change format.so every time changed need change code.my service should accomadte same configurable change. how without code change , exernal configurable entities. is there way create , mapp class in runtime. my primary idea keep format internally , xml standard format , mapp class properties , xml nodes using database table. please suggest ....appreciate gurus !!! thanks in advance i don't understand question, perhaps elaborate upon it, perhaps simplified code? however, if need map between xml formats, have considered xsl transform?

alarm - how to automatically invoke my application in android -

i want automatically invoke application @ 12.00 am,this kind of process ,how implement in android,is possible? look @ alarmmanager . here example: intent myintent = new intent(getapplicationcontext(), youractivity.class); pendingintent pendingintent = pendingintent.getactivity(getapplicationcontext(), 1, myintent, pendingintent.flag_update_current); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); alarmmanager.set(alarmmanager.rtc_wakeup, time, pendingintent);

javascript - Problem in loading a document in the same page using href="" in Jquery-mobile -

i have list view. in which, every list item document(.pdf, .xls , .doc etc.). after clicking list item, need open document in same page. used anchor tag without target="_blank". not working. using target attribute, works fine , opens in new tab. need in same tab. here code used. $('div').live('pageshow',function(event, ui){ var parent = document.getelementbyid('listview'); var listitem = document.createelement('li'); listitem.setattribute('id','listitem'); listitem.innerhtml = "<a href='testdoc.doc' >my word document</a>"; parent.appendchild(listitem); var listitem = document.createelement('li'); listitem.setattribute('id','listitem'); listitem.innerhtml = "<a href='contacts.pdf' >my pdf document</a>"; parent.appendchild(listitem);

c++ - How to exchange data between classes? -

i'm learning c++ , moving project c c++. in process, stumbled on problem: how save/update variables in use in several classes? in c used global variables, not c++. so, let's assume have 4 classes: class main_window { //... void load_data_menu_selected(); } class data { //... double *data; } class load_data { //... double *get_filename_and_load(); } class calculate { //... int do_calculation() } so, main_window class application's main window interacts user input etc. want do: create instance of class data in main_window use load_data loading data file , store in data use calculation class doing read data in data class the question is: should create classes, make data class members available other classes. should use inheritance? start observing possible relations between instances of 2 classes. let a instance of class , b instance of class b. if a uses b , class can have member instance of class b ( b ), pointer

Vim and snipMate (plugin) - adding new snippet won't work -

i trying create new snippet snipmate plugin. i work files called (i.e.) myfile.endfile all .endfile files should have same "snippet" .html files. did cp html.snippet endfile.snippet in ~/.vim/snippets directory. snipmate working present snippets, not new created one. suggestions problem? (btw: after creating new .snippet file, ran :helptags ~/.vim/doc command in vim instance.) it because snipmate works filetype , vim option set when opening file of particular type. for exemple, if opening, "index.html" filetype automatically set html . to see how works, : :e $vimruntime/filetype.vim as preliminary test, can : 1. open test.endfile 2. type :set ft=endfile or :set filetype=endfile 3. check if defined snippets work to automatically add following in .vimrc : au bufnewfile,bufread *.endfile set filetype=endfile it means every time read or create new file ending in endfile the filetype option set endfile. (the filetype arbit

javascript - jquery: event for when ajax loaded content is all loaded (including images) -

i'm loading in html via ajax, need event catch on when new images loaded... becuase it's in div , not whole page, can't use $(window).load(.... i've tried following doesn't work: $('.banners_col img:last').load(function(){..... you need target results of ajax call before inserting them in dom. so need use callback method provided jquery reason. $('#load').click(function(){ // inside handler calls ajax //you ajax call here $.get('the_url_to_fetch',function(data){ // create in-memory dom element, , insert ajax results var $live = $('<div>').html(data); // apply load method images in ajax results $('img',$live).load(function(){ // each image loaded }); // add ajax results in dom $('selector_where_to_put_the_response').html($live.children()); }); }); example @ http://www.jsfiddle.net/gaby/sj7y2/ if the

Run a AJAX query which uses PHP code that limits queries/sec on client side? -

i have php code, uses web service query data. however, web service limits queries per second based on server (i m not sure exact mechanism, seems ip address) i m using ajax query data php file on server, there way can let client search data faking requesting data rather servers? the issue getting rateexceeded error message server, 2 clients requesting same page, rather obvious since webservice seeing 1 server, server. so, can somehow, make happen when these clients query data, service rather thinking request being originated via these clients, rather server. you can't fake it, if query webservice directly via ajax, should seeing clients' ip addresses. note if you're doing kind of processing on data ws returns, you'd have perform in javascript, on client side. if request server ws contains confidential data (e.g. kind of access key) clients must not see, approach useless.

WEBKIT: The following environment variables were not found: 1>$(PRODUCTION) -

i had problem in building webkit. pasting same here. 1>------ rebuild started: project: winlauncher, configuration: debug win32 ------ 1>deleting intermediate , output files project 'winlauncher', configuration 'debug|win32' 1>performing pre-build event... 1>/usr/bin/bash **1>project : error prj0002 : error result 1 returned 'c:\windows\system32\cmd.exe'. 1>project : warning prj0018 : following environment variables not found: 1>$(production)** 1>build log saved @ "file://d:\webkit_build\dolfin\shp\shpbrowser\dolfin\engine\webkit\webkitbuild\obj\winlauncher\debug\buildlog.htm" 1>winlauncher - 1 error(s), 0 warning(s) ========== rebuild all: 0 succeeded, 1 failed, 0 skipped ========== please me solve issue. thank you! it not important. had similar problems , solved don't remember how can check following resource, may help: http://siphon9.net/loune/2009/07/compiling-webkitcairo-on-windows-with-visual-c-e

android - How to show a "are u sure YES OR NOT" dialog when user press a button? -

first of all, have tell have searched here , on google , can't find easy way (im newbie on this), need please i have button, removes friend remote database: removebutton.setonclicklistener(new onclicklistener() { public void onclick(view v) { con.deletepermission(settings.getstring("login",""),bundle.getstring("email")); finish(); toast.maketext(getapplicationcontext(), getstring(r.string.friendsuccessfullyremoved), toast.length_long).show(); } }); i want show simple "are sure? yes or not" dialog 2 buttons (yes , not) , when user press yes, have called code: con.deletepermission(settings.getstring("login",""),bundle.getstring("email")); finish(); toast.maketext(getapplicationcontext(), getstring(r.string.friendsuccessfullyremoved), toast.length_long).show(); exist's easy way i

asp.net - How do I reference the databound control from an ObjectDataSource event? -

take example detailsview control objectdatasource datasource. normally in detailsview.itemupdated event grab reference details view casting sender : detailsview dv = (detailsview)sender; in situations becomes necessary handle event inside objectdatasource.itemupdated event. in case sender of type objectdatasource . want able write clean code isnt hardcoded like label label1 = detailsview1.findcontrol("label1"); i looked on documentation , did searches couldnt find how write code following: protected void objectdatasource1_inserted(object sender, objectdatasourcestatuseventargs e) { objectdatasource ods = (objectdatasource)sender; detailsview dv = (detailsview)ods.something_here; } does know should putting in something_here in snippet above? that's happen because "oninserted" event suppose event examine values of return value or output parameters, or determine whether exception thrown after insert operation has completed. re

javascript - returning with && -

what mean return value &&? else if (document.defaultview && document.defaultview.getcomputedstyle) { // uses traditional ' text-align' style of rule writing, // instead of textalign name = name.replace(/([a-z]) /g, " -$1" ); name = name.tolowercase(); // style object , value of property (if exists) var s = document.defaultview.getcomputedstyle(elem, " ") ; return s && s.getpropertyvalue(name) ; return && b means "return if falsy, return b if truthy". it equivalent to if (a) return b; else return a;

SEO Optimalization performance , which method ? (ASP.NET Routing) -

i'm trying figure out type of seo use site. i'm using asp.net routing (webforms) sql 2005 database. i want show urls like: http://www.domain.com/article-category/article-title-of-current-page this means need query category , article it's title (well, systemtitle column). systemtitles columns indexed varchar(255) column. does have done similar way , if so, did u notice performance decrease using method? can opt-in /2-article-category/243-article-title-of-current-page , query id hoping avoid urls clean. i've read things topic before , performance impact little when columns indexed while others make huge impact. it's not important if site grows should not suffer it. any tips/advice welcome. thank time. kind regards, mark i dont think somthing worry about, query on "where title = 'abc'" wont hugley differant query on 'where id = x' however, i'd advise not using may hinder performance. check out. sql select s

svn - Eclipse incoming synchronization view shows incoming new files as folders -

i hope okay ask strange behaviour/bugs in eclipse here. when use eclipse synchronize view subclipse, used see incoming files other developers nicely blue arrows pointing left. double click perfect open compare editor , review changes. for time now, whenever colleague adds new file shows incoming new folder in synchronize view! if update it, need restart eclipse have folder disappear sync view (or sync different folder , sync root again). double click open compare editor broken (it's nice see new file, though left side of compare editor empty, not matter me) does know why happens? tried kinds of preference settings , not find on google. think use granny made or whatever call it, can't find sane version number anywhere. thanks!

.net 3.5 - double.IsNan is not defined? (upgrade from 1.9.7.8 -> 2.0) -

trying out vs 2010, still want target .net 3.5. have c# projects set with: <propertygroup> <langversion>3</langversion> </propertygroup> and seems working fine. f# acting funny though.. can't use double.isnan method. let foo = double.isnan(bar) field, constructor, or member 'isnan' not defined. similarly, string.format broke too: the field, constructor, or member 'format' not defined. i must missing here. explicitly stated "open system" , capitalized double (double). not sure why fine before..

box2d - What is the most performant 2D graphics engine for use with Android? -

i have managed make hello world jbox2d application, , works (i have bouncing balls). however, read comment on forum post , claims jbox2d produces lot of garbage, , causes animation poor. true? if yes, other 2d engines available me? use physics engine 2d game, if it's simple one. update: just tried running jbox2d bouncing balls demo on phone, , performance terrible. looks libgdx way go physics, since think comes native version of box2d works on android. andengine , game engine , not physics engine, may use in conjunction libgdx give myself head start. update 2: i've had quick play libgdx , andengine. i've found they're both android game engines, andengine has less steep learing curve @ cost of being more limiting. if want build serious game, want use libgdx allow more (but harder use). jbox2d port native version called box2d. native version didn't need worry garbage collection written language used manual memory management (c++ think). the

javascript - Validating an input field if a certain radio button is checked -

i have form multiple question each asking radio button selection of pass, fail or n/a. want achieve if user selects fail of questions , try submit turn on validation 3 text fields. the user must complete 3 text input fields if select fail on question , can't submit unless so. also have validation on questions ensure user selects radio button each field solution must able work now. example of form is <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>form</title> <script> function valbutton(thisform) { // question 1 myoption = -1; (i=thisform.questionone_one.length-1; > -1; i--) { if (thisform.questionone[i].checked) { myoption = i; = -1; } } if (m

design - why android is built on a VM (Dalvik) -

i curious know made google choose develop android's framework on java vm. in process of writing code android 6 months now, observed running code on vm in resource limited platform slow. there lot of overhead involved. know java portable etc etc, not possible @ use native languages , both performance , features offered vm ? performance oriented applications 1 still ends writing native code , wrap jni, so why did google choose particular stack : arm based core (understandable, arm best mobile devices) linux (open source) java vm (my question) edit : know java - jvm run's on par c++ applications on server, not on android. respect android not case - matter of experience, c++ code wrapped jni runs far faster java code (note have checked exact same code static block in java) agree answer on other platform. the dalvik vm uses own bytecode, not java bytecode. it's designed fast (relatively speaking). think "vm" part of title bit of red herring, pe

EXTJS OnClick Tab Event -

is there way attach onclick event tab switch in extjs? i make grid this: var simple = new ext.formpanel({ labelwidth: '100%', border:false, width: '100%', style: { height: '291px' }, items: { xtype: 'tabpanel', activetab: 0, //labelwidth: 75, // label settings here cascade unless overridden items:[{ url:'save-form.php', title: 'tab 1', ... thanks! i added in listener after tabs defined this: //define tabs, , after ] tab panel json: listeners: { 'tabchange': function(tabpanel, tab) { alert("tab changed"); } } this alerts when tab changed, sufficient purposes. i'm not sure though how find out tab current tab. hope helps in future.

nginx - Ubuntu: Passenger cannot find SSL for curl -

i installing passenger nginx module on ubuntu, , while installing error curl development headers ssl support not available. suggests "run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever prefer" i ran apt-get install libcurl4-openssl-dev still gives same error... googling not give usefull result. i had same problem. installing openssl libraries didn't seem solve anything, after removed , reinstalled rails worked. good luck!

c++ - open desktop using QText Browser -

right displaying /home/binary/ in qtext browser. want open folder clicking on text. how ? in advance here sample code. display result s bool mainwindow::displayresult(multimap<string, string> &resultmap, string &filepath) { multimap::iterator iter; bool filestatus = false; int nooflocfound = 0, forappending = 0; qstring no; nooflocfound = resultmap.size(); if ( nooflocfound != 0 ) ui->textbrowser->append( "<i>file found @ <b>" + no.setnum ( nooflocfound ) + " locations"); ( forappending = 0,iter = resultmap.begin(); iter != resultmap.end(); iter++, forappending++ ) { string file = iter->first; string dir = iter->second; if ( forappending == 0) filepath.append(dir); else filepath.append(","+dir); qstring qdir = qstring::fromstdstring(

string - Why is the following C++ code printing only the first character? -

i trying convert char string wchar string. in more detail: trying convert char[] wchar[] first , append " 1" string , print it. char src[256] = "c:\\user"; wchar_t temp_src[256]; mbtowc(temp_src, src, 256); wchar_t path[256]; stringcbprintf(path, 256, _t("%s 1"), temp_src); wcout << path; but prints c is right way convert char wchar? have come know of way since. i'd know why above code works way does? mbtowc converts single character. did mean use mbstowcs ? typically call function twice; first obtain required buffer size, , second convert it: #include <cstdlib> // mbstowcs const char* mbs = "c:\\user"; size_t requiredsize = ::mbstowcs(null, mbs, 0); wchar_t* wcs = new wchar_t[requiredsize + 1]; if(::mbstowcs(wcs, mbs, requiredsize + 1) != (size_t)(-1)) { // what's needed wcs string } delete[] wcs; if rather use mbstowcs_s (because of deprecation warnings), this: #include <cstdlib>

java - How to solve this JNA issue? -

i have application use jna , gets audio , video. works in linux box. when testing in windows. never working. because still learning, appreciate suggestion how fix it, spent few days , weeks work out, dont why java not work simply, cross platform. why should require again system path or etc configuration. i totally lost now, why works in linux , not work in windows xp ? how can run ? inside lib direcotry have jna , audio libraries. c:\documents , settings\test\desktop\test>dir volume in drive c has no label. volume serial number 680f-0963 directory of c:\documents , settings\test\desktop\test 19/12/2010 22:09 <dir> . 19/12/2010 22:09 <dir> .. 19/12/2010 22:09 51.791 audio.jar 19/12/2010 22:09 <dir> lib 1 file(s) 51.791 bytes 3 dir(s) 487.002.112 bytes free trying run audio.jar, gets fail 1: c:\documents , settings\test\desktop\test>java -djava.library.pat

flash - Flex - scroll wheel ok using IE, but not on FF or Chrome? -

flex - scroll wheel ok using ie, not on ff or chrome? switching between browsers during debugging , noticed scroll wheel not work in firefox or chrome, fine in internet explorer. else notice this? suppose use scroll listener , manually it, rather not! i'm not sure if cause of problem or not . in flex when run project in default testing browser . recent changes doesn't show . when copy address of file , paste browser , works fine . if you're default browser doesn't show project , cause of problem .

java - long and int same size in eclipse? -

don't know if eclipse specific problem whenever declare long , try put value > 2^32 in complains "the literal xxxxxx of type int out of range" i've tried casting directly long doesnt seem have effect. missing here? try creating long constant: 123456789123l (note letter l in end) long l = 123456789123; // error, constant `123456789123` has type int long l1 = 123456789123l; // work long l2 = 123456789123l; // work

How to get list of available serial ports in my pc using Java? -

i run codes list of available ports n cmputer , returned me false when have 3 com ports free. how solve prob? my codes: public static void main(string[] args) { //serialparameters params=new serialparameters(); // system.out.println(commportidentifier.port_serial ); enumeration portlist = commportidentifier.getportidentifiers(); system.out.println(portlist.hasmoreelements()); while(portlist.hasmoreelements()){ system.out.println("has more elements"); commportidentifier portid = (commportidentifier) portlist.nextelement(); if (portid.getporttype() == commportidentifier.port_parallel) { system.out.println(portid.getname()); } else{ system.out.println(portid.getname()); } } } output : false it appears setup of javax.comm api may not correct. make sure have done following: placed comm.ja

asp.net mvc - Test for strongly typed views -

in asp.net mvc 2 need programatically views thar typed, , show list views not typed. how can that? thanks in advance. strongly-typed views inherit system.web.mvc.viewpage. untyped views inherit system.web.mvc.viewpage. n.b. viewpage inherits viewpage. have load compiled assembly containing views (generated via aspnet_compiler.exe) , run following linq-to-objects queries: var stronglytypedviews = type in assemblycontainingviews.gettypes() typeof(viewpage<>).isassignablefrom(type) select type; var weaklytypedviews = type in assemblycontainingviews.gettypes() typeof(viewpage).isassignablefrom(type) && !typeof(viewpage<>).isassignablefrom(type) select type;

objective c - Using MacRuby to Test iPhone Application? -

i have existing iphone app, written in objective-c, i'd add automated tests to. i've read article testing macruby , sounds great it's aimed @ testing desktop frameworks. how can add macruby tests iphone app? ruby code doesn't recognize objective-c classes, , don't know how set that. need somehow point @ compiled code or headers? rbiphonetest worked me in iphone os 2 , 3.x days regular ruby. limited though. haven't tried 4.x or macruby specifically.

c# - WebBrowser Control - Prevent Right-Click -

in application, have form contains browser control in display ssrs report. prevent user right-clicking in browser control , being shown popup menu. ideally i'd right-click nothing. there way can accomplish this? you can set iswebbrowsercontextmenuenabled equal false. want set allowwebbrowserdrop equal false cant drag url app , have load. webbrowser1.iswebbrowsercontextmenuenabled = false; webbrowser1.allowwebbrowserdrop = false;

java - How to correctly override BasicDataSource for Spring and Hibernate -

currently have following basic data source in spring: <bean id="dbcpdatasource" class="org.apache.commons.dbcp.basicdatasource" destroy-method="close"> <property name="driverclassname" value="com.mysql.jdbc.driver" /> <property name="url" value="jdbc:mysql://localhost/test?relaxautocommit=true" /> ... </bean> now need provide custom data source based on server environment (not config), need calculate driverclassname , url fields based on condition. i tried overriding createdatasource() method: public class mydatasource extends basicdatasource { @override protected synchronized datasource createdatasource() throws sqlexception { if(condition) { super.setdriverclassname("com.mysql.jdbc.driver"); super.seturl("jdbc:mysql://localhost/test?relaxautocommit=true"); } else { //... }

javascript - Why are my html buttons moving in I.E? They don't move in Chrome or FF -

we using ajax send data our database. i've added feedback user including spinner (animated .gif) spins during request, , pass/fail text displayed user when request complete. html: <center> <table style="width:350px;"> <tr> <td style="width:100px; min-width:100px;" align="right"> <span id="spinner-and-text-displayed-here"></span> </td> <td style="width:150px"> <input type="button" value="submit" onclick="submit();"/> <input type="button" value="cancel" onclick="cancel();"/> </td> <td style="width:100px"></td> </tr> </table> </center> when user clicks submit button spinner spins until ajax callback returned. @ point, buttons not s

Regex Searching in vim -

i'm using vim pattern matching on text file. i've enabled search highlighting know getting matched on each search , getting confused. consider searching [a-z]* on following text: 123456789abcdefghijklmnopqrstuvwxyxz987654321abcdefghijklmnopqrstuvwqxz i expected search match 0 or more consecutive characters in range [a-z]. instead, match on entire line. should expected behaviour? thanks, andrew it's matching empty strings occur after every character. has no way of highlighting empty ranges, looks highlighted. try searching [a-z]\+ instead.

java - ThreadLocal - Is it required if we are setting the value in constructor? -

i have class, mythread implements callable <string>. class has constructor takes parameters blockingqueue , others. in main class, instantiate class, mythread, new blocking queue , other parameters. also, maintain 2 maps, 1 keep mythread reference 1 of unique parameter key , other keep blocking queue reference same unique key. during process, blocking queue hashmap, add custom message , take corresponding mythread instance , submit threadpooltaskexecutor (spring version). as far understand, each thread should own copy of values (like blocking queue etc), passing them during construction , creating thread later using threadpooltaskexecutor.submit(mythreadobj). wondering if confirm if true or whether required use threadlocal in scenario. far testing, did not encounter problem, yet load testing. thanks in advance. you have reinvented threadlocal. enjoy!

validation - codeigniter validate -

hello have forum , when user creates comment, want if didn't type want show him error must type in :) dont know how put him the thread in. i have this if($this->_submit_validate_comment() == false) { $this->post(); return; } function _submit_validate_comment() { $this->form_validation->set_rules('kommentar', 'kommentar', 'required|min_length[4]'); return $this->form_validation->run(); } you jquery if not option forum or topic id url (assuming using url way). for example: http://yoursite.com/forum/topic/12 if($this->_submit_validate_comment() == false) { $topic_id = $this->uri->segment(3); redirect('/forum/topic/'. $topic_id); } or if($this->_submit_validate_comment() == false) { $topic_id = $this->uri->segment(3); $this->topic($topic_id); } hope helps.

What is the idiomatic way to assoc several keys/values in a nested map in Clojure? -

imagine have map this: (def person { :name { :first-name "john" :middle-name "michael" :last-name "smith" }}) what idiomatic way change values associated both :first-name , :last-name in 1 expression? (clarification: let's want set :first-name "bob" , :last-name "doe". let's map has other values in want preserve, constructing scratch not option) here couple of ways. user> (update-in person [:name] assoc :first-name "bob" :last-name "doe") {:name {:middle-name "michael", :last-name "doe", :first-name "bob"}} user> (update-in person [:name] merge {:first-name "bob" :last-name "doe"}) {:name {:middle-name "michael", :last-name "doe", :first-name "bob"}} user> (update-in person [:name] {:first-name "bob" :last-name "doe"}) {:name {:middle-name "michael", :last

jquery - What is the most common waste of computing power in Javascript? -

we've seen people this: jquery('a').each(function(){ jquery(this)[0].innerhtml += ' proccessed'; }); function letspolutens() { polute = ''; (morepolution = 0; morepolution < arguments.length; morepolution++) polute.join(arguments[morepolution]); return polute; } and on. wondering people have seen common javascript/jquery technique slowing down page and/or wasting time javascript engine. i know question may not seem fit what's accepted question, yet i'm asking "what common accepted waste?" i'm guilt of this. using element's class in jquery selector. instead of combining class selector elements tag name. <div></div> <div class="hide"></div> <div class="show"></div> <div class="hide"></div> <div class="hide again"></div> $(".hide").hide(); instead of quicker $("div.h

c++ - Qt, POP3 and SSL? -

if gmail using ssl mean have implement algorithms encrypting , decrypting traffic myself in order download mail? if so, there fast workaround doing ? i should mention i'm making pop3 client scratch in qt creator , want implement communication myself. you don't need implement encryption algorithms yourself. qt includes ssl support under qssl namespace, introduced in qt 4.3. should consider looking under qssl namespace required classes , enumerations.

sharepoint - default values to hidden fields -

i created content type uses checkbox has default value. when save documents of content type default value behaves expected. if make checkbox hidden , create new document content type not assigning default value. when @ xml results search returns documents in content type document created hidden field on doesn't have node hidden field. is there special need hidden field take it's default value? it's not answer of question. can make normal (not hidden) column, , hide forms simple javascript code. can add content editor web part embed necessary js code form.

asp.net mvc - how can I use FirstOrDefault()? -

i have code , want set value viewdate when expression returns no data: viewdata["fix"] = db.prestatusviws.where(c => c.lkpnamefix == "1").firstordefault().numcoefficientfix; can set 0 or "text" that? no, can do?! note: firstordefault(null) cause error. if understand question correctly, following code should solve problem: var p = db.prestatusviws.where(c => c.lkpnamefix == "1").firstordefault(); if(p != null) viewdata["fix"] = p.numcoefficientfix; else viewdata["fix"] = 0;

In Delphi, Is there a way to adjust the line spacing of a TMemo? -

i'm working tmemo component display text in limited space. it's using truetype font doesn't ship windows , installed app when runs. on pc (running windows xp), spacing between each line of text seems 8 pixels. on different pc running windows 7, line spacing seems 14 pixels, pushing bottom row of text out of visibility on memo. so, question this: is caused different versions of windows? it's think different. is there way can adjust value consistent across instances of application, wherever running? alternatatively, there different component use might let me tweak value? tmemo descendent of windows common controls , it's behavior depends on current windows configuration natural different results it. if want display information it's better use components let set texts positions , style precisely trichview. component not free has it's own text rendering engine , let style texts css selectors same in different versions of windows.

arrays - How can we manipulate std class in php? -

is possible add elements stdclasses arrays? array ( [0] => item 1 [1] => item 2 ) stdclass ( [0] => item 1 [1] => item 2 ) is harder manipulate objects compared arrays? since have lots of array functions make use of etc. sure, can add new elements... $object = new stdclass(); $object->item1 = 1; $object->item2 = 2; if want iterate object array should use php spl arrayiterator or recursivearrayiterator . also can use typecasting move array object , back... $array = array('item1', 'item2'); $object = (object)$array; var_dump($object); $array = (array)$object; var_dump($array);

java - 404 with spring 3 -

hi going through first lessons spring 3.i created dynamic web app in eclipse following structure. spring3mvc \src\my.spring.helloworldcontroller.java \webcontent | |-----web-inf\jsp\hello.jsp |-----index.jsp |-----web-inf\web.xml |-----web-inf\spring-servlet.xml |-----web-inf\lib\...*.jar files i created spring-servlet.xml below <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframewo

c# - Ways to cast objects to a generic type -

in relation casting generic type "as t" whilst enforcing type of t and following example private static t deserialize<t>(string streng) t : class { xmlserializer ser = new xmlserializer(typeof(t)); stringreader reader = new stringreader(streng); return ser.deserialize(reader) t; } and private static t deserialize<t>(string streng) { xmlserializer ser = new xmlserializer(typeof(t)); stringreader reader = new stringreader(streng); return (t)ser.deserialize(reader); } i'm used doing object type casting, little confused when found couldn't t . found question above , in solution as t compiler error. but why where t : class necessary when using object t , not when using (t)object ? actual difference between 2 ways of casting object? because as implies cast fail and return null . without : class , t int etc - can't null . (t)obj explode in shower of sparks; no need handle null . as aside (re struct ),

c# - passing Event Arguments of original handler to Routed Event in wpf -

the following code shows normal event , routed event. here have used same event name explaining purposes in reality using routed event. //normal event public event selectedhandler selected; public delegate void selectedhandler(object sender, routedeventargs e); //routed event public static readonly routedevent selectedevent = eventmanager.registerroutedevent( "selected", routingstrategy.bubble, typeof(routedeventhandler), typeof(myusercontrol)); //add remove handlers public event routedeventhandler selected { add { addhandler(selectedevent, value); } remove { removehandler(selectedevent, value); } } i raising these events couple of event handlers follows private void lstvmyview_selectionchanged(object sender, selectionchangedeventargs e) { //normal event raise if (selected != null) selected(this, e); //routed event raise routedeventargs args = new routedeventargs(selectedevent); raiseevent(args); } private void lstvmyview_mous

asp.net mvc - How to prevent users from visiting Deleted action method directly? -

scenario: clicking delete hyperlink on 1 product of product list invoke /product/delete httpget action method. user clicks confirmation button invoke /product/delete httppost action method in turn redirect user /product/deleted httpget action method. i want prevent users skipping /product/delete , directly invoking /product/deleted . before redirecting put tempdata . in deleted action verify if present in tempdata . [httppost] public actionresult delete() { // todo: delete tempdata["deleted"] = true; return redirecttoaction("deleted"); } public actionresult deleted() { if(tempdata["deleted"] == null) { throw new httpexception(404, "not found"); } return view(); } you should aware there price pay this. if user presses f5 while browsing /product/deleted action 404. trying bad design , recommend avoiding it.

jquery - find image src that :contains? -

morning all, i have list of images so: <ul id="preload" style="display:none;"> <li><img src="afx4000z-navy-icon-1_thumb.jpg"/></li> <li><img src="afx4000z-green-icon-1_thumb.jpg"/></li> </ul> using jquery how find image src's within ul#preload contain specific string eg."green" something like... var new_src = jquery('#preload img').attr('src')*** contains green ***; you need use the *= selector : jquery('#preload img[src*="green"]') if want case insensitive, bit more difficult: var keyword = "green"; $("#preload img").filter(function(keyword) { return $(this).attr("src").tolowercase().indexof(keyword.tolowercase()) != -1; });

objective c - How to search locations by given a name in iPhone SDK? -

i want search name (string) , @ least 10 matching locations longitude , latitude. let's type 'jaipur' in search bar, need request map service , 10 locations start 'jaipur'. it seems cannot map kit. could point me few little tips started. seems yahoo maps return json 1 value. api use json parsing , example request helpful. thanks , kind regards, you can access google api http://maps.google.com/maps/geo?q=yoursearchname&output=xml this give details searchname provided. can parse xml , latitude , longitude details. the output can in json , csv also. reference google map api

android - Resuming Home Screen -

i navigate subsequent activities in project , 1 activity want come @ home screen...please suggest exact code it. thanks the trick launch intent action set action_main , category of category_home. something along lines of: intent intent = new intent(intent.action_main); intent.addcategory(intent.category_home); startactivity(intent);

PHP cURL, memory leak when using CURLOPT_RETURNTRANSFER -

the following code in loop. each loop changes $uri new address. problem each pass takes more , more memory. $ch = curl_init(); curl_setopt($ch, curlopt_url, $uri); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_header, 0); $res = curl_exec($ch); curl_close($ch); i worked out if comment out curlopt_returntransfer line leak stops. i use "curlopt_returntransfer, true" can result of curl operation string parse. but, appear memory used store string not parsed each pass. can suggest way clear buffer , recover used memory? there destructor use, i've tried __destruct() can't seem syntax right. thanks c version 5.1.6 of php seems have issue memory leaking when using "curlopt_returntransfer, true" store results of curl string. upgrading 5.3 sorted leak out me. thanks

java - Why does my performance increase when touching the screen? -

for reason fps jumps considerably when move mouse around on screen (on emulator) while holding left mouse button. game laggy, if touch screen (and long moving mouse around while touching) goes smooth. i have tried sleeping 20ms in ontouchevent, doesn't appear make difference. here code use in ontouchevent: // events when touching screen public boolean ontouchevent(motionevent event) { int eventaction = event.getaction(); touchx=event.getx(); touchy=event.gety(); switch (eventaction) { case motionevent.action_down: { touch=true; } break; case motionevent.action_move: { } break; case motionevent.action_up: { touch=false; } break; } /*try { ascentthread.sleep(20); } catch (interruptedexception e) { // todo auto-generated catch block

jquery - get an array of "val" attributes values from the rows of a table -

<table id ='t1'> <tr val='1'></tr> <tr val='2'></tr> <tr val='3'></tr> <tr val='4'></tr> <table> how array = 1,2,3,4 you can use .map() , this: var arr = $("#t1 tr").map(function() { return $(this).attr("val"); }).get(); you can test out here .

mercurial - Is there a way to detect if changes from a branch has been indirectly merged with another? -

let's have 3 named branches a, b , c. there (non ocular) way detect changes c has made a? a ---------------------------- | \ / b | \------------/ | / c \---------/ ------- starting mercurial 1.6.0, can use revsets find this: hg log -r "ancestors(a) , branch(c)" this shows ancestors of on c branch. can use templating extract information need log entries. see hg revsets full details.

MQMessage exploring (using WebSphere MQ .NET API) -

i'm newbie websphere mq, have 1 question regarding mqmessage api. seems receiver of mqmessage should know in advance: the message type written (if writeint readint etc..) the properties names , types (if setbooleanproperty(name) getbooleanproperty(name)) it make no sense me. since if i'm not familiar message structure should explore options until retrieve data in it? help appreciated, guy yes, absolutely correct if message structured data such fixed-length record format, must know in advance format of message in order parse it. on other hand, if message payload tagged data structure (such valid xml) use normal parsing access it. example, might use xpath access xml payload without first knowing exact structure. the methods mention (writeint, readint, etc.) ordinarily used extract data known format , advance buffer pointer next field. however, there methods read , write utf strings. if reason application must process variety of message types, can inquire

java - image upload resolution problems -

when uploading image image io converting resolutions of image what mean uploading image 300 dpi converts 96 dpi why? i not using resizing guess, don't copy image metadata, here goes simplistic example how can done: imageinputstream iis =imageio.createimageinputstream(new file("test.jpg")); imagereader reader = (imagereader) imageio.getimagereaders(iis).next(); reader.setinput(iis, true); iiometadata meta = reader.getimagemetadata(0); bufferedimage image = reader.read(0); /* image manipulations here */ imageoutputstream ios = imageio.createimageoutputstream(new file("out.jpg")); imagewriter writer = imageio.getimagewriter(reader); writer.setoutput(ios); writer.write(meta, new iioimage(image, null, null), null); since you've not provided specific details, i've tested on local files. however, hope provides hint.

Gesture detector with scroll view in android -

i trying implement webview scroll view detect gesture detector swipe left right , right left how do? can give example webview scrolls, not need scrollview . webview handles swipes move left , right, not need gesture detector. hence, solution plain webview .

How to register a Facebook Application via API/PHP? -

i want provide system automatically registers/creates facebook applications users. unfortunately did not find way register new application via api. i know possible, because saw e.g. here: http://apps.facebook.com/applicationbuilderl/setup/new.aspx how can register new facebook application (i need appid, secret , key), form fill out, on website or within facebook app? thanks lot, sebastian this possible using old javascript sdk: http://developers.facebook.com/docs/reference/oldjavascript/fb.connect.createapplication as name of sdk lets assume deprecated stuff , not longer supported and/or removed facebook.

spell checking - Python: check whether a word is spelled correctly -

i'm looking easy way check whether string correctly-spelled english word. example, 'looked' return true while 'hurrr' return false. don't need spelling suggestions or spelling-correcting features. simple function takes string , returns boolean value. two possible ways of doing it: have own file has valid words. load file set , compare each word see whether exists in (word in set) (the better way) use pyenchant , spell checking library python

iphone - Customizing UItabBar Item order -

i want change order of uitabbar items. when log in again, order should maintained. how can done? can me? i've wasted whole day implement this. if willing programmatically should simple: persist index of each view , add each view array in same order doing load: //construct view controllers somehow , add them array in order want them be: [myarr addobject:viewcon1]; [myarr addobject:viewcon3]; [myarr addobject:viewcon2]; construct tabbar using array _tabcontrol = [[uitabbarcontroller alloc] init]; [_tabcontrol setviewcontrollers:myarr animated:yes];

unix - Where does Eclipse store settings *and plugins* in userdir? -

i've installed new linux distro on box , want move eclipse home old /home/username/ new one. because changed desktop [won't tell 1 avoid flamewars;-)] won't copy hidden folders ~/ . directories need have installed plugins? i've copied ~/.eclipse/ , contains files related plugins eclipse won't load them. hints? we've found directory containing stuff accident. somehow broke , eclipse refused start on coworker's computer:-) see ~/workspace/.metadata/.plugins or wherever workspace resides.

iphone - MPMoviePlayerController playback problem -

i'm having trouble playing audio stream using mpmovieplayercontroller in background. on foreground it's playing audio fine, when application goes background, sound disappears , time keeps going. have initialized avaudiosession avaudiosessioncategoryplayback , have put required background modes audio in info.plist file. have set player.useapplicationaudiosession = yes; . possible problem here? in advance :) this ios background link indicates useapplicationaudiosession property value should set no ios 3.2 , newer. (i have app , works fine in background mode.

python - ChoiceField - choices based on boolean field -

i trying have choicefield displays users projectmanager boolean field checked true. having trouble figuring out way though. a little background. when user created, there checkbox can select if project manager or not. if check it, want dropdown choice field display project managers (later, when creating new project). here code snippets help. project - models.py class project(models.model): client = models.foreignkey(clients, related_name='projects') project_manager = models.foreignkey(customuser, related_name='project manager') created_by = models.foreignkey(user, related_name='created_by') ... clients - models.py class clients(models.model): client_name = models.charfield(max_length=255, verbose_name='client name', unique=true) ... class customuser(user): company = models.foreignkey(clients, related_name="belongs to") pm = models.booleanfield(verbose_name='project manager') project forms.py class

How do I make a PowerShell profile if my profile path contains an apostrophe? -

i'm trying set powershell profile of machines have common profile. i'm making each machine's profile run script in dropbox can update of them easier. i thought problem didn't know dot-source syntax well, turns out powershell doesn't path documents folder has apostrophe. full path is: d:\owen's documents\windowspowershell\microsoft.powershell_profile.ps1 if delete file, powershell starts fine (of course, without modifications want.) if create file, error when powershell starts up: the string starting: @ line:1 char:75 + . 'd:\owen`'s documents\windowspowershell\microsoft.powershell_profile.ps1 <<<< ' missing terminator: '. @ line:1 char:76 + . 'd:\owen`'s documents\windowspowershell\microsoft.powershell_profile.ps1' <<<< + categoryinfo : parsererror: (:string) [], parentcontainserrorrecordexception + fullyqualifiederrorid : terminatorexpectedatendofstring it can't fault, becaus