Posts

Showing posts from April, 2015

eclipse - What is .apt_generated folder in Web project? -

what , why .apt_generated folder created inside web project within eclipse or rad workspace? it's holding code generated annotation processors .

.net - How to control server name in EF CF? -

i created dbcontext initializer: public class dropcreateinitializer(of t dbcontext) inherits dropcreatedatabaseifmodelchanges(of t) protected overrides sub seed(context t) context.database.executesqlcommand("create index ix_explan on dbo.explans (progname, bind_time, accessname)") end sub end class what dont understand how control sql server new context create database on. gets created on localhost/sqlexpress. the dbcontext class optionally takes connection string constructor parameter, means can programatically build connection string using system.data.sqlclient.sqlconnectionstringbuilder class. here example, in c# (i know sample in vb.net, translation should simple enough, , should illustrate approach): public class mycontext : dbcontext { public mycontext(string servername, string databasename) : base(getconnectionstring(servername, databasename)) { } private static string getconnectionstring(string ser

My ASP.NET site doesn't find files located in different folders -

my website has many pages operate on data in database. since many procedures same, have put of these "general" functions inside (public partial) static class , saved in app_code folder suggested visual studio: root | +-- app_code | | | +-- generalstuff.cs | | | +-- datastructure.cs | +-- default.aspx | +-- default.aspx.cs | +-- etc the problem whenever try use defined inside generalstuff class page doesn't compile because can't find class: compiler error message: cs0103: name 'generalstuff' not exist in current context i can't use files saved in app_data folder. note works fine when running visual studio. additional details: here's version i'm using: - microsoft .net framework version:2.0.50727.3625; - asp.net version:2.0.50727.3634; any hints? cheers is class declaration decorated namespace? if so, need include reference namespace anywhere want use (use using namespace.sub s

c# - Circular reference in same assembly a bad thing? -

assume have following classes in same assembly public class parentclass : idisposable { public childclass child { { return _child; } } } public class childclass { public parentclass parent { { return _parent; } set { _parent= value; } } public childclass (parentclass parent) { parent= parent; } } correct me if wrong bad design. lead memory leak or other unforseen issues later on? apparently garbage collector capable of handling such kind of circular references . edit what if 2 classes end getting used in other class? parentclass objp = new parentclass (); childclass objc =new childclass(objp); objp.child = objc; thoughts please .... don't worry garbage collector; handles reference graphs arbitrary topologies ease. worry writing objects lend creating bugs making easy violate invariants. this questionable design not because stresses gc -- not -- rather because not enforce desired semantic invariant: if x

linux - need input on a NCFTP shell script -

i trying create shell script uploads local directory tree remote server. part of code works fine. when add chmod command ncftp> shell. can me out? code have: #!/bin/bash echo "afbeeldingen uploaden..." ncftpput -rvm -u "username" -p "password" domain.com /domains/domain.com/public_html/wp-content/gallery /shared\ items/beeld/lowres/* ncftp -u "username" -p "password" domain.com ncftp chmod -r 777 /domains/domain.com/public_html/wp-content/gallery/* quit echo "klaar!" exit it possible add chmod command ncftpput command directly. the option -x can used execute command on each of uploaded files. here example single file should executable on server: ncftpput -u "username" -p "password" domain.com \ -x "chmod 0755 /remotepath/hello_world" /remotepath /localpath/hello_world it possible use %s match each of uploaded files. ncftpput -u "username" -p "pass

.net - How Do I Create Packet Headers? -

basically i'm sending , receiving both images, strings , files on client/server connection. can use protocol string commands cannot distinguish between incoming data [if data image or whatever , follow onward instructions]. so how make packet using dim buffer byte() ? i'm going take wild guess @ trying do. if using tcplistener handle incoming http connection respond so: private sub servepng() dim stream networkstream = mytcpclient.getstream dim content byte() = system.io.file.readallbytes("image.png") dim sb new system.text.stringbuilder sb.append("http/1.0 200 ok" + controlchars.crlf) sb.append("content-type: image/png" + controlchars.crlf) sb.append("content-length: " + content.length.tostring + controlchars.crlf) sb.append(controlchars.crlf) dim header() byte = encoding.ascii.getbytes(sb.tostring) stream.write(header, 0, header.length)

c# - Regular expression to remove link from image in html -

what c# / regex syntax remove link first image in body of text like: text <a href="..." class="..."><img src="..." class="..." width="..." /></a> more text <a href="..." class="..."><img src="..." class="..." width="..." /></a> more text so final result be: text <img src="..." class="..." width="..." /> more text <a href="..." class="..."><img src="..." class="..." width="..." /></a> more text any advice appreciated! in advance. using html agility pack ( project page , nuget ), trick: htmldocument doc = new htmldocument(); doc.loadhtml("text <a href=\"...\" class=\"...\"><img src=\"...\" class=\"...\" width=\"...\" /></a> more text" +" <

c++ - Should I stop using abstract base classes/interfaces and instead use boost::function/std::function? -

i've learned std::function , used , have question: have delegates, , when should use abstract base classes , when, instead, should implement polymorphism via std::function objects fed generic class? did abc receive fatal blow in c++11? personally experience far switching delegates simpler code creating multiple inherited classes each particular behaviour... little confused abotu how useful abstract bases on. prefer defined interfaces on callbacks the problem std::function (previously boost::function ) of time need have callback class method, , therefore need bind this function object. in calling code, have no way know if this still around. in fact, have no idea there this because bind has molded signature of calling function caller requires. this can naturally cause weird crashes callback attempts fire methods classes no longer exist. you can, of course use shared_from_this , bind shared_ptr callback, instance may never go away. person has callback partici

android - Animation effect one screen to another screen? -

when go 1 activity activity ,can effect? it possible? if possible, can give me reference or snippet please? thx ok @ demo code on dev site: http://developer.android.com/resources/samples/apidemos/src/com/example/android/apis/app/animation.html the key lines are: startactivity(new intent(activity1.this, activity2.class)); overridependingtransition(r.anim.fade, r.anim.hold); android has standard animations or can create them in xml , save them inside "res/anim"

html - updating javascript function without realoding -

im trying build embedded web server nano wireach smt so far have wrote code <html> <head> <script language=javascript> function swapimage() { var val1 = "~value1~" val1=number(val1); intimage = val1; switch (intimage) { case 0: img1.src = "off.jpg"; return(false); case 1: img1.src = "on.jpg"; return(false); } settimeout("swapimage()",500) } swapimage() </script> </head> <body> <body onload="swapimage()"> <img id="img1" name="img1" src="on.jpg"> </body> </html> through at+i commands nano wireach smt can change ~value1~ content, , sending &

debugging - segmentation fault created by fortran if tests -

suppose have following code if (a.eq.0.or.m(a)) with integer , m(1:3) array of logicals. if equal 0, expect first test catch , second 1 never evaluated. however, if use intel fortran compiler , compiles with -check then got segmentation fault. no error occurs without debugging option. standard behavior? many languages said explicitly in manual for if (a.or.b) if true b not evaluated. fortran standard explicitly requires , b can evaluated if not impact final result? fortran allows for, but not guarantee , short-circuit evaluation of logical operators . safe, have write code under assumption each operand evaluated.

cocoa - NSButton and menu -

Image
how draw nsbutton behaves sent button , menu seen in mail app? doesn't have exact. want button label , disclosure icon no background until user hovers , show menu underneath. check out http://loganrockmore.com/code/?lrfilterbar

jquery - Prevent browser jump to top page when submit the form -

i trying prevent page jumping top when user submits form. there many people suggesting return false . however, prevents form submitted too. i wondering if me it. **jquery** $('#submit').click(function(){ //doesn't work return false; }) $('form').submit(function(){ //doesn't work either return false; }) **html** <form...> <input>... <input>... <input>... <input type='submit' id='submit' value='submit'> </form> when submit form loading new page. returning false in submit handler tells browser not bubble event , not perform default event, in case submiting form, why nothing happening when this. there several solutions problem. if redirecting user (after form submission) form page errors, can include "fragment identifier" in url. have fragment identifier point id of form , browser automatically go part of document. example: <form id="my-form&quo

Does iOS cache remote notifications for apps that are running in background? -

official document apple developer network mentions payload of push notification provided application when it’s running in foreground, or when it’s activated because of push notification. cannot find statement happens when app running in background. i did test instant message application, , found not understand. procedure of test is: enable push notification app switch app background send 2 ims client. 2 push notification arrives @ client , badge on app's icon becomes 2 shut down cellular network prevent app communicating server click app icon switch foreground after these steps, can see 2 messages in chat window. because app not able retrieve messages directly server, explanation push notifications processed app when it’s in background, or cached somewhere , can accessed app when it's switched foreground. ios allows app execute codes when it’s in background, or cache notifications apps? the application caches notifications 2-5 minutes(i don't know e

Background for popup is not displayed in Android -

Image
i new android developer trying write simple contact book. when select delete button has ask confirmation in popup. there no background popup. in code wrote popup in listener in same parent activity. protected void delpopup() { // todo auto-generated method stub layoutinflater inflater = (layoutinflater) displaycontact.this .getsystemservice(context.layout_inflater_service); view layout = inflater.inflate(r.layout.sure,(viewgroup) findviewbyid(r.id.popup_element)); yes_btn = (button) layout.findviewbyid(r.id.buttonyes); no_btn = (button) layout.findviewbyid(r.id.buttonno); pw = new popupwindow(layout, 300, 470, true); pw.showatlocation(layout, gravity.center, 0, 0); preparelisteners(); buttonclick(); mopenhelper = new databasehelper(this); }; and xml file goes this <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://sche

How to give user access right for Collabnet SubVersion with LDAP user -

i define access right collabnet subversion directory ldap domain user. eg. ldap domain user1 have access ../svn/project1 using collabnetsubversionedge-2.2.1. should configure , set in subversion ? want use ldap domain user , don't want create user in subverion. try follow these steps 1. log console. 2. repository tab , click 'access'. 3. edit rules include [project1:/] user1 = rw it give read write access project1 repository user1 domain. alternatively, can modify svn_access_file (under {installation home}/data/conf directory ) directly. once subversion edge integrated ldap, on first login console using ldap user crdential create user use in subversion edge server. i hope helps.

java.util.scanner - Scanner class in Java5 throw java.lang.NullPointerException -

i using scanner class in java5, , following code throw exception: scanner scanner = new scanner (new file(args[0])); int dealid; while (scanner.hasnextline()) { dealid = scanner.nextint(); system.out.println(dealid); } scanner.close(); the stacktrace is: exception in thread "main" java.lang.nullpointerexception @ java.util.regex.matcher.tomatchresult(libgcj.so.10) @ java.util.scanner.mycorenext(libgcj.so.10) @ java.util.scanner.mypreparefornext(libgcj.so.10) @ java.util.scanner.mynextline(libgcj.so.10) @ java.util.scanner.hasnextline(libgcj.so.10) does knows caused exception? the gcj home page suggest "supports of 1.4 libraries plus 1.5 additions. " scanner added in version 1.5 , suspect have hit piece of functionality gcj doesn't support. need try different see can work. is there reason not using openjdk/oracle java 6 or 7? (please don't performance reasons ;)

assembly - extended multiplication with nasm -

as part of assignment have been trying multiply 2 32 bit numbers , store result in 64bit place. however, result incorrect. please me figure why [org 0x0100] jmp start multiplicand: dd 100122,0 multiplier: dd 66015 result: dd 0,0 start: initialize: mov cl,16 mov bl,1 checkbit: test bl,[multiplier] jz decrement multiply: mov ax, [multiplicand] add [result],ax mov ax, [multiplicand+2] adc [result+2], ax mov ax, [multiplicand+4] adc [result+4], ax decrement: shl bl,1 shl [multiplicand],1 rcl [multiplicand+2],1 rcl [multiplicand+4],1 dec cl jnz checkbit mov ax, 0x4c00 int 0x21 the answer in afd debugger f6b3a6 (16587802 in dec) whereas shoul

android - automatically send request to server in phonegap -

i trying develop application in need send data server,but if device not connected net or net connectivity not there should store data in local storage , send server once device gets net access, automatically.. able store in local storage beyond not sure how begin,please guide me,is possible send data after net connects??while surfing issue stumbled on 1 more tool "adobe livecycle" can throw light on it?? what can create service , call service through javascript , put timer or automatically post data server.

r - Reshape three column data frame to matrix ("long" to "wide" format) -

i have data.frame looks this. x 1 x b 2 x c 3 y 3 y b 3 y c 2 i want in matrix form can feed heatmap make plot. result should like: b c x 1 2 3 y 3 3 2 i have tried cast reshape package , have tried writing manual function not seem able right. there many ways this. answer starts favorite ways, collects various ways answers similar questions scattered around site. tmp <- data.frame(x=gl(2,3, labels=letters[24:25]), y=gl(3,1,6, labels=letters[1:3]), z=c(1,2,3,3,3,2)) using reshape2: library(reshape2) acast(tmp, x~y, value.var="z") using matrix indexing: with(tmp, { out <- matrix(nrow=nlevels(x), ncol=nlevels(y), dimnames=list(levels(x), levels(y))) out[cbind(x, y)] <- z out }) using xtabs : xtabs(z~x+y, data=tmp) you can use reshape , suggested here: convert table matrix column names , though have little manipulation afterwards remove colu

java - Returning an element with a specific attribute JDOM -

i need on particular bit of code. i have document object in jdom. have element object root. want specific element based on value of attribute. want avoid, filter through complete list of children, 1 element. there kind of way filter on value of document. lets attribute value '123' now want element 'id' value '123' what best way this? kind regards. i use xpath that. following expression: //element[@attribute='value']

javascript - Using MouseUp instead of AutoFocus as a solution for iPad or iPhone -

here script. i'm trying 1 field auto focus on browsers, mobile borwsers, , ipad browser, cannot work. can me please? i'm trying: o on http://boxoffice.jokerzcomedyclub.com/scanner/ , object field automatically start cursor in it. works on computers, doesn't work on ipad or iphone, i'm looking other alternatives. please help. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>validate ticket</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script src="js/jquery.autofocus-min.js"></script> <script> $('.label').mouseup(function(){ $('[autofocus=""]')

linux - List all files (with full paths) in a directory (and subdirectories), order by access time -

i'd construct linux command list files (with full paths) within specific directory (and subdirectories) ordered access time. ls can order access time, doesn't give full path. find gives full path, control have on access time specify range -atime n (accessed @ least 24*n hours ago), isn't want. is there way order access time , full path @ once? write script, seems there should way standard linux programs. find . -type f -exec ls -l {} \; 2> /dev/null | sort -t' ' -k +6,6 -k +7,7 this find files, , sort them date , time. can use awk or cut extract dates , files name ls -l output

java - Jasper Server - MSWord Exporting Multiple Files -

would export word file - 1 file each record. similiar excel 1 sheet per page type option. jasper great job in regards generating docx file - puts pages in 1 file. jasper reports not have built in function this. designed export 1 file @ time. can in java code. require getting data, , looping through each row , exporting yourself. able reuse jasperdesign object though , not have reinitialize on every loop.

javascript - Appended anchor link is not active on Safari / iPhone -

i've got function, used lot of different parts of site calls confirmation box. when it's called formats box various elements , appends body, so... $('body').append("<div id=\"confirmation\"><a href=\"javascript:confirmed()\">confirmed</a> <a href=\"javascript:closeconfirm()\">cancel</a></div>"); now, works accept iphone safari browser, doesn't seem activate, or load anchor dom properly... it not clickable . problem, tho box appears correctly, touching anchor nothing. console.log proves this. any ideas? have tried doing $div = $('<div>', { id : "confirmation"}); $aconfirmed = $('<a>', { href : "#", class : "confirmed", text: "confirmed"}); $acancel = $('<a>', { href : "#", class : "cancel", text: "cancel"}); $div.append($aconfirmed).append($acancel); $('bo

tcl - How do I bring an R Tk window to the front after launching via Rscript from another application? -

i have script along lines of: if (!require(tcltk2)) {install.packages('tcltk2', repos="http://cran.us.r-project.org"); require(tcltk2)} base <- null done <- tclvar(0) quasitelgui <- function(inputfile = null) { base <- tktoplevel() tkwm.title(base, "quasitel") # files file.frm <- tkframe(base, borderwidth=2) datafile.lbl <- tklabel(file.frm, text="data") datafile.entry <- tkentry(file.frm, state="readonly") datafile.btn <- tkbutton(file.frm, text="browse...") tkgrid(datafile.lbl, datafile.entry, datafile.btn) tkgrid.configure(datafile.lbl, sticky="e") tkgrid.configure(datafile.entry, sticky="ew", padx=1) tkgrid.columnconfigure(file.frm, 1, weight=1) tkgrid(file.frm) tkgrid.configure(file.frm, sticky="ew") # main main.frm <- tkframe(base, borderwidth=2) g1.lbl <- tklabel(main.frm, text="group

c# - How can I get the full size of a Tree View in Windows Forms? -

i don't have "autosize" option in treeview, need know what's full height , full width object taking. can define size of treeview panel, shows scrollbar when content overlaps referred size. is there way know how big content displayed? thank you if want know absolute bottom of content area (only what's expanded), can use nodes property bounds property visible height. treenode tn = tv.nodes[tv.nodes.count - 1]; while(tn.isexpanded) tn = tn.nodes[tn.nodes.count - 1]; return tn.bounds.bottom; just sure have proper error checking (treeview has nodes, etc). width, can't remember how did it. however, might able use treeview's bounds property (might require testing). had similar situation, didn't have autosizing treeview, contained in panel , fill docked, needed handle scrollbars myself resizing treeview on expand/collapse.

vb.net - Convert PDF to TIFF Format -

i writting vb.net application. need able convert either word or pdf file tif format. free nice accept low cost. i sample code if possible, vb preferable know c# it's simple imagemagick (you have download ghostscript, too.). need use vb run process. dim imgmgk new process() imgmgk.startinfo .filename = v_locationofimagemagickconvert.exe .useshellexecute = false .createnowindow = true .redirectstandardoutput = true .redirectstandarderror = true .redirectstandardinput = false .arguments = " -units pixelsperinch " & v_pdf_filename & " -depth 16 -flatten +matte –monochrome –density 288 -compress zip " & v_tiff_filename end imgmgk.start() dim output string = imgmgk.standardoutput.readtoend() dim errormsg string = imgmgk.standarderror.readtoend() imgmgk.waitforexit() imgmgk.close() the arguments varied - use imagemagick docs see are. can simple pas

PHP echo directory contents (as links) not working -

i have php file called download.php link pdf files in directory. allows them appear links open 'save as' instead of trying open in web page. trouble can't following code work. repeats directory items, download.php appended, think php semantics might wrong! got ideas? perhaps not enough info here work out, worth try: code sits on page presenting various pdf files (ordered datelastmodified): <?php // *** folder list repeater start while ($meetingminutes->canrepeat()) { ?> <?php echo '<p><a href=\"http://www.duncton.org/download.php?file=login/uploads2/'.$meetingminutes->folderlist('name').'</a></p><br />'; ?> <?php $meetingminutes->movenext(); } $meetingminutes->endrepeater(); // *** folder list repeater end ?> you're not closing anchor tag propertly. you're missing closing quote , closing bracket. try this <?php // *** folder list repeater s

Prevent MATLAB from changing Java Look and Feel -

i have application written in c++ uses java gui. interface native code using jni. call "frontend" (java gui) , "backend" (c++ app). backend using other libraries , 1 of them matlab shared library. when initiliaze matlab library calling mclinitializeapplication , changes , feel system one. when change metal, there differences in font styles , such. i know matlab using java gui stuff. library using computations, don't need matlab gui. how should tell matlab not change laf or start own jvm? i've never done looks doing, looks want pass in -nojvm flag when use mclinitializeapplication. links below: http://www.mathworks.com/help/toolbox/compiler/mclinitializeapplication.html http://www.mathworks.com/help/techdoc/matlab_env/f8-4994.html

c# - Remove last x lines from a streamreader -

i need read in last x lines file streamreader in c#. best way this? many thanks! if it's large file, possible seek end of file, , examine bytes in reverse '\n' character? aware \n , \r\n exists. whipped following code , tested on trivial file. can try testing on files have? know solution looks long, think you'll find it's faster reading beginning , rewriting whole file. public static void truncate(string file, int lines) { using (filestream fs = file.open(file, filemode.openorcreate, fileaccess.readwrite, fileshare.none)) { fs.position = fs.length; // \n \r\n (both uses \n lines) const int buffer_size = 2048; // start @ end until # lines have been encountered, record position, truncate file long currentposition = fs.position; int linesprocessed = 0; byte[] buffer = new byte[buffer_size]; while (linesprocessed < linestotruncate && currentposition > 0)

Server side callback function ajax web service asp.net -

i'm using web service handle ajax request in project. need call server side function count users online when new request proceed. if want call server side method client side then,you have transform method pagemethod , call method i.e getonlineuser() client side code; i.e. using javascript. to enable method pagemethod, add attribute [webmethod] on top of getonlineuser method in .aspx code behind file. if using asp.net membership provider call membership.getnumberofusersonline() . and if not using membership have implement own custom counter...

Is there any header file in c or c++ to implement data structures like graph,trees etc? -

is there header file in c or c++ implement data structure graph,trees,stack etc? you mean standard library provided data structures can use without writing code creating data structures. standard c not provide such ready use constructus few open source libraries provide functionality though. in c++ standard library provides variety of template based container classes might want use. have @ std::stack & standard library containers

c# - Linq2SQL group-by and sum optimisation -

i've been banging head on 1 while now. want achieve this: select [t2].[nartkey], [t2].[value] [nqty] ( select sum([t0].[nqty]) [value], [t1].[nartkey] [vdatstocktransactions] [t0] inner join [regartsku] [t1] on [t0].[nsku] = [t1].[nsku] group [t1].[nartkey] ) [t2] inner join [regarticles] [t3] on [t2].[nartkey] = [t3].[nartkey] inner join [reggroupconnector] [t4] on [t2].[nartkey] = [t4].[nartkey] [t2].[value] > @p0 what have far linq gives me pretty want, exept quantity... from trans in context.vdatstocktransactions join sku in context.regartskus on trans.nsku equals sku.nsku group trans new { sku.nartkey } grp grp.sum(g => g.nqty) > 0 join art in context.regarticles on grp.key.nartkey equals art.nartkey join ca in context.reggroupconnectors on grp.key.nartkey equals ca.nartkey select new { nartkey = grp.key.nartkey, //nqty = grp.sum(g => g.nqty) }; however, if uncomment nqty this: select [t7].[na

java - source code from APK -

i have searching in search engine regarding convert dex file jar file got failure find dex2jar file in code.google.com i have getting basic idea here . but when download file dex2jar-0.0.9.8.zip form here , unable found dex2jar.jar file can tell me else can find file? extract dex2jar-0.0.9.8.zip file , move desktop folder dex2jar-0.0.9.7...then take android app classes.dex file , move directory ...open terminal , change dex2jar directory..type command ./d2j-dex2jar.sh classes.dex you classesdex2.jar file , can open file using java decompiler...

http - When playing an MP3 from cache, Firefox displays "File not found" -

calling my script should play audio in browser of type audio/mpeg . the audio plays in firefox when force-refreshing, upon second call audio not play. the script tries set cache-control stop caching. yet browser seems caching, , not able retrieve audio content. on first call, browser receives: http/1.1 200 ok date: thu, 08 mar 2012 20:21:16 gmt server: apache x-powered-by: php/5.3.8 cache-control: public, must-revalidate, max-age=0, max-age=86400 pragma: no-cache accept-ranges: bytes content-disposition: inline; filename=627.mp3 content-transfer-encoding: binary content-length: 16299 last-modified: wed, 22 feb 2012 21:58:33 gmt expires: sat, 10 mar 2012 20:21:16 gmt keep-alive: timeout=5, max=100 connection: keep-alive content-type: audio/mpeg on second call, though, receives: http/1.1 304 not modified date: fri, 09 mar 2012 20:21:54 gmt server: apache connection: keep-alive keep-alive: timeout=5, max=100 expires: sat, 10 mar 2012 20:21:54 gmt cache-control: public, m

conference - app_meetme.so asterisk -

i've installed dahdi, followed steps necessary being able make asterisk create conference call there no app_meetme.so file in /usr/lib/asterisk/moldules folder. i've tried search app_meetme.so , download , put in asterisk no success. need help. know download app_meetme.so , how make asterisk work in order create conference calls? need help! appreciate here link i've tried use, no success in case: http://www.asteriskdocs.org/en/3rd_edition/asterisk-book-html-chunk/sla.html for asterisk version above 1.6 have following: 1) install kernel-devel , dahdi-devel - skip if compiled dahdi source code 2) in asterisk source directory make menuconfig select app_metmee in applications 3) continue make &make install

PHP crate an object from a class inside another class -

hello trying create class object class keep getting unknown error don't seem resolve this " helper class " takes content xml file class helperclass { private $name; private $weight; private $category; private $location; //creates new puduct object it's atributes function __construct(){} //list pruducts thedatabase function listpruduct(){ $xmldoc = new domdocument(); $xmldoc->load("storage.xml"); print $xmldoc->savexml(); } ?> } and here trying crate object hleprclassclass , call method listproducts helperclass , code wont work if try instantiate object of helperclass <?php //working code... class busniesslogic { private $helper = null; public function __construct() { } public function printxml() { $obj = new helperclass(); $obj->fetchfromxmldocument(); // want store new object somewhere, maybe: $this->helper = $obj; } } } ?>

git - Strong access control for Gollum? -

what best way add multiple role access gollum wiki? i understand how add basic http auth via, rack middleware. however, know what's required have full multi user/role authentication , authorization. can devise or omniauth used in similar way rails app? what required? with hint http://www.sinatrarb.com/faq.html#auth configuration file this # authentication.rb module precious class app < sinatra::base use rack::auth::basic, "restricted area" |username, password| [username, password] == ['admin', 'admin'] end end end and running as: $ gollum --config authentication.rb in running gollum instance, ask user name , password

Using a returned objects array from a PHP function -

i'm having weird problem. i'm learning php (used program in java), , i'm trying 1 simple thing. have dao method this: while (oci_fetch($parse)) { $stats = new stats(); $stats->setid($id); $stats->setname($name); $stats->setemail($email); $stats->setgender($gender); $stats->setbirthday($birthday); $statslist[] = $stats; } return $statslist; and have php file uses function (called getbyid), test, this: $statsdao = new statsdao(); $statslist[] = $statsdao->getbyid(1); foreach ($statslist $stat) { echo $stat->getname(); } this seems simple enough: dao returns array , other file reads returned array of stats , prints it. i'm getting error message instead: fatal error: call member function getname() on non-object in /var/www/socializi/interfaceusuario/index.php on line 25 the weird thing is: if call foreach loop inside dao's getbyid function,

scala - Why can't my jar see the HBase configuration from the environment? -

i wrote application tried create default hbaseconfiguration, when package application jar won't work because trying use 127.0.0.1's zookeeper , not 1 specified in /etc/hbase/conf/hbase-site.xml . application can stripped down this: object testutil extends app { val hbasetable = new htable(hbaseconfiguration.create, "tablename") println(hbasetable) } when run using following command works fine: classpath=`hbase classpath` java fully.qualified.name.testutil if package jar , call using classpath='hbase classpath' java -jar testutil.jar following error: org.apache.hadoop.hbase.zookeeperconnectionexception: hbase able connect zookeeper connection closes immediately. i've checked logs , can see trying connect 127.0.0.1 zookeeper, different zookeeper configuration in /etc/hbase/conf/hbase-site.xml . jar seems ignoring classpath though explicitly set on command line. how can make jvm honor classpath when executing jar? when

asp.net - Setting MaxLength on TextBox depending upon DropDownList selection? -

i have textbox displayed depending upon selection in dropdownlist. default behavior of textbox visible="false" . maxlength value need vary depending upon selection in dropdownlist. note textbox not displayed. i have provided markup below. <asp:updatepanel id="updatepanel" runat="server" childrenastriggers="false" updatemode="conditional" rendermode="inline"> <contenttemplate> <asp:dropdownlist id="ddllist" runat="server" autopostback="true" onselectedindexchanged="ddllist_selectedindexchanged"> </asp:dropdownlist> <asp:textbox id="tbother" runat="server" visible="false" onprerender="tbother_prerender"></asp:textbox> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="ddllist" />

windows server 2003 - Multiple VPN connections behind NAT -

i have following problem: i have windows 2003 ras vpn server configured single nic (let's call lan1) behind firewall (lets call it's public address wan1). pptp & l2tp ports forwarded server. when client (windows or linux) in remote network behind firewall (lan2) tries connect pptp vpn on wan1 goes fine. when second client in same lan2 tries connect same vpn on same wan1 error 629. it's independant of machine gets first connection. apparently problem independant of router/firewall hardware of lan2 (we have tested @ least 5 different types of remote small router/firewalls - linksys, huawey, d-link, etc.) the firewall wan1 listens 2 internet connections. problem independant of external address clients pointing (even if 2 different workstations point different ip addresses attempt stablish vpn). inside lan1, there no such limitation , multiple workstations connect fine. theres no limitation different remote lans. is limitation of pptp protocol? thanx

sql server - Programmatically create stored procedure -

i have meta table , creating stored procedures using t-sql string concatenation. declare @sql varchar(max) = 'select '; select @sql += ... meta -- select clause select @sql += ... meta -- clause .... it's hard maintain when stored procedures complex. is better to declare @sql xml = (select ... meta xml, auto); -- apply xslt transformation how xslt in sql server 2008? clr function way? other solution these kind of meta programming in t-sql? i think xquery should enough purpose.

android - Can Services implement the SensorEventListener -

can use sensoreventlistener service? i want when application running in background service being active. when user shakes phone want code run in background. possible services detect shake changes?? thanks in advance! yes, possible. because, saw application (avast) in there option whenever lost phone, can request device gps location out permission of user , send web. webservice activate android services in mobile automatically activate gps out users interface , send location.

python - Transform Dictionary-Like Input to a Dictionary -

how transform dictionary input real dictionary can process? when execute external command, get. {'aaa': {'test_a': 0.11666666666667, 'test_b': 1, 'total_c': 0.11666666666667}, 'bbb': {'test_a': 32.883333333332999, 'test_b': 1, 'total_c': 0.11666666666667}, 'ccc': {'test_a': 11, 'test_b': 31, 'test'_c': 33}} so, can see, above dictionary-format already. thinking of doing like. #!/usr/bin/python import command result = commands.getoutput('<execute_external_command') so 'result' becomes dictionary , can process dictionary. from simplejson import loads result='{"name":"anton"}' dictionary=loads(result) print dictionary result="{'name':'anton'}" dictionary=loads(result.replace("'",'"')) print dictionary

php - Suggestions to a beginner Web developer -

i know html school days after shifted desktop application programming (in .net regime), @ work use cobol.:(. enhance skill set , break through boredom decided learn web & mobile technologies. plan learn php - apache config - android basics first , dive deeper(database know). hear web/app developer should versed in graphic tools (photoshop/maya) etc. true? if yes tool suggest should try hands on first? please suggest resources on these topics, best practices learn stuff. know google there no match professional advice..:d suggestions on plans (anything missed or must include) welcome. think should future course in regime (i plan freelance later) , how time take? else have master if want @ it. most people try choose direction professional career. (very) professional developers know of aren't designers ;-) isn't must both designer , developer. you've got different tools design applications/websites. use photoshop because i'm used it. lately see people

iPhone Popup in CSS -

Image
i making website designed iphone ui, , using popup. popup (i don't know it's called) mean sort of thing: my question is, how make buttons on it? tried it, , -webkit-border-image doesn't work. thanks! there 2 ways this. 1 way use webkit css properties, -webkit-border-radius. combine other webkit-specific properties , (after long time) rather results. however, there easier method. can make button image (by photoshopping screenshot) , use background link. have find right font , use webkit text shadow : easy method great results!

twitter bootstrap - Sorcery and Simple Form implementation -

long time reader first time user. i'm putting first ror application , i've isolated app should use down to:- sorcery omniauth cancan twitter-bootstrap (converted sass) and simple forms. clean, clear , simple....not. cannot life of me integrate (what seem simplest of tasks) simple forms sorcery "login" without getting errors on 'remember_me' field. simple forms doesn't have simple_form_tag (only simple_form_for) option work best on login form sessions controller new method. instead have create @user instance in method, errors on 'remember_me' field "undefined method `remember_me'" any appreciated. i mean greatly! huge thanx in advance :) sessions/new.html.erb <% provide :title, "log in" %> <h1>log in</h1> <%= simple_form_for @user, :html => { :class => 'form-horizontal' } |f| %> <fieldset> <legend>login</legend> <%= f.input :email,

c - what's the difference between the threads(and process) in kernel-mode and ones in user-mode? -

my question: 1)in book modern operating system , says threads , processes can in kernel mode or user mode, not what's difference between them . 2)why switch kernel-mode threads , process costs more switch user-mode threads , process? 3) now, learning linux,i want know how create threads , processes in kernel mode , user mode respectively in linux system? 4)in book modern operating system , says possible process in user- mode, threads created in user-mode process can in kernel mode. how possible? user-mode threads scheduled in user mode in process, , process thing handled kernel scheduler. that means process gets amount of grunt cpu , have share amongst user mode threads. simple case, have 2 processes, 1 single thread , 1 hundred threads. with simplistic kernel scheduling policy, thread in single-thread process gets 50% of cpu , each thread in hundred-thread process gets 0.5% each. with kernel mode threads, kernel manages threads , schedules them indep

javascript - Identifying the File System Root with Node.js -

i'm doing basic operation start given directory, , traverse filesystem until hit root. on linux/mac, root / , on windows can c:\ or drive letter of course. question whether or not there way node.js identify root directory of filesystem is. currently, i'm resorting checking last directory against path.normalize(dir + "/../") see if stops changing. there process property/method out there? maybe module? would not work? var path = require("path"); var os = require("os"); var root = (os.platform == "win32") ? process.cwd().split(path.sep)[0] : "/"

c++ - How does returning values from a function work? -

i had serious bug, forgot return value in function. problem though nothing returned worked fine under linux/windows , crashed under mac. discovered bug when turned on compiler warnings. so here simple example: #include <iostream> class a{ public: a(int p1, int p2, int p3): v1(p1), v2(p2), v3(p3) { } int v1; int v2; int v3; }; a* geta(){ a* p = new a(1,2,3); // return p; } int main(){ a* = geta(); std::cerr << "a: v1=" << a->v1 << " v2=" << a->v2 << " v3=" << a->v3 << std::endl; return 0; } my question how can work under linux/windows without crashing? how returning of values done on lower level? on intel architecture, simple values (integers , pointers) returned in eax register. register (among others) used temporary storage when moving values in memory , operand during calculations. whatever value left in register treated return v

Using jquery to slide in content horizontally -

i have few links on page refers content divs on same page. i'm trying create simple horizontal sliding effect sliding effect show content. example, box1 content should visible, , when clicked on link2, box2 content shold slide in. <a href="#box1">link 1</a> <a href="#box2">link 2</a> <a href="#box3">link 3</a> <div class="content"> <div id="box1">..</div> <div id="box2">..</div> <div id="box3">..</div> </div> please have @ jsfiddle here: http://jsfiddle.net/g9evf/ maybe this? http://jsfiddle.net/3vrh9/4/ making use of plugin http://demos.flesler.com/jquery/scrollto/ plugin source: http://demos.flesler.com/jquery/scrollto/js/jquery.scrollto-min.js

Explain why 60.61.62.63/26 is not a valid host IP address? -

can explain why 60.61.62.63/26 not valid host ip address? shall thank full you. it's broadcast address. host bits 1. /26 = 255.255.255.192 192 = 11000000 63 = 00111111

database - Difference between NOT NULL constraint and CHECK(attr is not null) -

i wanted create outline constraint alter key(not null + unique), think not null constraint can't placed outline, therefore, think have options: outline constraint: check(attr not null) in-line constraint not null + outline constraint unique(attr) is there difference between set in-line constraint not null column , add constraint check (column not null) ? thanks in advance defining column not null preferred approach. indicate in dba_tab_cols , all_tab_cols , , user_tab_cols data dictionary view, example, column not nullable . conventional approach future developers more expect not null constraints defined on columns cannot null . just define unique constraints along not null constraints rather creating primary key constraints, define check constraints rather not null constraints. both approaches work in same way functional standpoint. data dictionary views display approaches differently tools rely on data dictionary may behave differently. , co

javascript - Dynamic layout in JS/CSS/HTML -

in application users define documents layouts. these layouts logically tables of time, users specify "property" going displayed in cell. can define number of rows , columns how many rows or columns property take (collspan , rowspan in html terminology). now given document layout, , set of documents need display in browser. i on client side, possibly using jquery or/and knockout.js, or other framework/library. before start reinventing wheel, can point me in right direction of doing it? not sure if counts question. it's quite open interpretation here goes. define layoutviewmodel set of multi-dimensional observablearrays. each index in multidimentional array corresponds property object holds data rowspan, colspan etc (not sure data need). display layout foreach bindings. have 2 of these, 1 selection , 1 display. below attempt @ display one. <table data-bind="foreach: rows"> <tr data-bind="foreach: columns">

android - Andengine fade in/out and alpha modifiers not working -

i have problem andengine gles2. i have code: sprite black = new sprite(0,0, blackregion, this.getvertexbufferobjectmanager()); black.setsize(camera_width, camera_height); black.registerentitymodifier(new alphamodifier(2, 0, 255)); mscene.attachchild(black); so it's not working. nothing does... what need do? did set blend function properly? example: sprite.setblendfunction(gl10.gl_src_alpha, gl10.gl_one_minus_src_alpha);

jquery - php json from url, "no such file or directory" -

<?php header('cache-control: no-cache, must-revalidate'); header('content-type: application/json'); $jsondata = json_decode(file_get_contents(urlencode('https://chart.googleapis.com/chart?cht=p3&chs=250x100&chd=t:60,40&chl=hello|world&chof=json'))); echo $jsondata; ?> error: failed open stream: no such file or directory in <b>c:\wamp\www\file.php i want print result json string can handle jquery ajax. missing? thanks you realise have space in url (results in 400 google). also, don't want use urlencode() here. i'd hazard guess don't want use json_decode() return object or array. so, try instead readfile('https://chart.googleapis.com/chart?cht=p3&chs=250x100&chd=t:60,40&chl=hello|world&chof=json'); exit; to you're attempting, please pay attention note in manual a url can used filename function if fopen wrappers have been enabled. see fopen() more details on ho

ruby - Regular expression match that excludes characters inside parenthesis -

i have following types of strings. bill smith (usa) winthrop (fr) lord @ war (gb) kim smith with these strings, have following constraints: 1. caps 2. can 2 18 charters long 3. should not have white spaces or carriage returns @ end 4. country abbreviation inside parens should excluded 5. of names not have country in parens , should matched too after applying regular expression i'd following: bill smith (usa) => bill smith winthrop (fr) => winthrop lord @ war (gb) = lord @ war kim smith => kim smith i came following regular expression i'm not getting matches: string.scan(\([a-z \s*]{1,18})(^?!(\([a-z]{1,3}\)))\) i been banging head on while if can point error i'd appreciated it. update: i've gotten great responses, however, far none of regular expression solutions have met constraints. tricky part seems of string has country in parenthesis , don't. in 1 case strings without country not being matched , in returning correct string alon

Following Ruby-on-Rails tutorial and getting 'destroy users' doesn't work -

i've installed ruby on rails 3.2 , have been trying learn it. i've been following along ror 3.0 tutorial (http://ruby.railstutorial.org/chapters/updating-showing-and-deleting-users#top) , far going (yes know there's 3.2 version). currently stuck on section 10.4.2 teaches how add link destroy users. says add code <%= link_to "delete", user, :method => :delete, :confirm => "you sure?", :title => "delete #{user.name}" %> as adding in apps/view/layout/application/html/erb <%= javascript_include_tag :defaults %> it seems should take right destroy method in user controller, tutorial says not working me , cannot figure out why. link creates /user/:id. looked @ same section in 3.2 tutorial , same directions (but not have javascript include tag code). can't work following tutorial. not sure why not working or how work. so clear, rather going destroy method in user controller, goe

android - Send an oobject from activity to fragment -

i have object in main activity stores bunch of data xml document , want able access information on several different fragments display information. how can go doing that your object can implements java.ioserializable . allowed pit instance of object android bundle putserializable . can use setarguments method pass bundle instance through fragment

r - Multiple plots with high-level plotting functions, especially plot.rqs() -

i trying plot 2 regression summaries side-by-side 1 centered title. each regression summary generated plot.rqs() , amounts set of 9 plots. i've tried using par(mfrow=c(1,2)) already, learnt paul murrel's (2006) book, high-level functions plot.rqs() or pairs() save graphics state before drawing , restore graphics state once completed, pre-emptive calls par() or layout() can't me. plot.rqs() doesn't have 'panel' function either. it seems way achieve result modify plot.rqs() function new function, modified.plot.rqs() , , run par(mfrow=c(1,2)) modified.plot.rqs(summary(fit1)) modified.plot.rqs(summary(fit2)) par(mfrow=c(1,1)) from there might able work out how add overall title image using layout() . know how create modified.plot.rqs() function used in way? thanks you can patch function follows: use dput , capture.output retrieve code of function, string; change want (here, replace each occurrence of par function nothing); evaluate

java - Bouncy castle no such provider exception -

i have added bouncy castle jar file application class path in android , in java. code i've used in both of them. doesn't seem recognize provider "bc". securerandom sr1=new securerandom().getinstance("sha1prng", "bc"); system.out.println(sr1.getprovider()); sr1.setseed(12); byte[] a=new byte[0]; sr1.nextbytes(a); int ai=a[0]; system.out.println(ai); throws following exception in both android , in java: java.security.nosuchproviderexception: no such provider: bc how correct this? had not added provider in policy file. after doing getting following exception. java.security.nosuchalgorithmexception: no such algorithm: sha1prng provider bc<br> does mean bouncy castle not provide implementation of "sha1prng" algorithm? whole reason imported bouncy castle have common provider in both android , in java, sequence of random numbers generated same seed same in both android , java.

php - htaccess eliminate folders -

this htaccess code, it re-write urls this mysite.com/profile.php?id=123&network=stackoverflow to this mysite.com/stackoverflow/profile.php?id=123 but problem is, users cannot reach js,css or images. i.e. mysite.com/css/style.css mysite.com/js/javascript.js mysite.com/img/logo.png how can eliminate real folders img,js,css etc..? my htaccess is, options +followsymlinks rewriteengine on rewriterule ^([^\/]+)/(.*)$ /$2?network=$1 [qsa,l] the following ignore requests actual files/directories rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^\/]+)/(.*)$ /$2?network=$1 [qsa,l]

Paypal - use latest API version by default -

i’d app use latest version of paypal api, it’s understanding if not specify “version” in nvp collection latest version called default. can confirm this? no, that's 1 of many lies in paypal docs :) 10006 version error version not supported so i'm using "the current version" of october 2 2012 95.0 ( link ).

How much data can rails parameter pass? -

i'm trying make post request server along massive string of data placed database. noticed cut off @ point (about 440k of data in 1 variable). i'm wondering how data can rails hold in parameter pass server? thanks. there no limit imposed rails on size of posted data (or data passed in url) other intermediaries may have have limits however, example nginx has client_max_body_size . check database settings: if data longer maximum length of corresponding column databases silently truncate (others raise error). i'd start checking in controller parameters have expected length.

iphone - Continue the previous downloading session coming from the server when the app is reconnected to the server -

in application downloading images server.suddenly server disconnected while downloading , if again connected ,the process starting first image, need resume process. can 1 suggest me how approach it. try link, may helpful you. http://allseeing-i.com/asihttprequest/how-to-use#using_a_download_cache

MySQLdb and regular expression in python -

import mysqldb x=raw_input('user> ') y=raw_input('passwd> ') db=mysqldb.connect(host="localhost", user="%s", passwd="%s" % x,y) cursor=db.cursor() cursor.execute('grant on squidctrl.* sams@localhost identified "connect";') cursor.execute('grant on squidlog.* sams@localhost identified "connect";') cursor.close() question how can use right, don't want enter username , password in script in beginning, want myself wish. when try run put username , pass, after mistake traceback (most recent call last): file "test.py", line 8, in <module> db=mysqldb.connect('host="localhost", user="%s", passwd="%s"' % x,y) typeerror: not enough arguments format string you don't need use string interpolation ( "%s" % ... ) here. import mysqldb user = raw_input('user> ') password = raw_input('passwd> ') db=

oracle - ORA-01855: AM/A.M. or PM/P.M. required -

i error: ora-01855: am/a.m. or pm/p.m. required when try execute following query. insert tbl(id,start_date) values (123, to_date ('3/13/2012 9:22:00 am', 'mm/dd/yyyy hh:mi am')) where start_date column of type "date". i have executed following query , gave no errors, still not success yet in above issue: alter session set nls_date_format = "mm/dd/yyyy hh:mi am"; your format mask must match format of string converting. either want add ss format mask or remove seconds string insert tbl(id,start_date) values (123, to_date ('3/13/2012 9:22:00 am', 'mm/dd/yyyy hh:mi:ss am')) or insert tbl(id,start_date) values (123, to_date ('3/13/2012 9:22 am', 'mm/dd/yyyy hh:mi:ss am')) if want accept string contains seconds don't want store seconds in database (in case oracle store 0 seconds), can use trunc function insert tbl(id,start_date) values (123, trunc( to_date ('3/