Posts

Showing posts from June, 2011

How to purge directory with puppet and keep the dot files -

is there way purge folder , keep dotfiles? i'd purge /root. something like: file { '/root': ensure => present, owner => 'root', group => 'root', mode => 0550, purge => true, recurse => true, } file { '/root/.*': ensure => present, owner => 'root', group => 'root', } either go ignore param h2ooooooo correctly stated. you may find cleaner not recurse , use tidy type , matches parameter instead. tidy { "/root": recurse => 1, matches => '[a-za-z0-9_]*' }

modeling - uml component diagram dependency between system and component of other system -

Image
can join 1 system component of second subsystem dependency ? my intence show in system(system 2) module / component called subsystem 1 , external system uses subsystem. correct? interfaces aren't defined now, can show dependency. let me interpret diagram , answer should come naturally. :) "system 1" depends on "subsystem 1" in way. "system 1" not know "system 2", contains "subsystem 1". means "system 1" somehow gets direct access "subsystem 1", no contact "system 2". is correct? that's answer question. :)

SAS: Creating classdata -

i'm trying create classdata proc tabulate command. how can following less code? rather having spell out eventtime , node each of 2 groups, can add text each node, starting l, ll , lw etc? proc sql; create table foo(prefflag num, eventtime num,node char(100)); quit; proc sql; insert foo (prefflag, eventtime, node) values (0,1, "") values (0,2, "l") values (0,2, "w") values (0,3, "ll") values (0,3, "lw") values (0,3, "wl") values (0,3, "ww") values (0,4, "lll") values (0,4, "llw") values (0,4, "lwl") values (0,4, "lww") values (0,4, "wll") values (0,4, "wlw") values (0,4, "wwl") values (0,4, "www") values (0,5, "llll") values (0,5, "lllw") values (0,5, "llwl") values (0,5, "llww") values (0,5, "lwl...

android - Trying to implement swipe movement -

public class coursesactivity extends sherlockfragmentactivity { arraylist<coursedata> mcourseslist = new arraylist<coursedata>(); public courseslistadapter courseslistadapter; public listview mlist; public alertdialog.builder dlgalert; public dialog logindialog; public dialog logindialogoverflow; linearlayout progressbar; static sqlitewebcourse dbhelper; private gesturedetectorcompat mdetector; public final static string extra_message = "com.technion.coolie.webcourse.message"; public coursesactivity() { dbhelper = new sqlitewebcourse(this, "webcouredb", null, 1); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // create list of courses mcourseslist = new arraylist<coursedata>(); setcontentview(r.layout.web_activity_courses); mlist = (listview) findviewbyid(r.id.courses_list); dlgalert = new alertdialog.builder(getapplicationcontext()); if (!coolieaccoun...

macros - IF statement for iMacros Frame knowing the range -

i'm doing macro frame number change, know topic exist but, know range of frame, 5,6,7,8. i want make if else else else. macros code, frame f=5. version build=8810214 recorder=fx set !extract_test_popup no tab t=1 tag pos=1 type=a attr=txt:entra<sp>y<sp>juega wait seconds=5 tag pos=1 type=a attr=txt:nueva tag pos=1 type=label form=id:new_user attr=txt:*<sp>nombre<sp>de<sp>usuario set !var1 eval("var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']; var string = ''; for(var = 0; < 10; i++){string += letters[parseint(math.random() * 25)]}; string") tag pos=1 type=input:text form=id:new_user attr=id:user_username content={{!var1}} tab t=2 tag pos=1 type=div attr=id:pubi...

jquery - video.js update video upon complete -

i attempting grab recent mp4 file on db - play - , upon completion repeat process. however, same file loops on , over. should noted i've checked web service & each time service requested give me new file expected. is there different way update video player? prefer avoid using dispose method , re-creating whole player if possible. videourl = '/myservice/get/' + sensorid + "?math=" + math.random(); _v_("video_player").ready(function() { var myplayer = this; myplayer.src({ type : "video/mp4", src : videourl }); myplayer.load(); this.on("ended", function() { myplayer.src({ type : "video/mp4", src : videourl }); }); i presume random number there cache-buster. videourl wouldn't change 1 iteration next. you'd need generate new url each time, e.g. this.on("ended...

javascript - Angularjs - auto-scroll to location -

i'm using ui-router angularjs , know how make screen scroll down (hopefully easing make better) specific part of homepage when user clicks on link. scroll when clicks on link page too. the examples can find on here scrolling automatically ui-view not want. other examples include ng-route not i'm using. is there feature built in angular/ui-router or should use have of sites doesn't use angular: $('a[href^="#"]').on('click',function (e) { e.preventdefault(); var target = this.hash, $target = $(target); $('html, body').stop().animate({ 'scrolltop': $target.offset().top }, 900, 'swing', function () { window.location.hash = target; }); }); any advice/code appreciated.

scripting - Adding "1;" to the bottom of a cgi script that uses Perl? -

i know perl scripts (.pl) need "1;" @ end of them use, etc.... but if have cgi script (.cgi) uses perl, "1;" need @ bottom of well? know basic question, wanted sure. modules (files executed using require or use ) , scripts executed using do require true value. scripts executed perl (e.g. cgi scripts) not (though there's no harm in doing so).

binary prefix code in huffman algorithm -

in huffman coding algorithm, there's lemma says: the binary tree corresponding optimal binary prefix code full but can't figure out why. how can prove lemma? from wikipedia , a full binary tree (sometimes 2-tree or strictly binary tree) tree in every node other leaves has 2 children. the way in tree huffman code produced produce full binary tree. because @ each step of algorithm, remove 2 nodes of highest priority (lowest probability) queue , create new internal node these 2 nodes children.

nsstring - ios location related bug -

i seeing weird bug looking with. i have ipad ios 7 app allows people fill out forms. entries stored in sqlite database. when reopen form have worked on entries have made redisplayed. when ipad goes new city entries seem disappear. when app reactivated in new location current page appears fine, scrolling left or right shows nothing blank fields. current page blank if scroll away , it. if print or email form while data not visible, output contains missing data. data comes if double-press home button, exit app, , restart it. re-opening form not bring data back. when took mac , ipad new city, disappearing data effect happened went away shortly after started testing it. don’t know whether goes away eventually. didn’t test when got home, , when did start testing bug not happening. each field backed object includes strong string property field’s value. thing know sure in forms invisible data string property nil fields should have data. other field properties retain correct value...

java - My drawn object doesn't clear previous rectangle after key is pressed -

Image
my code not clear previous rectangle when press 1 of arrow keys. thought using repaint() in keypressed() method, solve problem. tried using clearrect() , doesn't anything. this idle rectangle: this when hold down right arrow key: here code: import java.awt.component; import java.awt.dimension; import java.awt.graphics; import java.awt.graphics2d; import java.awt.event.keyevent; import java.awt.geom.rectangle2d; import javax.swing.icon; import java.awt.*; import java.awt.event.keyevent; import java.awt.event.keylistener; import java.awt.geom.affinetransform; import java.awt.geom.arc2d; import java.awt.geom.pathiterator; import java.awt.geom.point2d; import java.awt.geom.rectangle2d; import java.util.arraylist; import javax.swing.icon; import javax.swing.jcomponent; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.joptionpane; import javax.swing.jpanel; public class rectangle extends jpanel implements keylistener{ private int height; privat...

java - PointCut to match method annotated with certain params to the annotation -

i have pointcut @pointcut("execution(@com.foo.bar.aspect.annotation.myannotation* * (..))" + "&& @annotation(annot)") public void anyfoo(myannotation annot) { } myannotation looks this: @target(elementtype.method) @retention(retentionpolicy.runtime) public @interface myannotation { boolean isfoo(); string name; } let's annotate method annotation isfoo set true @myannotation(isfoo = true, name = "hello") public void dothis() { system.out.println("hello, world"); } how write pointcut matches method annotated myannotaion , isfoo = true ? i tried doesn't seem work @pointcut("execution(@com.foo.bar.aspect.annotation.myannotation(isfoo = true, *) * * (..))" + "&& @annotation(annot)") public void anyfoo(myannotation annot) { } you cannot write pointcut because aspectj not support it. need use like @pointcut("execution(@com.foo.bar.aspect.ann...

jmap appears slower under Java 7, slows down JVM -

we've been using jmap ~2 years measure heap size on large, multi-server app, running under java 6. take measurement every minute. each measurement took (elapsed time) less 1 second. we're testing same app under java 7. , jmap takes 10 seconds, 20 seconds, longer, , seems slow down (or perhaps stop!) jvm during time. the difference see in jmap output (between java 6 , java 7) additional information how many strings interned. (and seems that's part slower.) does know going on, or changed in jmap or java 7 might cause this? we're testing using "jstat -gc" same information, , far seems faster, , not appear cause app slowdowns saw jmap. there other suggestions how measure heap size, quickly? any thoughts welcome, in advance. i quite oracle mission control monitoring heap size. has many more options, works charm monitor heap size.

javascript - Gradient only on one section -

on previous post asked how i'd gradient set up. problem gradient "spreads" out. here's i'm using function generatecssgradient(colours) { var l = colours.length, i; for( i=0; i<l; i++) colours[i] = colours[i].join(" "); return "linear-gradient( right, "+colours.join(", ")+")"; } var cols = [ ["red","0%"], ["red","40%"], ["yellow","40%"], ["yellow","60%"], ["green","60%"], ["green","80%"] ]; yourelement.style.background = generatecssgradient(cols); with this . want fill in 1 input. , bar goes 33%, red color. next blue , fourth. not this . ideas? i'd avoid using div i think want this ... see source code html i'v edited html code , added div called colors inside div top ... <div class="top"> <div class="colors"></div> </d...

javascript - how to add jquery toggle between smarty loop or foreach items -

for jquery guru's out there, trying. trying add jquery toggle between smarty template { foreach item list } code works great works on first list item, not toggle when click on 2nd, 3rd etc items in list. suggestions? jquery code <script> $(function(){ $("#itm_add").each(function(){ $(this).click(function(e){ e.preventdefault(); $("#itm_add_box").parent("tr").empty(); href=$(this).attr("href"); $(this).closest("tr").next("tr").empty().append('<td colspan="6"><div id="itm_add_box" data-href="'+href+'"> <input type="text" id="itm_serial" class="input" placeholder="serial number..." /> &nbsp; <input type="text" id="itm_qty" class="input" placeholder="quantity..." /> &nbsp; <button class="green" id="itm_s...

Is there a transpose function in Elixir? -

hi transpose function in elixir. example have kind of array 'a' , after calling function result should 'b': a = [[1, 2], [3, 4], [5, 6]] b = transpose(a) b => [[1, 3, 5], [2, 4, 6]] there isn't 1 in elixir currently, create own with: def transpose([]), do: [] def transpose([[]|_]), do: [] def transpose(a) [enum.map(a, &hd/1) | transpose(enum.map(a, &tl/1))] end

java - How to fix [The method put(String, Boolean) in the type ContentValues is not applicable for the arguments (Boolean, Boolean)] -

i'm trying learn how develop android app , trying re-write notepadv3solution {http://developer.android.com/training/notepad/index.html} modifying own purposes. in method createtask (nr bottom), error the method put(string, boolean) in type contentvalues not applicable arguments (boolean, boolean) . i've added boolean field database, adding createtask method. how can boolean field work? package com.superiorxc.taskcentral; import android.content.contentvalues; import android.content.context; import android.database.cursor; import android.database.sqlexception; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; import android.util.log; public class tasksdbadapter { public static final string key_rowid = "_id"; public static final string key_title = "title"; public static final string key_body = "body"; public static final boolean key_complete = true; private static fina...

java - How to change layout background dynamically -

i having problem in code.i trying change layout background of app every second.i used thread in code.i've searched site couldn't find useful.here code. import android.app.activity; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.os.bundle; import android.view.motionevent; import android.view.view; import android.view.view.ontouchlistener; import android.widget.linearlayout; public class mainactivity extends activity { //private bitmap open, close; private linearlayout myl; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); myl = (linearlayout) findviewbyid(r.id.linearlayout2); // myl=(linearlayout) findviewbyid(r.id.linearlayout2); //close = bitmapfactory.decoderesource(getresources(), r.drawable.kapa); //open = bitmapfactory.decoderesource(getresources(), r.drawable.ac); }...

xcode - What is the correct way to see if the current group has been removed with ALAssetsLibraryChangedNotification? -

when group has been removed –groupforurl:resultblock:failureblock: not able find group anymore. might must compare nsurl received notification nsurl when using alassetsgrouppropertyurl on current group. when current group has filter on it, nsurl appended &filter= , nsurls won't match. so if have current group of type alassetsgroup , receive notification alassetslibrarychangednotification . how check if current group 1 got removed? my code far: - (void)viewdidload { [super viewdidload]; self.collectionview.alwaysbouncevertical = yes; self.collectionview.backgroundcolor = [uicolor whitecolor]; self.collectionview.opaque = yes; self.collectionview.contentinset = uiedgeinsetsmake(9, 0, 0, 0); [self.collectionview registerclass:[cmphotocollectionviewcell class] forcellwithreuseidentifier:@"photocell"]; } - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [[nsnotifi...

java - R cannot be resolved (XML issue but cannot find it) -

see bottom things have tried. gives me error anywhere r mentioned understand it, means there error in xml. cannot find anywhere though. androidlistviewcursoradaptoractivity package com.example.location_deals; import android.app.activity; import android.database.cursor; import android.os.bundle; import android.text.editable; import android.text.textwatcher; import android.view.view; import android.widget.adapterview; import android.widget.edittext; import android.widget.filterqueryprovider; import android.widget.listview; import android.widget.simplecursoradapter; import android.widget.toast; import android.widget.adapterview.onitemclicklistener; public class androidlistviewcursoradaptoractivity extends activity { private countriesdbadapter dbhelper; private simplecursoradapter dataadapter; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); dbhelper = new countriesdbadapter(this); dbhelper.open(); ...

sql - How to union multiple tables and perform paging in DB with Nhibernate -

is there way implement union , paging in db? eg: (select a.col1 columna, a.col2 columnb, a.col3 columnc table1 a) union (select b.col1 columna, b.col2 columnb, b.col3 columnc table2 b) i've found several solutions implement function, paging performed in memory, not in db. 1. use sql query this has several drawbacks, glaring 1 limit , offset not standardized across databases (oracle requires subquery) - if change db, query need changed. // petdso not nhibernate mapped, no virtual.. public class petdto { public string name { get; set; } public string owner { get; set; } public long age { get; set; } } ilist<petdto> pets = session.createsqlquery(@" select name name, owner owner, age age cat union select dog_name name, owner_name owner, age_in_years age dog order name, owner, age limit :returnedrows offset :skiprows") .setparameter("skiprows", 1) .setparameter("returnedrows", 2) .se...

javascript - Get the full dom traversal address of a node, going down from body to the node, without relying on getElementBy or $('jQuery') -

i'm writing userscript , want "address" of node, like, if web page this: <body> <content> <a href='/something' name='element i'm interested in'> </content> </body> how address of a (where a particular a element know , can point manually, or other regular selectors) give me this: body.content.a can use in userscript perform operations on over node gotten getelementby() method in javascript. obviously real page more complex , can't write out. there way address either running jquery or javascript on page or browser tool? using javascript if have element in variable , want find it's heirachy should possible traversing nodes parent chain: eg like function getaddress(element) { var address = element.tagname; if (element.parentnode) { address = getaddress(element.parentnode) + '.' + address; } return address; } // using above function var node = docu...

c++ - Most concise way to disable copying class in C++11 -

i have problem dealing deprecated since c++11 default generation of copy constructor , copy assignment operator when there user-defined destructor. for sufficiently simple classes default-generated constructors, operators , destructor fine. consider following reasons declare destructor: making trivial destructor virtual in base class: // header class base1 { public: virtual ~base1() = default; }; class base2 { public: virtual ~base2(); }; // source base2::~base2() = default; would 4 copy , move special methods generated compiler in these cases? if yes, think fine , there no need complicate base1 or base2 . printing debug message in destructor: // header class d { public: ~d(); }; // source d::~d() { #ifdef debug_this std::cout << "d destructed." << std::endl; #endif } i believe in case copy constructor , assignment operator generated; move constructor , assignment operator not. want avoid using deprecated default-generating , disable copying...

How can i Post image at instagram using API or Direct Image link -

this question has answer here: how post pictures instagram using api 4 answers how share link , photo instagram using php? can't find "share photo instagram". http://instagram.com/developer/endpoints/media/ "at time, uploading via api not possible"

c# - During OnActionExecuting for Web API call - How to map to controller/action class from route string to read action attributes -

how can map incoming route string (e.g. products/getproduct) controller/method called (the productscontroller, getproduct method)? my goal inspect instance of productscontoller find custom attribute put on getproduct method. i know how inspect class once know which class/method i'm dealing with. i had considered splitting string, you'd end "products", , "getproducts", can productscontroller, , within that, method called getproducts. this might work, seems there should better solution. ideas? you can actual controller instance , attributes on action using: public class somefilter : actionfilterattribute { public override void onactionexecuting(httpactioncontext actioncontext) { var controller = actioncontext.controllercontext.controller; var somefilterattributes = actioncontext.actiondescriptor.getcustomattributes<somefilter>() var otherattributes = actioncontext.actiondes...

jquery - Nesting DIV using JavaScript -

i trying load div on button click inside div , on click should create new div inside newly created div. here fiddle: http://jsfiddle.net/lzcw5/4/ , code: html: <a href="#" onclick="nestdiv()">generate</a> <div id='x0'> 0 </div> javascript: int level=1; function nestdiv() { document.getelementbyid('x'+(level-1)).innerhtml="<div id='x"+level+"'>"+level+"</div>"; level++; if(level==5) //do somthing } i want perform special operation when nesting level reaches 5. not pro @ javascript. please tell me how can achieve this? in code have change int var , call function variable: var level=1; nestdiv = function() { document.getelementbyid('x'+(level-1)).innerhtml="<div id='x"+level+"'>"+level+"</div>"; level++; } you can see working here

php - Javascript location doesn't work -

here code. echo"<button class='buttonajax' onclick='javascript:location = try.php;'>go back</button>"; i tried redirect page through button not perform function. please tel me problem in code? you need wrap location you’re sending user in quotes because otherwise javascript try interpret variable name: echo"<button class='buttonajax' onclick='javascript:location = \'try.php;\''>go back</button>";

Clojure multimethod giving unexpected null pointer -

i'm having hard time getting multimethods in clojure work expect. distillation of code follows. (defn commandtype [_ command] (:command-type command)) (defmulti testmulti commandtype) (defmethod testmulti :one [game command] (str "blah")) (defmethod testmulti :default [& args] "cannot understand") (testmulti "something" {:command-type :one}) (commandtype "something" {:command-type :one}) now expect here have method commandtype called on arguments of course return :one should send first defmethod instead null pointer exception. simplest invocation of multimethod come gives me null pointer: (defmulti simplemulti :key) (defmethod simplemulti "basic" [params] "basic value") (simplemulti {:key "basic"}) and yet example in clojure docs located here works fine. there fundamental i'm doing wrong? so far can see, works. given (defmulti testmulti (fn [_ command] (:command-type comma...

Is STUN server absolutely necessary for webrtc when I have a socket.io based signaling server? -

my understanding stun server webrtc when clients behind nat (in cases, if not all), stun server webrtc clients identify addresses , ports. , read article saying signaling server needed webrtc clients. signaling server web server, socket.io, or emailing url. first question be: stun server signaling server? actually built simple socket.io based service broadcasts client's session descriptions other clients. believe socket.io based server should have enough knowledge clients' addresses , ports information. if case, why bother have stun server? thanks, elgs the stun server not signalling server. the purpose of signalling server pass information between peers @ start of session(how can send offer without knowing send to?). information includes sdps created on offers , answers , ice candidates created either party. the reason have stun server 2 peers can send media each other. media streams not hit signalling server instead go straight other party(the definition...

android - how to use DownloadManager in ArrayAdapter -

i'm using arrayadapter listview , want use downloadmanager in it. array adapter doesn't know line : downloadmanager download =(downloadmanager) getsystemservice(download_service); so how can use im adapter class when user touch image download starting my adapter class : public class myadapter extends arrayadapter<string>{ private final context context; private final string[] values; context b; public myadapter(context context, string[] values) { super(context, r.layout.item, values); this.context = context; this.values = values; b= (context) context; } @override public view getview(final int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) context.getsystemservice(context.layout_inflater_service); view rootview = inflater.inflate(r.layout.item, parent, false); textview tv1 = (textview)rootview.findviewbyid(r.id.txt_name); ...

ruby on rails - Load error for core_ext time -

i trying install gem rails 3.2.14 app. when run bundle installs fine when try run server get: /users/maccer/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-3.2.14/lib/active_support/dependencies.rb:251:in `require': cannot load such file -- active_support/core_ext/time (loaderror) what mean? this issue may caused permissions on gems folder. first check permissions on /users/maccer/.rvm/gems/ruby-2.0.0-p247/gems . after try : chmod -r 755 /users/maccer/.rvm/gems/ruby-2.0.0-p247/gems

java - Identifier expected in an ActionListener -

i compiled code , got error: c:\users\rj\desktop>javac windowtest.java windowtest.java:17: error: <identifier> expected click.addactionlistener(new actionlistener(){ ^ windowtest.java:22: error: ';' expected }); ^ 2 errors i still new java , appreciate examples and/or step step explanations. if move override error saying didn't override. code is: import java.awt.*; import java.awt.event.*; import javax.swing.jframe; import javax.swing.*; import java.util.scanner; public class windowtest extends jframe implements actionlistener{ public static void main(string args[]){ jframe frame = new jframe(); jlabel label = new jlabel("this test."); jbutton click = new jbutton("test"); jpanel buttonpan = new jpanel(); jpanel textpan = new jpanel(); final jtextfield textin = new jtextfield(); @override click.addactionlistener(new actionlistener(){ ...

ruby on rails - Receiving "ActionView::Missing Template" error when hosting locally? -

trying view rails app, when host locally following error message: missing template website_builder_engine/home/index, website_builder_engine/application/index {:handlers=>[:erb, :builder, :coffee], :formats=>[:html], :locale=>[:en, :en]}. searched in: * "/users/myname/orange-peacock/app/views" * "/users/myname/.rvm/gems/ruby-1.9.3-p545@mygemset/gems/frontend-helpers-0.1.3/app/views" * "/users/myname/.rvm/gems/ruby-1.9.3-p545@mygemset/gems/website_builder_engine-0.0.5/app/views" * "/users/myname/.rvm/gems/ruby-1.9.3-p545@mygemset/gems/devise-2.2.8/app/views" any ideas? simple answer need have view @ /app/views/home/index.html.erb or website_builder_engine/home/index.html.erb -- i don't think issue devise itself, rather how you're accessing routes in app. imagine you're redirecting route (on unauthentication) doesn't exist (i.e home#index ): #config/routes.rb root to: "home#index" devise_f...

javascript - How to make it work with Asynchronous -

this question has answer here: why variable unaltered after modify inside of function? - asynchronous code reference 6 answers how return response asynchronous call? 21 answers i want able results asynchronous method. reason works in other method. trying return response of callback method. can ajax.getresults(); instead of: ajax.getresults(function(response){ // code here... }); here code... function ajax(method, destination, sendtype){ this.method=method; this.destination=destination; this.sendtype=sendtype; // creates xmlhttp object this.create=function(){ var xmlhttp; if(window.xmlhttprequest){ xmlhttp=new xmlhttprequest(); }else{ xmlhttp=new activexobject("microsoft.xmlhttp"); ...

c# - Information about the domain could not be retrieved (1355). Not able to read values in LINQ collection -

i trying users name active directory using pricipalcontext. can able results on ienumurable variable principalsearchresult using following code. not able read results under principalsearchresult. while trying read results principalsearchresult , populate error message principaloperation exception unhandled users code: information domain not retrieved (1355). i don't know error , unable read values in search result. here code: principalcontext oucontext = new principalcontext(contexttype.domain, ad.serverdomain, ad.ldapuser, ad.ldappasswoprd); userprincipalex userpricipalex = new userprincipalex(oucontext); principalsearcher mysearch = new principalsearcher(userpricipalex); mysearch.queryfilter = userpricipalex; ienumerable<userprincipalex> principalsearchresult = mysearch.findall().cast <userprincipalex>(); var s = (from user in oprincipalsearchresult //here getting exception select new user ...

Java external Process error stream readLine() blocks intermittently -

i shelling external windows program updates progress repeatedly pushing new lines error stream. the command prompt looks when it's running: 10% done 10% done 11% done and forth. i'm having success capturing in java application thusly: process process = runtime.getruntime().exec("my little command"); bufferedreader stdinput = new bufferedreader(new inputstreamreader(process.getinputstream())); bufferedreader stderror = new bufferedreader(new inputstreamreader(process.geterrorstream())); string s; while((s = stderror.readline())!=null) { system.out.println(s); } unfortunately, may have guessed, there's bit of problem. stderror.readline() blocks until there +- 4000 bytes in error stream, , prints each line out in quick session, before hangs again. i've tried changing bufferedreader buffer size, , using stderror.read(char [] cbuf, int off, int len) with small length, no avail. how fix hanging issue? thanks in advance :...

ios - Hash Table Code Explanation -

i found implementation of hash table written in objective-c. can follow of it, struggling understand how -(id) init function works. method in hashtable.m file 3 lines (i repasted below right after question). explain doing? included of other relevant code although part think can follow rest. despite i'm unclear specifics of init method. thanks -(id)init { self =[super init]; self.othercontainer = [[nsmutablearray alloc]init]; return self; } hashtable.h #import <foundation/foundation.h> @interface hashtable : nsobject @property(nonatomic) nsmutablearray* othercontainer; -(id)objectforkey:(nsstring*)name; -(void)setobject:(id)object forkey:(nsstring*)name; -(id)init; @end hashtable.m #import "hashtable.h" #import "person.h" @implementation hashtable -(id)init { self =[super init]; self.othercontainer = [[nsmutablearray alloc]init]; return self; } -(id)objectforkey:(nsstring*)name { person* tempperson = n...

BigQuery error: Encountered " "WHERE" "WHERE "" -

i tried run following in bigquery: select * repository_owner = 'facebook' , repository_name = 'react' [githubarchive:github.timeline] limit 1000 but received error: error: encountered " "where" "where "" @ line 2, column 1. expecting: what error mean , how can fix it? this error pops if where clause in wrong place. changing query to select * [githubarchive:github.timeline] repository_owner = 'facebook' , repository_name = 'react' limit 1000 fixes problem.

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

How to write an if statement with multiple || and && in C? -

what concise way write if statement more many || , && in c? i want execute printf statement if either 1,2,4 or 6 , b = 8 , c = 10, can put these conditions same if statement? eg. can write like: if ((a = 1||2||4||6) && b == 8 && c == 10) //do something this doesn't seem work... if ((a == 1 || == 2 || == 4 || == 6) && b == 8 && c == 10)

Fatal Exception : Main on android app -

i have problem project. if can solve problem please me.. this main code import android.app.activity; import android.app.dialog; import android.content.pm.activityinfo; import android.util.floatmath; import android.util.log; import android.os.bundle; import android.view.menu; import android.view.menuinflater; import android.view.menuitem; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.edittext; import android.widget.toast; import java.lang.math; import com.kalkulator.r; public class mainactivity extends activity implements onclicklistener { private string str1="",str2="",str3="",op=""; private float num1,num2,num3,num4,num5; private long a,b=1; edittext ed; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //setcontentview(r.layout.main); setrequestedorientation(activityinfo.screen_orientation_portrait); ...