Posts

Showing posts from April, 2015

regex - Whole word matching with dot characters in MySQL -

in mysql, when searching keyword in text field "whole word match" desired, 1 use regexp , [[:<:]] , [[:>:]] word-boundary markers: select name tbl_name name regexp "[[:<:]]word[[:>:]]" for example, when want find text fields containing "europe", using select name tbl_name name regexp "[[:<:]]europe[[:>:]]" would return "europe map", not "european union". however, when target matching words contains "dot characters", "u.s.", how should submit proper query? tried following queries none of them correct. 1. select name tbl_name name regexp "[[:<:]]u.s.[[:>:]]" 2. select name tbl_name name regexp "[[:<:]]u[.]s[.][[:>:]]" 3. select name tbl_name name regexp "[[:<:]]u\.s\.[[:>:]]" when using double backslash escape special characters, suggested d'alar'cop, returns empty, though there "u.s. congress" in

c# - Updating Listbox results in " Invalid cross-thread access." -

i building rss feed reader.i created starter app using visual studio.on it's main page added link new pivot page.all rss thing happens in pivot page.now in rss feed listbox,i set list items using following code: public pivotpage1() { initializecomponent(); getmethenews(); addtocollection("android going up","techcrunch"); lstbox.datacontext = thecollection; } private void addtocollection(string p1, string p2) { thecollection.add(new newsarticle(p1,p2)); } here other 2 functions rss fetched server , parsed,but when want add processed entries observablecollection in gettheresponse() method,it results in invalid cross thread access error.any ideas? code: private void getmethenews() { string url = "http://rss.cnn.com/rss/edition.rss"; httpwebrequest webrequest = (httpwebrequest)httpwebrequest.create(url); webrequest.begingetresponse(gettheresponse, webrequest); } private void gettheresponse(iasyncresult result

xcode - How to stop masterdetail from going to detail -

the xcode masterdetail template comes loaded ">" symbol on right of each row. if click row, switches detail view. how block the">" symbol , how stop changing views? go file named "main.storyboard" in project. you'll see right 2 of 3 view controllers labeled master view controller , detail view controller. then, located arrow in between them. segue between 2 view controllers. if select clicking circle in center of , hit delete key on keyboard remove segue, stop transition happening. have set cells deselect after select them.

javascript - gRaphael: trouble accessing multiples papers -

i have page there 2 pie graphs generated using graphael. use couple plug-ins create .png papers. problem no matter uses first paper, if use correct reference (i.e. image first graph if second). here's code: //make sure element exists before creating pie chart if(document.getelementbyid("hour_pie")) { //extract labels graphael appropriate format totalarry=new array(); for(var key in hours_total) { totalarry.push(hours_total[key]); } //create canvas var hourpaper = raphael("hour_pie"); //create pie chart var hourpie=hourpaper.piechart( hourpaper.width/2, // pie center x coordinate hourpaper.height/2, // pie center y coordinate 200, // pie radius totalarry, // values { legend: hours_pie_labels }

java - tuckey urlrewrite not working for query variable in url-rewrite -

i using tuckey urlrewrite filter clean url in jsf on glassfish. following rule of filter (which not working): <rule> <from>^/user/(.*)$</from> <to>%{context-path}/faces/testuser.xhtml?username=$1</to> </rule> i getting http-404, requested resource () not available. the filter works when give "to" tag follows (i.e. type=redirect): <to type="redirect">%{context-path}/faces/testuser.xhtml?username=$1</to> another rule working fine forward: <rule> <from>/home</from> <to>faces/index.xhtml</to> </rule> following filter configuration in web.xml <filter> <filter-name>urlrewritefilter</filter-name> <filter-class>org.tuckey.web.filters.urlrewrite.urlrewritefilter</filter-class> </filter> <filter-mapping> <filter-name>urlrewritefilter</filter-name> <ur

Access array of C++ structs from Fortran? -

in c++, allocate array of s. in fortran, want access elements of array. how can this? c++: struct s {double a; double b;}; s *arrayofs; arrayofs = (s *)new s[123]; // allocate fortran 2003: use iso_c_binding type, bind(c) :: sfortran real(c_double) :: a,b end type sfortran s , sfortran should interoperable, need have way access elements of array declared in c++. i'd have sc(5)%a in fortran correspond arrayofs[4].a in c++. how declare , set proper value fortran array sc have access? you could: 1) pass c++ array fortran bind(c) procedure takes appropriate array argument. subroutine proc(array) bind(c, name='proc') ... type(sfortran) :: array(*) with approach might want pass size of array across , make array argument explicit shape. b) have array pointer extern "c" global on c++ side, , interoperate through fortran module variable bind(c). module some_module use, intrinsic :: iso_c_binding, only: c_ptr, c_f_pointer ... type(

java - why does XMLEncoder miss a property? -

i have java class class go { public boolean issha1() { return true; } public string getsha1() { return this.sha1; } public string setsha1(string sha1) { } ... } when attempt encode using java's java.beans.xmlencoder, outputs properties except sha1. it's it's skipping property! you aren't following javabeans specification, don't expect handle arbitrary naming. javabeans says if finds pair of accessors, void setx(y) , y getx() , x identified read-write property of type y . it's specific type, y , being same in both cases. (the notation mine, i'm trying illustrate in concrete manner.) if getx() method missing, x write-only property. if setx(y) missing, x read-only property. properties type boolean have special treatment. if there's method boolean isx() , used read access property. it's okay if there's boolean getx() method too, won't utilized. in code, setsha1() ignored default introspecti

issue with subdomain routing in symfony 2.3.2 -

so have 2 sites, 1 @ somethin.site.com, , routed somethin.site.com/prefix/ i'd move /prefix/ bundle somethinelse.site.com, i've changed route set bit: my_bundle: resource: "@mybundle/resources/config/routing.yml" host: %host% requirements: _scheme: https the problem when go either url, somethin.site.com, or somethinelse.site.com, receive main site bundle, has prefix of '/'. there i'm missing? edit : interestingly, moving host , main_host params under requirements got sort of work. problem going wrong subdomain. if switch names or requirements, both subdomains route same bundle again. possibly due having multiple subdomains, ie (staging.sub1.site.com , staging.sub1.site.com)? pastebin of routing.yml in routing first match wins. main bundle may imported before specific bundle. either move my_bundle import first or set host: %main_host% other imports.

Django-allauth: custom signup form for socialaccount -

i have found in this question (and doc) 1 can use account_signup_form_class define custom form field presented during account registration. however, form not seem appear in flow of using social account (at least not default). is there way have it, or customize handlers introduce such step ? otherwise, give quite non-unified signup process (people using social accounts have go , fill information afterwards in settings screen, rather being asked once). as of can defined socialaccount_forms in settings set own custom social signup form: socialaccount_forms = { 'signup': 'myproject.myapp.forms.customsocialsignupform' }

struct - How to accept as one data type and store in a defined structure using functions in C? -

im having trouble, returning defined structure, function scan_sci suppose take input source string representing positive number in scientific notation, , breaks components storage in scinot_t structure. example input 0.25000e4 #include <stdio.h> #include <stdlib.h> #include <math.h> typedef struct{ double mantissa; int exp; }sci_not_t; int scan_sci (sci_not_t *c); int main(void){ sci_not_t inp1, inp2; printf("enter mantissa in range [0.1, 1.0) exponent: "); scan_sci(&inp1); printf("enter second number same specifications above: "); scan_sci(&inp2); system("pause"); return 0; } int scan_sci (sci_not_t *c){ int status; double a; int b; status = scanf("%lf %d", &c->mantissa, &c->exp); = c->mantissa; b = c->exp; *c = pow(a,b);

c++ - Getting error code C2228: left of '._Ptr' must have class/struct/union -

i getting strange error code when try execute line of code. ctype += file_size(is_directory( d->status())); here part of code leading error. void scan(string switches, path const& f, unsigned k = 0) { // declare file types long long cpptype = 0, ctype = 0, htype = 0, hpptype = 0, hxxtype = 0, javatype = 0, totalclasstype = 0, avitype = 0, mkvtype = 0, mpegtype = 0, mp4type = 0, mp3type = 0; int cpp = 0, c = 0, h = 0, hpp = 0, hxx = 0, java = 0, totalclass = 0, avi = 0, mkv = 0, mpeg = 0, mp4 = 0, mp3 = 0; int totalbytes = 0; string indent(k, '\t'); directory_iterator temp; directory_iterator d(f); //f = first file in folder processed directory_iterator e; // signals end of folder bool isreverse = false; bool isrecursive = false; path pth; pth = d->path(); (unsigned check = 0; check < switches.size(); ++check) { if (switches

ruby - Is there a way to access rendered content in Jekyll? -

in jekyll, there way access rendered content of post page? here's scenario: suppose wanted create blog index page listing bunch of posts. each post uses different layout (text, photo, tweet, etc). there way jekyll render each post layout specified inside of post , hand me rendered content can put summary page? (i'm 97% sure saw exact question asked , answered somewhere here on stack overflow, cannot life of me find it. if point me it, grateful! of course, original solutions appreciated!) (edited make clear want dynamic access rendered content. not after fact in _sites directory, while building site.) post.layout is layout of 1 post, it's default post so, think, can this {% post in site.posts %} {% if post.layout == 'layout1' %} something, such put array ... {% else if post.layout == 'layout2' %} // here 'else if' may not correct liquid syntax else {% endif %} {% endfor %}

python - How to calculate the angle of the sun above the horizon using pyEphem -

i'm new pyephem , simple question. want calculate angle of sun above horizon @ gps point , date. code follows: import ephem import datetime date = datetime.datetime(2010,1,1,12,0,0) print "date: " + str(date) obs=ephem.observer() obs.lat='31:00' obs.long='-106:00' obs.date = date print obs sun = ephem.sun(obs) sun.compute(obs) print float(sun.alt) print str(sun.alt) sun_angle = float(sun.alt) * 57.2957795 # convert radians degrees print "sun_angle: %f" % sun_angle and output is: python suntry.py date: 2010-01-01 12:00:00 <ephem.observer date='2010/1/1 12:00:00' epoch='2000/1/1 12:00:00' lon=-106:00:00.0 lat=31:00:00.0 elevation=0.0m horizon=0:00:00.0 temp=15.0c pressure=1010.0mbar> -0.44488877058 -25:29:24.9 sun_angle: -25.490249 why alt negative? gps location somewhere in mexico , i've specified 12 noon in date parameter of observer. sun should pretty directly overhead have thought alt variable retur

drupal - Form inside view not working when ajax enabled -

Image
using php field add inside view, form button trigger action related record, work prefect long ajax not enable in view if enable ajax , use ajax pager , forms in first page working fine, if go next page, click on button , submit handler never called. function rs_references_publish_button($reference_id){ $reference_entity=entity_load_single('site_object',$reference_id); $reference_wrapper = entity_metadata_wrapper('site_object', $reference_entity); if($reference_wrapper->field_reference_status->value() == 'completed'){ $button= drupal_get_form('rs_references_publish_button_form',$reference_id); print drupal_render($button); } } function rs_references_publish_button_form($form, &$form_state){ $form['#action']= '/'.$_get['q'];// because ajax change action $form['actions']['reference_publish'] = array( '#type' => 'submit', &#

Should every Ruby method returning a boolean have a question mark? -

i have method: def addnewshow(name) end i want return boolean states whether or not successful. should method have question mark on end of name let user know that's returns, despite not being question, , returning answer question "was successful?" i don't think it's necessary that. include method check if show exists though: def exists?(show_name) #your code check if exists #return boolean value of true/false if show added or not end

iis 7 - configure iis to redirect to domain with 200 status code -

i have old version of site on iis server. mydomain1.com binded iis server. created new version of site on node.js , want move on it. if rebind mydomain1.com new node.js server , going wrong on new version of site have rollback iis. rebinding domain slow - 4 houres. can redirect mydomain1.com mydomain2.com allready binded node.js server. don't want 301 redirect. want status code 200 , seamless redirection domain appropriate path of requests mydomain1.com . possible? for example if have requrest url http://mydomain1.com/get/item/323 want redirect url http://mydomain2.com/get/item/323 status code 200 . you can rewrite, http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module or route request, http://msdn.microsoft.com/en-us/library/cc668201(v=vs.90).aspx redirect 30*, , that's determined http standard.

java - Query on Junit @parameters method's return type and the test class constructor argument type -

the junit parameterized test returns collection of object array test class constructor type can anything? for example:- //some class constructor public parametrization (string username, string password, int pincode){ this.username=username; this.password=password; this.pincode=pincode; } @parameters public static collection<object[]> getdata(){ object[][] data = new object[2][3]; //row 1st data [0][0] = "usernamea"; data [0][1] = "passa"; data [0][2] = new integer(111); } as can see the parameters returned method getdata() of type object during runtime assigned arguments of constructor other subclass type of object string, integer e.t.c incompatible per java rules eg:- string type object can't assigned object type... so junit framework type casts values returned object types suite constructor argument types string? am missing here? as suggested values being casted. casting done java reflection

android - ViewGroup finish inflate event -

i have created custom layout extends viewgroup. working fine , getting layout expected. i want dynamically change element in layout. not working calling in oncreate , till time entire layout not (drawn) inflated onto screen , hence not have actual size. is there event can used find out when inflation of layout done? tried onfinishinflate not work viewgroup has multiple views , called multiple times. i thinking of creating interface in custom layout class not sure when fire it? if understand requirements correctly, ongloballayoutlistener may give need. view myview=findviewbyid(r.id.myview); myview.getviewtreeobserver().addongloballayoutlistener(new viewtreeobserver.ongloballayoutlistener() { @override public void ongloballayout() { //at point layout complete , //dimensions of myview , child views known. } });

c# - Remove last x elements from the list -

lets have list<car> cars have n items , want delete last two. best way found is: cars.removerange(cars.count-2, 2); is there better way? searching this: cars.removefrom(cars.count-2); //pseudocode no, there isn't... if want can put in extension method. static class listex { public static void removefrom<t>(this list<t> lst, int from) { lst.removerange(from, lst.count - from); } }

c - bits set by lookup table - Recursive macro -

this question has answer here: hint lookup table set bit count algorithm 1 answer static const unsigned char bitssettable256[256] = { # define b2(n) n, n+1, n+1, n+2 # define b4(n) b2(n), b2(n+1), b2(n+1), b2(n+2) # define b6(n) b4(n), b4(n+1), b4(n+1), b4(n+2) b6(0), b6(1), b6(1), b6(2) }; this code famous in set bit problem.. have understand how output lookup table @ compile time. but need more intuition .. means what meaning of b2(n),b4(n),b6(n) ?? , basic idea boils down recursive macro ?? edited mean idea behind recursion the idea "recursively defining problem down 2-bit values": 00, 01, 10, 11. they're not recursive macros, represent technique of recursive decomposition of problem. arrangement of macros cascade attacks problem of generating table of 2^8 values solving problem 2-bits (generating 4 values),

android - What handwriting APIs can help me with this? -

i want create application recognizes handwriting on screen. don't need recognize insanely difficult words; simple stuff "a" "bc" "z" (maybe shapes, without this). how people go this? there famous handwriting recognitions can try? if want recognize single letters , shapes alike suggest using gestureoverlayview . read here: http://android-developers.blogspot.com/2009/10/gestures-on-android-16.html here: http://www.vogella.com/articles/androidgestures/article.html and here: http://jayxie.com/mirrors/android-sdk/resources/articles/gestures.html it said casting harrypotter-like spells too.

MySql PHP row request to variable -

hello need on project working on. i have database large amount of records in it. need number of records variables make graph. below part of code far. //retrieve data table $result=mysql_query("select * solar_panel order id desc") or die(mysql_error()); $row = mysql_fetch_row($result); $row1 = mysql_fetch_row($result); $row2 = mysql_fetch_row($result); $row3 = mysql_fetch_row($result); $row4 = mysql_fetch_row($result); $row5 = mysql_fetch_row($result); $row6 = mysql_fetch_row($result); $row7 = mysql_fetch_row($result); $row8 = mysql_fetch_row($result); $row9 = mysql_fetch_row($result); $row10 = mysql_fetch_row($result); $row11 = mysql_fetch_row($result); $row12 = mysql_fetch_row($result); $row13 = mysql_fetch_row($result); $row14 = mysql_fetch_row($result); $row15 = mysql_fetch_row($result); $row16 = mysql_fetch_row($result); $row17 = mysql_fetch_row($result); $row18 = mysql_fetch_row($result); $row19 = mysql_fetch_row($result); $row20 = mysql_fetch_row($result)

html - how to give css for following data -

Image
how give css getting page follows in same div. having data in following way more sub parts in second phase. abcde production productions limited total jackson b productions productions limited the code using follwos. css .label_left21 { width: 20%; float: left; text-align:center; line-height: 30px; margin:0 10px 0 0; word-wrap:break-word; } .text_right22 { width: 20%; float:left; text-align:center; } .text_right23 { width: 55%; float:left; } html as <div class="label_left21"><br><br><br><label>budget</label></div> <div class="text_right22"><br><br><br><label>public</label></div> <div class="text_

How can I compare two C# collections and issue Add, Delete commands to make them equal? -

i have 2 icollection collections: public partial class objectivedetail { public int objectivedetailid { get; set; } public int number { get; set; } public string text { get; set; } } var _objdetail1: // contains list of objectivedetails database. var _objdetail2: // contains list of objectivedetails web front end. how can iterate through these , issue , add, delete or update synchronize database latest web front end? if there record present in first list not second to: _uow.objectivedetails.delete(_objectivedetail); if there record present in second list not first to: _uow.objectivedetails.add(_objectivedetail); if there record (same objectivedetailid) in first , second need see if same , if not issue an: _uow.objectivedetails.update(_objectivedetail); i thinking kind of: foreach (var _objectivedetail in _objectivedetails) {} but think might need have 2 of these , wondering if there better way. have suggestions how this? the following c

android - ActionBarSherlock overlapping fragment in the same tab -

Image
i have problema app.. have change fragment in tab, when new fragment overlap on old fragment. code: mainactivity: public class mainactivity extends sherlockfragmentactivity { viewpager mviewpager; tabsadapter mtabsadapter; textview tabcenter; textview tabtext; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); mviewpager = new viewpager(this); mviewpager.setid(r.id.pager); setcontentview(mviewpager); actionbar bar = getsupportactionbar(); bar.setnavigationmode(actionbar.navigation_mode_tabs); bar.setdisplayoptions(0, actionbar.display_show_title); mtabsadapter = new tabsadapter(this, mviewpager); mtabsadapter.addtab(bar.newtab().settext("home"), fragmenttab1.class, createbundle("ft1")); mtabsadapter.addtab(bar.newtab().settext(&quo

objective c - Decode Class from @encoded type string -

objective-c's @encode produces c strings represent type, including primitives, , classes, so: nslog(@"%s", @encode(int)); // nslog(@"%s", @encode(float)); // f nslog(@"%s", @encode(cgrect)); // {cgrect={cgpoint=ff}{cgsize=ff}} nslog(@"%s", @encode(nsstring)); // {nsstring=#} nslog(@"%s", @encode(uiview)); // {uiview=#@@@@fi@@i{?=b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b6b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b3b1b1b1b2b2b1}} so, can meaningful encoding of class (one contains class name) using @encode(classname) , it's in same format encoding of generic struct (as in above example). now, question is, given any (valid of course) type encoding, possible find out whether encoding of objective-c class, , if so, class object corresponds encoding? of course, could try parse class name out of type encoding, , class using nsclassfromstring , doesn't sound right wa

php - How to select environment in Laravel 4 using .htaccess? -

i have site in testing phase, connects not real data local copy of database. my customer needs fast link retrieve urgent , important pdf reports, need set version of site links "real data". i can create 2 environments ("local" , "real") different database connections, , give opportunity select environment via url (i know it's not pretty security point of view, let's take granted). so use: my.ip.address/mysite use test db my.ip.address/mysite/real use real db, redirecting urls without "real folders". f.ex.: /mysite/real/admin should redirect /mysite/admin selecting "real" environment on laravel 4. is possible pattern-match folders in laravel 4 or possible domains? in other words, work? $env = $app->detectenvironment(array( 'test' => array('*/mysite/*'), 'real' => array('*/mysite/real/*'), )); if so, can't figure out how write .htaccess rule, i've t

wix - Should I change GUID of PatchCreation Element every time I make a new patch? -

i made 2 sequential .msp patches .msi package test purpose(in way decribed in http://wix.sourceforge.net/manual-wix3/patch_building.htm ). first time, gave same guid patchcreation element of each patch , first patch applied original product(i see entry first patch in arp menu). but, second patch didn't apply on first patch @ all. never showed error message when launched didn't appear in arp menu , didn't update file, too. so, changed guid of patchcreation element of second patch , recreated second patch , applied on first patch(its entry appeared in arp menu , updated files). is right way create each patch in same patch family: should change guid of patchcreation element every single patch? yes, uniquely identifies patch package, package/@id identifies .msi package.

Rails: pass data to javascript -

this question has answer here: passing ruby variables javascript function in rails view 5 answers ruby on rails - send javascript variable controller external javascript asset file 2 answers i'm new in rails , in controller have: class pagescontroller < applicationcontroller def home @temp = "hello" end end i have read must put javascript code in application.js (tell me if true) , have: window.onload=function(){alert("<%= j @temp %>")} obviously alert print string "<%= j @temp %>" how can pass variable @temp javascript alert can print hello? thanks i wrote article on how pass ruby objects client . ryan bates has excellent railscast on passing data js . add div view corresponds pagescontrolle#hom

c++ - what is the error in that code? -

what error in code ??!! hint : sp_to_dash() function in following program prints dash each space in string argument. is, string "this test" printed "this-is-a-test" . #include <stdio.h> void sp_to_dash( char *str); int main(void) { sp_to_dash("this test"); return 0; } void sp_to_dash( char *str) { while(*str) { if(*str==' ' ) *str = '-'; printf("%c", *str); str++; } } string literals not modifiable. change way: int main(void) { char str[] = "this test"; sp_to_dash(str); return 0; }

Change format of inline code evaluation in org-mode's LaTeX-export -

i have code block in org document #+name: result_whatever #+begin_src python :session data :results value :exports none return(8.1 - 5) #+end_src which evaluate inline: now, work? let's see: call_result_whatever(). i'd surprised ... when exporting latex, generates following: now, work? let's see: \texttt{3.1}. i'd surprised \ldots{} however, don't want results displayed in monospace . want formatted in "normal" upright font, without special markup. how can achieve this? the problem of type can solved in 2 ways: 1: easy it: a plain query-replace on exported buffer. once you're in latex buffer, beginning-of-buffer or m-< query-replace or m-% enter \texttt string want replace enter nothing replacement continue replace each match interactively y / n or replace ! 2: wanna! the second way nag org-mode mailing list implementing switch or option specific case. while it's necessary sometimes, produces s

VB.NET How to get integer from Request -

i want integer url querystring, want protect against strings being entered. example; http://mydomain.com/index.aspx?page=1 dim ipageid integer = request("page") i want '1' , save integer variable, page errors out if enter below address; http://mydomain.com/index.aspx?page=string i've tried using cint , ctype, brings 'string cannot converted integer' issue. i'm sure there's simple can do, i've been banging head against wall hour , want small thing sorted. use request.querystring , int32.parse convert string "1" integer 1. dim ipageid integer = int32.parse(request.querystring("page")) if ant ensure querystring valid use int32.tryparse : dim ipageid integer if int32.tryparse(request.querystring("page"), ipageid) ' valid, ... else ' invalid end if

ios - Convert stream bytes to string -

i using google protocol buffers send data c++ server ios app. use function on ios side convert stream bytes string: -(nsstring*)convertstreambytestostring:(nsmutabledata*)data { int len = [data length]; char raw[len]; [data getbytes:raw length:len]; nsstring *protocstruct =[[nsstring alloc] initwithbytes:raw length:len encoding:nsutf8stringencoding]; return protocstruct; } my problem doesn't work. can see send , receive bytes, when converting of them lost. example 83 bytes, when printing string 20 characters. rest ? there problem don't know converting method ? nsstring class handling unicode strings. cannot store arbitrary bytes in c string. (and cannot transmit binary data in place of character string , expect survive transport) you need convert binary data string in way results in valid text string. example via base64 encoding. there lots of ios projects can encode/decode base64, google it. here's article it: http://www.cocoa

Powershell file search and delete in remote pc's -

need in searching file , delete it. beginner in power shell. trying delete file name somename.txt in remote pc's. able search file , output. not able delete file , need exclude c:\windows search. looking possible solution. $strcomputers = get-content -path "c:\testscripts\serverlist.txt" foreach($strcomputer in $strcomputers) { $files = gci "\\$strcomputer\c$" -filter "somename.txt" -recurse -force $file = $files | ft fullname -wrap|out-file c:\testscripts\output.txt -width 200 -append $files | foreach { remove-item $_.fullname -force} } thanks..

php - How to throw an error message with json_decode? -

how can throw error message json_decode ? for instance, $error = array( "key_name" => "keyname - empty!", "pub_name" => "pubname - empty!", "path" => "path - empty!" ); $json = json_encode($error); $object = json_decode($json); print_r($object->keyname); i get, notice: undefined property: stdclass::$key_namex in c:.... on line 32 keyname not exist actually, wonder if can check if condition , if(!$object->keyname) { .... } is possible? and there no error content, $error = array( ); $json = json_encode($error); $object = json_decode($json); print_r($object->key_name); so thought of throwing error before proceeding codes follows, if($object == '') {...} is possible? you should prefer use property_exists () on isset(). as opposed isset(), property_exists() returns true if property has value null. if( property_exists($object, 'keyname') ){

python - PySide metro style mousepressevent -

i trying have python desktop application metro (windows 8) style, table of rectangles can clicked something. i generate table of rectangles (myicon) this: for sub_rectx in xrange(4): sub_recty in xrange(3): tmp = myicon(sub_rectx*322, sub_recty*192, 300, 170, sub_recty+3*sub_rectx + 1, parent=parent) and have class, rectangle id: class myicon(mypanel): def __init__(self, x, y, width, height, ide, parent=none): super(mypanel, self).__init__(parent) qtgui.qgraphicsrectitem.__init__(self, x, y, width, height, parent) self.ide = ide def mousepressevent(self, event): self.setbrush(qtgui.qcolor(255, 255, 255)) print self.ide this code works fine first time click on rectangle, printing correct id, , changing colour of correct rectangle, next times click on rectangle it's printing id of first rectangle clicked , colour not changed (i assume because it's painting again same rectangle well). can me? i s

c++ - What is the default TIFF orientation? -

i'm working tiff data , i've come upon few test images not have orientation data. appeared me upside down defaulted orientation orientation_topleft seems working. i'm curious though, accepted default orientation? noticed software ignores orientation data anyway. can give me advice? this documentation says "default 1". in same page, explains 1 = top left. so seem whatever software using read file later non-conformant.

Android: Get Cache File Information using Package Name -

is there possibility cache file information of application installed in mobile phone using package name? if not, other possible way cache file information of application? because want cache file size, cache file location etc. of particular application in mobile phone programmatically this looking getcachedir()

r - interpolation of grouped data using data.table -

this continuation of question had posted @ http://r.789695.n4.nabble.com/subset-between-data-table-list-and-single-data-table-object-tp4673202.html . matthew had suggested post question here doing now. this input below: library(data.table) library(pracma) # interp1 function tempbigdata1 <- data.table(c(14.80, 14.81, 14.82), c(7900, 7920, 7930), c("02437100", "02437100", "02437100")) tempbigdata2 <- data.table(c(9.98, 9.99, 10.00), c(816, 819, 821), c("02446500", "02446500", "02446500")) tempbigdata3 <- data.table(c(75.65, 75.66, 75.67), c(23600, 23700, 23800), c("02467000", "02467000", "02467000")) tempsbigdata <- rbind(tempbigdata1, tempbigdata2, tempbigdata3) setnames(tempsbigdata,c("y", "x", "site_no")) setkey(tempsbigdata, site_no) tempsbigdata y x site_no 1: 14.80 7900 02437100 2: 14.81 7920

Struts2 + Tiles + NETBEANS -

Image
i beginner struts2 , have implemented simple examples. i getting problem tiles i refereed site http://www.dzone.com/tutorials/java/struts-2/struts-2-example/struts-2-tiles-example-1.html and files exact same given in website mentioned above i using : netbeans ide 7.3 , struts 2 , glassfish 3.1.2.2 (note : downloadable file tutorials site works in eclipseide , need add in netbeans) here error glassfish : **http status 404 ** type : status report description : requested resource () not available. info: removing tilescontext context: org.apache.catalina.core.applicationcontextfacade info: initializing tiles2 application context. . . warning: cannot find tilescontextfactory class org.apache.tiles.portlet.context.portlettilesapplicationcontextfactory info: finished initializing tiles2 application context. warning: cannot find tilescontextfactory class org.apache.tiles.portlet.context.portlettilesapplicationcontextfactory info: initializing tiles2 container. . . war

Calling Java Objects in C++ in Android NDK - What IDE to use? -

i need use c++ code in android app, i'm doing using ndk/jni. have able use java objects in c++. (note: not using c++ methods in java.) my problem ide. have c++ code in folder called 'jni' in android project. have installed cdt in eclipse. helloworld c++ project works fine confirming cdt set fine. what not know how run c++ code? thanks in advance! you going need native method in class signature such as native void processdata(byte[] data); then in jni code need c function correct name extern "c" jniexport void jnicall java_your_package_and_class_processdata(jnienv* env, jobject clazz, jobject data); the javah tool can right names match java class. in native code , have reference class instance , byte array. can access data in byte array using jni methods provided through jnienv instance. android jni tips page has on this, should read rest of page if new jni. i have assumed modifying data in byte array if need return in new byte array

java - How do I change and instance variable for an object which the user selects from a combobox? -

i'm huge noob. finished java textbook , i'm making game learning experiment. i'm stumped... here' problem: i have 6 objects created person class. each object has boolean variable, automatically set false. i can select each person object combo-box , display information them, can display information use link object combo box (as in: person1.name allows me display name variable on combobox, , allows me display name elsewhere). i want able change other instance variables within each object. know how make method change each object, i'd have make 6 methods, 1 refers each specific object. i want change boolean instance variable object user selects combobox. thought array of objects, i've been failing set array. array right way go? or there way? assuming jcombobox contains reference person object, should provide suitable getters , setters allow access value contain within object. for example... public class person { private string

pdb - Launch Python debugger while simultaneously executing module as script -

when developing python package, it's convenient use -m option run modules inside package scripts quick testing. example, somepackage module somemodule.py inside it, invoking python -m somepackage.somemodule from directory somepackage resides run somemodule.py though submodule __main__ . using calling syntax important if package using explicit relative imports described here . similarly, convenient use -m option debug script, in python -m pdb somescript.py is there way both @ same time? is, can call module though script , simultaneously launch debugger? realize can go code , insert import pdb; pdb.set_trace() want break, i'm trying avoid that. after experimenting quite time, turns out approach works: python -c "import runpy; import pdb; pdb.runcall(runpy.run_module, 'somepackage.somemodule', run_name='__main__')" for reason, use of pdb.runcall on pdb.run important.

elisp - In Emacs Lisp, how to find where the symbol is defined -

when c-h f or c-h v , tells me in file symbol defined or autoloaded from. how can find same information programmatically? some digging reveals (find-lisp-object-file-name object type) should trick. example: (find-lisp-object-file-name 'goto-line 'function) ;; => "/usr/local/cellar/emacs/24.3/share/emacs/24.3/lisp/simple.el" edit: how discovered information: first did c-h k c-h f figure out c-h f bound to. result describe-function , let's c-h f describe-function see source that. noticed interactive wrapper around describe-function-1 , jumped source that. there's lot of stuff in there, pertinent line is: (file-name (find-lisp-object-file-name function def)) revealing find-lisp-object-file-name function used work internally.

xml - Outputting multiple files using XPath in bash -

i have directory of xml files. each file has own unique identifier. each file contains 1 or more references other files (in separate directory), have unique ids. for example, have file named example01.xml : <file> <fileid>xyz123</fileid> <filecontents>blah blah blah</filecontents> <relatedfiles> <otherfile href='http://sub.domain.abc.edu/directory/index.php?p=collections/pageview&amp;id=123‌​4'> <title>some resource</title> </otherfile> <otherfile href='http://sub.domain.abc.edu/directory/index.php?p=collections/pageview&amp;id=4321'> <title>some other resource</title> </otherfile> </relatedfiles> </file> if file has multiple relatedfiles/otherfile elements, need create copy of file each @href , rename it, concatinating value of unique id in @href value of fileid . so, example, need c

In JavaScript, how do I inherit from a parent class in child class using a single ".prototype" block? -

for example: function person() { //person properties this.name = "my name"; } person.prototype = { //person methods sayhello: function() { console.log("hello, person."); } saygoodbye: function() { console.log("goodbye"); } } function student() { //student specific properties this.studentid = 0; } student.prototype = { //i need student inherit person //i.e. equivalent of //student.prototype = new person(); //student.prototype.constructor = person; //student specific methods //override sayhello sayhello: function() { console.log("hello, student."); } } i know can achieve using: function student() { this.studentid = 0; } student.prototype = new person(); student.prototype.constructor = person; student.prototype.sayhello = function () { console.log("hello, student."); } but i'd continue use style first example , have cla

css - HTMLPanel centering with UIBinder and GWT -

the code below displays login box in upper left hand corner of browser, display in center. i have read various topics on how center using css style elements , cell element, not working. maybe doing wrong. i starting learn uibinder excuse bad style. any appreciated, thank you. here code: <ui:style> buttonsdiv{ float: right; margin-top: 20px; } </ui:style> <g:dialogbox text="instructor registration"> <g:htmlpanel> <g:htmlpanel stylename='buttonsdiv'> <g:label>first name</g:label> <g:textbox></g:textbox> </g:htmlpanel> <g:htmlpanel stylename='buttonsdiv'> <g:label>last name</g:label> <g:textbox></g:textbox> </g:htmlpanel> <g:htmlpanel stylename='buttonsdiv'> <g:label>institution</g:label>

javascript - Having a html element stay in the same position without using position: fixed -

to show want do, here url. http://octopuscreative.com . i want when scroll down height, cyan div disappears website above. i have scrolling working in code, however, cannot see rest of html below #main div . don't know if has new #slideshow div (with fixed position). thought since #slideshow div had height reduced 0 , able see html underneath #main div , see below white. var header = $('#slideshow'), headerh = header.height(); $(window).scroll(function() { if (header.height() >= 0) { header.css({ height: -($(this).scrolltop() - headerh), position: 'absolute' }); } else if (header.height() < 0 ) { header.css('height', 0); header.css('position', 'absolute'); } }); </script> </head> <body> <div id="top"> <div id="stallion"> <img id="stallionpic" src="stallion1.png" /> <h1 class="h1&q