Posts

Showing posts from September, 2011

c# - Saving a cache object when a WCF webservice is ended -

i have simple wcf webservice 2 methods : 1 save/updates obect in cache , other 1 deletes it. how can save object when close webservice server. using cacheitemremovedcallback doesn't work because object removed everytime update it. using global.asax.cs.application_end() doesn't work because cache cleared time here. using dispose() method method doesn't work because called every time call has finished. [servicecontract] public class webservice { [operationcontract] public void test(string message) { list<string> logs; logs = httpruntime.cache.get("logmessages") list<string>; if (logs == null) { logs = new list<string>(); logs.add(message); } else logs.add(message); httpruntime.cache.insert("logmessages", logs, null, cache.noabsoluteexpiration, cache.noslidingexpiration, cacheitempriority.notremovable, null); } [operationcontra

Oracle SQL Statement Order By -

i have got following query: column index_name format a15 heading "index_name" column column_name format a15 heading "column_name" column column_position format 999999 heading "column_position" select index_name, column_name, column_position all_ind_columns table_owner = 'abc' the returned result follows: index_name column_name column_position --------------- --------------- --------------- sys_c007963 c_uname 1 order_line_pkey ol_id 1 order_line_pkey ol_o_id 2 orders_pkey o_id 1 item_pkey i_id 1 customer_pkey c_id 1 country_pkey co_id 1 cc_xacts_pkey cx_o_id 1 author_pkey a_id 1 address_pkey addr_id

ruby on rails - get a model from other controller in emberjs in view -

i got problem bigger project in ember, want information model when i'm in template not associated controller model. i got these templates: <script type="text/x-handlebars" data-template-name="community"> {{model.name}} {{outlet}} </script> //users subroute community <script type="text/x-handlebars" data-template-name="communityusers"> //assume want display community here like: {{community.id}} {{#each user in model}} <li>{{user.name}}</li> {{/each}} </script> in routes fetch appropriate models community got 1 community , in communityusers have array users does know best solution this? i got problem bigger project in ember, want information model when i'm in template not associated controller model. assuming communities this: app.communityroute = ember.route.extend({ model: function() { return app.community.find(); } }); further assuming want

loops - Knowing when to insert a comma in ColdFusion -

every often, either in display code or in assembling string, i'll making list , need figure out how insert commas in list. this how it: <cfset hide_comma=true> <cfloop ... kind of loop ...> <cfif hide_comma><cfset hide_comma=false><cfelse>,</cfif> .... rest of code here ... </cfloop> i'm wondering if there's cleaner way of doing this. realize 1 option following: <cfset output_as_array = []> <cfloop ... kind of loop ...> <cfset loop_output = ""> ... rest of code here, append output loop output instead ... <cfset arrayappend(output_as_array, trim(loop_output))> </cfloop> <cfoutput>#arraytolist(output_as_array, ", ")#</cfoutput> but doesn't seem clearer. in django, in contrast, each loop has built in counter can write like: {% ... kind of loop ... %} {% if not forloop.first %},{% endif %} ... rest of code here ... {% endfor %

javascript - removeattr scroll-sel and Add atriv -

i javascript remove <ul class="selection-list sel-scroll sel-items js-items-unchecked"> remove (sel-scroll) and add code below that this code <link rel="stylesheet" type="text/css" media="all" href="js/jscrollpane.css" /> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.mousewheel.js"></script> <script type="text/javascript" src="js/jscrollpane.js"></script> <script type="text/javascript"> $(function() { $('#pane1').jscrollpane({showarrows:false,scrollbarwidth:10, scrollbarmargin:20}); }); </script> it looks you're using jquery. therefore can do: $('#elementid').removeclass('sel-scroll'); also into: $('.sel-scroll').removeclass('sel-scroll');

c# - Upgrade from Unity3D 4.1.5 to 4.2 causes CS0433 build error -

i trying upgrade 4.1.5 4.2. when , open project created under 4.1.5 " assets/uniject/interface/iresourceloader.cs(8,17): error cs0433: imported type `system.xml.linq.xdocument' defined multiple times " build error. file contains interface 1 property being xdocument. i've google'd quite bit , don't see explanation/solution of problem. the system.xml.linq.dll referenced in each of generated projects, solution building prior upgrade without problems. i have uninstalled everything, wiped \users\*\appdata\roaming\unity , c:\program files (x86)\unity clean , rebooted before doing fresh install , still same build error. i've blown away project gotten fresh copy source control no love. , i've uninstalled 4.2 re-installed 4.1.5 , project builds fine on clean copy (since 4.2 upgraded unity files incompatible 4.1.5 files). what has changed, , how fix can use latest version of unity? thanks, mike

java - i18n on dropdown menu using s:select tag -

this question has answer here: struts select tag localization implementation 2 answers i have dropdown menu in jsp page implemented <s:select> tag <s:select name="priortoapplyinginfo.userprofile.phonenumbers[0].type" listkey="key" listvalue="value" list="phonetypes" headerkey="0" headervalue=""/> now values in dropdown menu list phonetypes implemented hashmap in .java file. phonetypes = new linkedhashmap<integer, string>(); phonetypes.put(new integer(1), gettext("home")); // phone contactbook category business phone phonetypes.put(new integer(daohelperfactory.owner_profile_phone_category), gettext("work")); phonetypes.put(new integer(3), gettext("mobile")); phonetypes.put(new integer(daohelperfactory.owner_profile_fax_category), gettext("fax&quo

json - List<Object> serialization not working with multiple objects -

i have following classes [datacontract] public class video { [key] [datamember(isrequired = false)] public int videoid { get; set; } [datamember(isrequired = false)] public int userid { get; set; } [required] [datamember ] public string title { get; set; } [required] [datamember] public virtual ilist<tag> tags { get; set; } } [datacontract] public class tag { [key] [required] [datamember(isrequired = false)] public int? tagid { get; set; } [datamember(isrequired = true)] [required] public string name { get; set; } [ignoredatamember] public virtual ilist<video> videos { get; set; } } in webapi controller, call this: var videos = _service.getvideos(); return request.createresponse(httpstatuscode.ok, videos); which calls this: public ilist<video> getvideos() { using (var db = createcontext()) { return db.videos.

python - TypeError when doing "ilike or ilike" in an SQLAlchemy filter expression -

i want search users matching on both first name , last name fields. in plain sql do: select * user (first_name ilike 'pattern') or (last_name 'pattern'); i'm trying following sqlalchemy: user.query().filter(user.last_name.ilike(pattern) \ or user.first_name.ilike(pattern)) i following error: typeerror: boolean value of clause not defined in same context, combining 2 exact matchings ( == ) or work, infer issue related ilike being somehow uncompatible or operator. any hints? thanks you cannot use or in way sqlalchemy. has it's own or_ function: query.filter(or_(expr1, expr2)) in specific: user.query().filter(or_(user.last_name.ilike(pattern), user.first_name.ilike(pattern))) the same true and_ , not_ , in_ (and possibly more). think can expr1 | expr2 not sure.

Nested integral within integral2 in matlab -

i'm attempting take double integral (using integral2) of function defined integral. http://i.imgur.com/giuslsw.jpg here attempting: t=linspace(0,1,50); fun_1= @(v) exp(.071*v) fun = @(x,y) exp(0.14*0.00607*integral(@(u)fun_1(u),0,x)).*exp(-(x-y).^2).*exp(0.14*0.00607*integral(@(u)fun_1(u),0,x)); i=2:length(t) j=i:length(t) a(i,j)=integral2(fun,t(i-1),t(i),t(j-1),t(j)); end end i'm receiving error error using integral (line 86) , b must floating point scalars. can provide information on how fix problem. here go: l=3; t=linspace(0,1,365); fun3= @(v) integral(@(v)exp(.071*v),0,v,'arrayvalued',true); i=2:length(t) j=i:length(t) xx=t(i); yy=t(j); fun = @(x,y) exp(0.14*0.00607*fun3(yy)).*exp(-(x-y).^2/l).*exp(0.14*0.00607*fun3(xx)); y(i,j)=integral2(fun,t(i-1),t(i),t(j-1),t(j)); end end it works, slow.

User-generated fields in Django -

i'm building djano application displays set of images, , form each image recording specific image characteristics. user initializes "project", specify set of images displayed assessment. @ project initialization, i'd give user ability add custom boolean fields (i.e. set of checkboxes), can't figure out how build database models. for example, user might initialize my_project image_a.png , image_b.png , image_c.png assessment. default form they'll each image lets them choose between pass, fail , unknown. might wish add custom fields "poorly cropped", "over-exposed" or "blurry" (the idea being image global pass, small failures, specific context of image set, still recorded). generally, i'm trying come way model user-generated fields in django. if correctly understand, don't need dynamic model fields, instead can add model, contains specific attributes image in project, like: class image(models.model):

c# - WCF Data Services Client: How to select matching entities based on a provided T generic type and a Func? -

i'm using wcf data services/odata client library, , if target northwind sample odata store @ http://services.odata.org/northwind/northwind.svc/ , following instruction can retrieve products have quantity bigger 50: var r = context.products.where(w=> w.unitsinstock > 50) my question is, suppose want have generic class must perform operation, instead of hardcoding entity retrieve (products in case) , condition on same entity (unitsinstock > 50), want supply entity object/name , condition func. have following class, imaginary getentitytype function infere entity supplied t, unfortunatelly getentitytype not exist , haven't found how accomplish same task: public class odatatesting<t> { ... public iqueryable<t> returnitem(func<t, bool> selector) { return context.getentitytype<t>().where(w=> selector(w)); } ... } update: i've found createquery method, can used follows: return context.createquery<t

java - Filter Method in searchView Widget for android scala eclipse plugin -

i used searchview widget in android, eclipse scala plugin, want update list after pressing search button, right-now have error in filter method implementation would please give me hints, here filter method: override def getfilter(): filter = { new filter() { protected override def publishresults(constraint: charsequence, results: filterresults) { books = results.values.asinstanceof[list[bookmetadata]] itemadapter.this.notifydatasetchanged() } protected override def performfiltering(constraint: charsequence): filterresults = { val filteredresults: list[bookmetadata] = listbuffer(books.asscala.tolist.filter(b.startswith(constraint.tostring)): _*) val results = new filterresults() results.values = filteredresults results } } } i have error here : books = results.values.asinstanceof[list[bookmetadata]] error: multiple markers @ line - reassignment val - reassignment val one error b. val filteredresul

php - PDO query class -

i'm tinkering class 'should' allow me execute fetchall query , display results within foreach statement. assume working correctly have no errors. foreach - must problem? how foreach results gained $connect->query() ? i'm new using database oop framework in functions along wrong lines completely. <? error_reporting(1); class dbconnect { private $host; private $database; private $username; private $password; private $pdo; private $error; public function __construct() { $this->host = "localhost"; // host $this->database = "images"; // database name $this->username = "*"; // username $this->password = "*"; // password $options = array( pdo::mysql_attr_init_command => 'set names utf8' ); try { $this->pdo = new pdo("mysql:host={$this->host};dbname={$this

TEX filter in Moodle merging overlines -

Image
i using tex filter write digital logic expressions in moodle , running in significant issue. if write $$ \overline{a}\overline{b}\overline{c} $$, filter displays overlines single overline instead of 3 separate overlines. inserting individual spaces not seem work either. it doesn't seem typeface issue; changed bold math typeface , same issue appears. is there way insert hard space between characters in tex math? or way split overlines? thanks! @mlau fractions in tex simple, long remember rules. $$ \frac{numerator}{denominator} $$ produces

objective c - Sqlite not inserting data once the application is stopped and execute again iPhone -

im developing simple application in creating sqlite database , insert data it. working fine , data insert table. but when stop application(in xcode) , run again data not inserting database. this code used: +(dbmanager*)getsharedinstance{ if (!sharedinstance) { sharedinstance = [[super allocwithzone:null]init]; [sharedinstance createdb]; } return sharedinstance; } -(bool)createdb{ nsstring *docsdir; nsarray *dirpaths; // documents directory dirpaths = nssearchpathfordirectoriesindomains (nsdocumentdirectory, nsuserdomainmask, yes); docsdir = dirpaths[0]; // build path database file databasepath = [[nsstring alloc] initwithstring: [docsdir stringbyappendingpathcomponent: @"schedulerdatabase.db"]]; bool issuccess = yes; nsfilemanager *filemgr = [nsfilemanager defaultmanager]; if ([filemgr fileexistsatpath: databasepath ] == no) { const char *dbpath = [databasepath

osx - Map NSEvent keyCode to virtual key code -

nsevent keycode gives keyboard scan code, hardware specific code representing physical key. want convert scan code virtual key code, logical key based on users keyboard layout (qwerty, azerty, etc). in windows can via mapvirtualkey . os x equivalent? the virtual key code precisely not based on user's keyboard layout. indicates key pressed, not character key produce nor how it's labeled. for example, kvk_ansi_a (from carbon/hitoolbox/events.h, value 0x00 ) not mean key produces 'a' character, means key in position 'a' key in ansi standard keyboard. if french keyboard layout active, key produce 'q'. if physical keyboard french keyboard, key labeled 'q', too. so, virtual key code sort of akin scan code, idealized, standard keyboard. is, noted, hardware-independent. independent of keyboard layout. to translate virtual key code character, can use uckeytranslate() . need 'uchr' data current keyboard layout. can using ti

c# - Webbrowser dialog popup block -

i developing program has invisible web browser control used loading data web pages. however, having trouble blocking type of popup. this code using block popups private void webbrowser1_newwindow( object sender, system.componentmodel.canceleventargs e) { e.cancel = true; } i have tested on http://www.popuptest.com/ , fails block come & go test , modeless window test. http://i75.servimg.com/u/f75/13/13/40/49/b11.png is there way block these popups? this javascript shows popups function modelesswin(url,mwidth,mheight){ if (document.all&&window.print) //if ie5 eval('window.showmodelessdialog(url,"","help:0;resizable:1;dialogwidth:'+mwidth+'px;dialogheight:'+mheight+'px")') else eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")') } modelesswin("http://www.popuptest.com/popup1.html&qu

algorithm - What is the worst-case time for insertion sort within merge sort? -

recently stumbled upon problem introduction algorithms edition 3 problem 2-1: although merge sort runs in o(n logn) worst-case time , insertion sort runs in o(n^2) , latter runs faster small problem sizes. consider modification merge sort in n/k sublists of length k sorted using insertion sort , merged using standard merging mechanism. (a) show insertion sort can sort n/k sublists, each of length k, in o(nk) worst-case time. the answer given is: ans: insertion sort takes (k^2) time per k-element list in worst case. therefore, sorting n/k lists of k elements each takes (k^2 n/k) = (nk) worst-case time how (k^2 n/k) given data?? im not understanding @ , greatlly appreciate explanation. the sublists of length k, therefore insertion sort takes k^2 each sublist. now, there n/k sublists in total, so, n/k * k^2 nk . key understanding here there n/k number of sublists, , insertion sort takes k^2 time sort each one. another thing note, knowing merge so

How to send a Javascript/Ajax variable to a php page using AJAX -

function rungetiperfspeedajax(speedvar, actualip) { var xmlhttp = getajaxobject(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { processiperfrequest(xmlhttp.responsetext, speedvar); } } xmlhttp.open('get', 'lib/getiperfspeed.php', true); xmlhttp.setrequestheader('content-type', 'application/x-www-form-urlencoded'); xmlhttp.send(); } function processiperfrequest(response, speedvar) { alert("proccess"); document.getelementbyid(speedvar).style.display = 'none'; document.getelementbyid('displayspeedtest').style.display = 'block'; document.getelementbyid('displayspeedtest').innerhtml = response; } getajaxobject() not included standard. making onclick javascript call calls rungetiperfspeedajax . works if hard set ip in "lib/getiperfspeed.php". cannot seem pass actualip &quo

php - Looping through letters not working -

i have function, loops on excel columns. working yesterday, having issues. function returning false according var_dump() isn't entering loop (i have echoed out "here" within loop , nothing echoed). why isn't working? $max_col return correct maximum column function get_col(phpexcel $excel, $search, $row = 5, $col = "a"){ $max_col = (string)$excel->getactivesheet()->gethighestcolumn(); // returns bh for($i = (string)$col; $i <= $max_col; $i++){ $val = trim($excel->getactivesheet()->getcell("{$i}{$row}")->getvalue()); $search = preg_quote($search); if(preg_match("/$search/isu", $val)){ return "$i"; } } return false; } here how calling function: $col = get_col($excel, $sku, 5, "q"); var_dump($col); using <= comparison strings cause problems because it's alphabetic comparison, , alphabetically "c" >

HTML/Javascript Confusion -

i have extremely basic html document written following: <html> <head> <title>a basic javascript game</title> </head> <body> <script language="javascript" src="mygame.js"> </script> </body> </html> i've created according javascript file, have made sure it's syntax alright. first line of mygame.js file is: var persontotalkto = prompt("you wake 1 saturday morning. holidays started, , can't wait tell family you've decided of go on vacation! talk to: wife, son, or daughter?").touppercase(); but when open html file, i'm not getting prompt whatsoever. have javascript enabled, problem? change script tag either html4 version: <script type="text/javascript" src="mygame.js"></script> or html5 <script src="mygame.js"></script> (either work on browser released millennium.)

android - Write/Read then Save text file Basic4Android -

i'm creating application on basic4android collects gps coordinates , equipment deficiencies in dropdown list (spinner). gps coordinates consists of latitude , longitude shows on label field when gps on , deficiencies shows under spinner field (e.g. dropdown of "broken cross arm", "broken insulator","rusty structure"). able done , create "submit" button should copy 3 fields (longitude, latitude , deficiencies) text file. idea how store these fields everytime press submit? using application inspection when walk transmission tower, record coordinates , obvious deficiency file on android. thank you, eli there several ways it. simplest add values map , use file.writemap / readmap. see tutorial: http://www.basic4ppc.com/android/forum/threads/6690/#content

C++/C Best way to detect when a folder contents changed and send the files that do via HTTP -

what's best way scan folder , notified when new file has been created. i'm using windows xp , need solution in c++ or c. need send files via http server. wondering best solution this? open using third party library. thank help. use findfirstchangenotification function file_notify_change_file_name last argument. it return handler need observe waitforsingleobject. second function wait specified amound of time or notification handler. if break manualy, use msgwaitformultipleobjects instead , provide 2 handles: first handle 1 findfirstchangenotification, , second can handler own event (use createevent create it) can trigger setevent(handle_you_get_from_createevent)

php - Why does my XAMPP control panel crash every time I stop apache? -

i trying enable extensions in php. if want initiate changes have reset apache server in xampp. keep getting window says xampp-control.exe has stopped working , gives me options: debug program close program check online solution , close program no matter option choose give me application error: exception eaccess in modele 'xampp-control.exe' @ 001abefe. access violation @ address 005abefe in module 'xampp-control.exe'. read of address 00000042. have read should install wampp server. there way can reset apache server?

jquery - What is the best practice to update / edit form fields in php and mysql? -

this may sound typical question, wasn't able find decent answers on stackoverflow. i've built adding , deleting items php form. let's have simple structure this: database |car_id(pk)|year | make | model | vin | -------------------------------------------------- | 1 | 2001 | toyota | corolla | 12345 | | 2 | 1999 | ford | fiesta | 67890 | | 3 | 2013 | gmc | yukon | abcde | car class class car { public car_id; public year; public make; public model; public vin; //unique, can 1 in db function addcar(){...} function editcar(){...} function deletecar(){...} } php: cars.php?do=edit this want run functions class , display templates using smarty viewer edit_cars.html when page loads, pulls values db , creates forms values in them, user can overwrite values or delete them. question 1: should check if vin(vehicle identification number, can 1 unique number in database) matches car exists

c# - OleDB Like query using DataAdapter -

below function goes database , pulls controlnumber similar 1 in database. can see commented out section near top, want replace last 3 digits of controlnumber wildcard indicators ( ) way search database controlnumbers similar 1 below line ("1289 **") inside database, can use query "select * orders control_number '1298***';" , rewarded correct information. when try in code using method returned 0 rows. any help? note: going access database, not mysql public string abscheckcontrolnumberforaccuracy(string _controlnumber,string _zip,string _state, string _city) { //_controlnumber = _controlnumber.remove(_controlnumber.length - 3) + "***"; _controlnumber = "1298***"; oledbconnection conn = new oledbconnection(straccessconntaxcert); string query = "select * orders control_number @_controlnumber;"; oledbcommand cmd = new oledbcommand(query, conn);

javascript - Is it possible to bind a date/time to a console log? -

i have following code: var mylog = console.log.bind(console, '[debug]'); which works find when want log things prepended [debug] console. want add date/time log , tried this: var mylog = console.log.bind(console, '[debug ' + (new date) + ']'); which not work because always logs same time (the time .bind called). is there way (using .bind ) log current time on each log without having this: var mylog = function(){ var args = ['[debug ' + (new date) + ']']; for(var = 0; < arguments.length; ++i) { args.push(arguments[i]); } return console.log.apply(console, args); }; ? because above method shows me line console.log.apply called , not line mylog called. yes. http://jsfiddle.net/swfjg/6/ var debug = (function(){ var timestamp = function(){}; timestamp.tostring = function(){ return "[debug " + (new date).tolocaletimestring() + "]"; }; return

android - rs_graphics.rsh part of Renderscript graphics engine that has been deprecated? -

i started use renderscript. saw renderscript examples under "sdk/samples/android-15/renderscript" folder, have line: #include "rs_graphics.rsh" in examples under "sdk/samples/android-18", don't see line more. understand renderscript graphics engine has been deprecated. i'd confirm "rs_graphics.rsh" part of deprecated engine, , should not used? thanks in advance. correct, rs_graphics.rsh has been deprecated , should not used.

jquery - input type Reset Button Not clearing form perfectly -

here code: <form name="f1" method="get"> <r><label for="wlk_logo_align">logo alignment</label><br/> <div class="leftdropdown leftdropdown-dark"> <select id="select1" name="s1" class="leftdropdown-select" > <option value="default" selected="selected">default <option value="http://www.java2s.com">java2s.com <option value="http://www.google.com">google <option value="http://www.msn.com">msn <option value="http://www.perl.com">perl.com <option value="http://www.php.net">php.net </select> </div> </r> <r><label for="wlk_logo_align">color scheme</label><br/> <div class="leftdropdown leftdropdown-dark"&

c++ - Javascript function only works within a function (with c interface) -

i new javascript , writing api getting server status c++ code that's running underneath. understand question may (or may not) project dependent, i'm wondering if has insight of possibly wrong here. so want call "checkserverstatuscpp()" function, implemented in c++ on "manager.cpp". (i reusing else code , need compile , interface automatically generated. attach info possible.) i found if wrap call within function, native c++ code executed. a = function(){ manager.getserverstatuscpp(); }; a(); // no problem calling function in manager.cpp otherwise won't work manager.getserverstatuscpp(); // function getserverstatuscpp() in manager.cpp never called. here related files. home.html <!doctype html> <head> <!-- other js/css files in here. --> <script type="text/javascript" src="js/interface.js"></script> <script type="text/javascript" src="js/system.media

javascript - Add a marker to an embedded google map? -

i'm having hard time adding marker map. used use map engine , embed maps option has become limited in new maps. managed embed map new design using function, haven't been able manage add red marker it. code: function initialize() { var map_canvas = document.getelementbyid('map_canvas'); var map_options = { center: new google.maps.latlng(-34.443809, -58.866677), zoom: 14, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(map_canvas, map_options); } google.maps.event.adddomlistener(window, 'load', initialize); i think add marker must this: var i=new google.maps.marker({ position:new google.maps.latlng(-34.443809,-58.866677), map:map_canvas }) but can't figure out how documentation. how can add marker middle of map? function initialize() { var map_canvas = document.getelementbyid('map_canvas'); var map_options = { center:

Javascript Variables - Select and Mix -

i have 2 3 variables want mix strings , place them table, can't figure out how make variables mix. what have document.write('<table cellspacing="0" cellpadding="5">') var = ["string1", "string2"] var n = ["string3", "string4"] for(var i=0; <a.length; i++){ document.write('<tr'> document.write('td' + (a[i]) + (b[i]) +'</td>') document.write('</td>') } document.write('</table>') this create table want doesn't perform function looking for. it creates table goes: "string1" "string3" "string2" "string4' i'm looking for: "string1" "string3" "string1" "string4" "string2" "string3" "string2" "string4" hopefully makes sense. i've tried searching through internet , on stack over

excel - How do I search a column for cells that contain certain text, and copy that cell into a new column? -

im pretty new @ vba code in excel, , looking run piece reference string of text in column or column b, , spit out complete value in column c. so, if word "test" appears in cell in column or column b - paste value in list format in column c. its important note search doesnt need match exactly, needs find word "test" - ie: "123test123" in column still pass , "123test123" written column c. any appreciated on this! thanks! try this: sub dural() dim ab range, r range, k long set ab = range("a:b").cells.specialcells(xlcelltypeconstants) k = 1 each r in ab if instr(1, r.value, "test") > 0 r.copy cells(k, "c") k = k + 1 end if next end sub

java - Make app more effecient by eliminating extra codes -

i have following code starts a way z : if (someid.matches("a") || someid.matches("a")) { tvletcap.settext("a"); tvletlow.settext("a"); ivlettericon.setimageresource(r.drawable.apple); btndisplayword.settext("a apple"); btnplay.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { stopplaying(); mpsound = mediaplayer.create(myclass.this, r.raw.a); mpsound.setlooping(false); mpsound.start(); btnplay.setvisibility(view.gone); btnstop.setvisibility(view.visible); btnstop.setonclicklistener(stopsound); mpsound.setoncompletionlistener(new oncompletionlistener() { @override public void oncompletion(mediaplayer mp) { btnplay.setvisibility(view.visible); btnstop.setvisibility(view.gone); } });

Making a timer in Python -

what want do, example: print like, "welcome program" create timer x seconds, after x seconds have passed, next thing, prints else like, "to start type hello" the time library useful: >>> import time >>> print "hello" hello >>> time.sleep(5) # 5 second pause >>> print "done" done that pause execution of program 5 seconds, during time.sleep(). if want other things during pause, becomes more complicated question, , should threading

php's imap_fetch_overview() date field format as MySQL timestamp -

php's imap_fetch_overview() date key date format this: thu, 22 aug 2013 07:53:32 -0400 yikes. possible customize format of date? not seeing in docs assume not. need convert mysql's timestamp format. you can't customize included php function/library without rewriting , recompiling source. class customized, or inherited , adjusted. in case, can simple strtotime() of date/time. convert mysql datetime. $array=imap_fetch_overview(); $unixtimestamp=strtotime($array['date']); echo date("y-m-d h:i:s", $unixtimestamp);

ruby on rails - How to make simple_form input field wider with CSS? -

this dumb question. trying make simple_form input field wider. here simple_form css posted on github: /* ----- simpleform styles ----- */ .simple_form div.input { margin-bottom: 10px; clear: both; /* required webkit, not gecko */ } .simple_form label { float: left; width: 100px; text-align: right; margin: 2px 10px; } div.boolean, .simple_form input[type='submit'] { margin-left: 120px; } div.boolean label, label.collection_radio_buttons { float: none; margin: 0; } label.collection_radio_buttons { margin-right: 10px; vertical-align: -2px; margin-left: 2px; } .field_with_errors { background-color: #ff3333; } .simple_form .error { clear: left; color: black; display: block; margin-left: 120px; } .simple_form .hint { clear: left; margin-left: 120px; color: #555; display: block; font-style: italic; } input.radio { margin-right: 5px; vertical-align: -3px; } input.check_boxes { margin-left: 3px; vertical-align: -3px; }

php - My Nivo slider doesn't loads on Chrome Or IE -

nivo slider loads in firefox , tried solutions helped others putting width , height slider , adding latest jquery link in header. still doesn't want appear. link site : http://www.travisblacklaw.com/ any appreciated! you loading jquery 2 times in website, keep latest , remove 1.6.4 <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script type='text/javascript' src='http://www.travisblacklaw.com/wp-content/themes/theme05/js/jquery-1.6.4.min.js?ver=1.6.4'></script> gprofiles.js using jquery.on not found in 1.6.4 uncaught typeerror: object [object object] has no method 'on' multiple javascript errors since seems using ajax call url not in same domain yours. jquery.jsonp can call external urls. blocked frame origin " http://www.linksalpha.com " accessing frame origin " http://www.travisblacklaw.com ". protocols, domains, , ports must match.

javascript - ng-click to update a model won't work without invoking method on scope -

i have simple widget i'm building has multiple panes. i'm trying switch between them way of font-awesome icons along top. $scope has model selected i'd update when people click 1 of icons. i have been able accomplish invoking method off of $scope , so: <i ng-repeat="cat in widget.data" ng-click="updateselected(cat.type)"> </i> and in controller: $scope.updateselected = function (type) { $scope.selected = type; }; however, i'd more directly updating selected model directly in ng-click attribute, so: <i ng-repeat="cat in widget.data" ng-click="selected=cat.type"> </i> i've not been able work i'm wondering -- supposed able directly update model in fashion? or need write handler function?

c++ - Template member functions, static local variables and destruction order -

first of all, sorry english: i've designed little library manage memory program uses. implements kind of shared object memory management purposes. have following classes (i omit other members , functions don't need here explain problem): a parametric struct called packet contains subobject of type t , counter: template<class t> struct packet { t t; unsigned counter; }; a parametric class called ptrstack : stack destructor calls delete each pointer stack contains, when destructor called: template<typename t> struct ptrstack : public std::stack<t*> { ~ptrstack() { while(!this->empty()) { delete this->top(); this->pop(); } } }; a class called pool static parametric function (and other code, of course) returning reference ptrstack : class pool { template<class t> using stack_tp = ptrstack<packet<t> >; public: template<class t> static stack_tp<

r - Re-ordering factor levels in data frame -

this question has answer here: reorder levels of factor without changing order of values 6 answers i have data.frame shown below: task measure right m1 left m2 m3 down m4 front m5 m6 . . . the task column takes 6 different values, treated factors, , ordered r as: "back", "down", "front", "left", "right", "up". how ever, need them ordered as: "up", "down", "left", "right", "front", "back". when use data in ggplot, related tasks (such "up" , "down") plotted next each other. how can change ordering of levels of factor "task"? assuming dataframe mydf: mydf$task <- factor(mydf$task, levels = c("up", "down", "left", "right", "front",

java - javac is not working and giving message "javac is not recognized " -

this question has answer here: javac not recognized internal or external command, operable program or batch file [closed] 6 answers i made simple java file extension .java , have set javac path variable c:\program files\java\jdk1.7.0_25\bin it's not working , giving message "javac not recognized internal or external command , operable program or batch file " .i closed cmd , reopen not worked . would suggest following: go path c:\program files\java\jdk1.7.0_25\bin, run javac. if javac runs after going path check path environment variable, go command prompt type path , press enter, make sure java bin path there. if dont see java bin in previous step, edit path environment variable. cheers !!

asp.net - showing The Error "ConnectionString property has not been initialized" periodically -

i have website in vb.net , sql server high number of users. problem during day, website throws exception , not show parts of webpage. authentication performed using session , cookies. session id s written in database table , after signing out deleted. not know happens when restart iis problem obviated after time appears again. stack trace of log file below. problem? userid:rezagmc3 sessionid:uup5l0koj3eacxl3pcqdxmbz form data: no form data found1: error description:the connectionstring property has not been initialized. 1: source:system.data 1: stack trace: @ system.data.sqlclient.sqlconnection.permissiondemand() 1: @ system.data.sqlclient.sqlconnectionfactory.permissiondemand(dbconnection outerconnection) 1: @ system.data.providerbase.dbconnectionclosed.openconnection(dbconnection outerconnection, dbconnectionfactory connectionfactory) 1: @ system.data.sqlclient.sqlconnection.open() 1: @ sorathesab.sqlhelperparametercache.discoverspparameterset(sqlconnection

html - Fully compliant and semantic approach to full viewport height sections -

i'm looking construct min-height: 100% sections , seems general consensus : html{ height: 100%; } body { min-height: 100%; } and direct children have min-height: 100% well. problem can't wrap head around if html has fixed height 100% while body may allowed grow, hasn't shot out of page , document not semantic, i.e. html < body. also, if section wrapped in several other divs, parents require min-height: 100% well. seems little unconventional. what elegant approach it? know height:100vh best approach if supported browsers. better use javascript obtain viewport , set interested sections' height property? the "unconventional" issue true , conventional . see, browsers calculate "horizontal" layout, not vertical unless explicitly set. if want item have height of 100%, you'll need set height explicitly it's ancestors browser can calculate dimensions.

html - Font color of placeholder difference between Firefox 23.0.1 Chrome 23.0.1271.64 and IE 8 -

Image
i changed placeholder font color of input field blue, i've tested in chrome, it's color blue. in ff 23.0.1, color "lighter" blue. see contrast below, note "month" within span , color blue: in chrome, it's fine, see below: however, in firefox 23.0.1, looked this: in ie8, not display: note difference of color. below css code using: .month_span { color: blue; } .input::-webkit-input-placeholder { color:blue} .input::-moz-placeholder { color:blue; } /* ff 19+ */ .input:-moz-placeholder { color:#bbb; } /* ff 18- */ .input:-ms-input-placeholder { color:#bbb; } my question:1. why color lighter in ff? 2. how display placeholder value in ie? the placeholder attribute isn't supported ie until ie 10, explains that. firefox apparently applies opacity:0.54 placeholder text: http://css-tricks.com/snippets/css/style-placeholder-text/ this fix: .input::-moz-placeholder { color:blue; opacity: 1; } /* ff 19+ */ .input:-moz-pl

javafx 2 - Hot to update dynamically font size -

Image
i have css file sets default font size , type in javafx application: .root { -fx-font: 13px tahoma; } scene.getstylesheets().add(getclass().getresource("/styles/styles.css").toexternalform()); i want update size , font type java code dynamically of root component (all components). how can this? note: code updates font type , size of components javafx application. please consider taking @ official javafx documentation . there find code example answers question: text t = new text("that's text"); t.setfont(font.font ("verdana", 20)); update in application controller instance of root pane, e.g. anchorpane , use setid("") function set new style whole pane (my actionchange connected button on pane, triggers event/change): public class appcontroller implements initializable { @fxml private anchorpane mainpane; @override public void initialize(url arg0, resourcebundle arg1) { // todo auto-gene

meteor - How to pass login callback to form error in Meteorite with Mesosphere? -

i using mesosphere form package own custom login page. heres login form: mesosphere({ name: "loginform", method: "login", fields: { usernameemail: { required: true, format: /^[a-za-z0-9_]{2,25}$/i, message: "only alphanumeric usernames", transform:["trim"] }, password: { required: true, message: "6-25 characters please", rules:{ maxlength:25, minlength:6 } } } }); once validate object, want make sure this user login information valid, if not pass information rendered error. meteor.methods({ login: function (rawformdata) { var validationobject = mesosphere.loginform.validate(rawformdata); console.log("logging in..."); if (!validationobject.errors) { meteor.loginwithpassword(validationobject.formdata.usernameoremail,