Posts

Showing posts from 2012

C# patterns subclasses -

i have class person , 2 child classes staff , student , interface iperson . have class database , class gateway . class database has private string id = "username"; and method public void getid() {return id;} both staff , student have getid() methods. gateway has check if method getid() requested staff ( return id ) or student ( return "go away!" ). can please me that. thinking using gateway interface of database class, because trying learn c#, don't know how that. or maybe there's better way of doing this... please thanks here's code: public class staff : person { public staff() {} public staff(string id): base(id) {} public override string getname() { throw new notimplementedexception(); } public override void update(object o) { console.writeline(id + " notified {1}", id, o.tostring()); } public override void updatemessage(object p) { console.writeline(i...

extjs - Move Ajax respose data to store in Sencha touch -

how add or save data getting ajax request store or model sencha touch 2 have controller, store , model. ext.ajax.request(); called controller , when successful want move data store in json format ext.define('myapp.controller.homecontroller', { extend: 'ext.app.controller', config: { control: { "#homepage_id": { show: 'onhomepage_idshow' } } }, onhomepage_idshow: function (component, eopts) { var token = localstorage.getitem('token'); //************************************** console.log('test home', token); var customheaders = { 'content-type': 'application/json; charset=utf-8', 'apiauth': token }; this.callajax(customheaders); }, callajax: function (headers) { var customheaders = headers; ext.ajax.request({ url: 'http://local...

java - passing empty field as parameter in jasper ireport -

the query select * db_accessadmin.customersummary (accountnumber = $p{accountno} or $p{accountno}='') , (ppusermobile = $p{mobileno} or $p{mobileno}='') , ( ppuserstaticid = $p{customerid} or $p{customerid} = '') , (cast(requestdate date) between (cast($p{fromdate} date)) , (cast($p{todate} date))) the aim generate report in jasper depending on values of parameters. when parameters 'fromdate' , 'todate' empty , query should pull out entire rows in db. how can modify query accepts null values 'fromdate' , 'todate'. xml file <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="customersummary2" language="groovy" pagewidth="595" pageheight="8...

delphi - A form that does not handle mouse and keyboard event -

this question has answer here: click through transparent form 1 answer i want make form in delphi not handle mouse , keyboard events , pass them window below itself. how can this? you can make use of procedure blockinput of user32.dll you can try (with caution!): procedure bloqued(block:boolean); var milib: thandle; blockinput : function(block: bool): bool; stdcall; begin milib := getmodulehandle('user32.dll'); if milib <> 0 begin @blockinput := getprocaddress(milib, 'blockinput'); if @blockinput <> nil begin blockinput(block); end; end; end; procedure tform1.button1click(sender: tobject) ; begin bloqued(true); sleep(1000); bloqued(false); end; version without dinamic loading: function blockinput (block: bool): bool; stdcall; external 'user32.dll'; procedure tform1.button1click(...

amazon ec2 - Running Chrome on an AWS micro instance -

let me start saying server administration experience limited, please forgive me if i'm making assumptions might seem odd. i've written extension google chrome , i'd test stability when left running continuously days, unfortunately have no access pc or laptop can leave on 24/7. idea set ec2 micro instance ubuntu, install ubuntu-desktop , vnc server, , connect via vnc instance, access graphical desktop interface, install google chrome, add extension , let run there. does sound feasible, or silly idea? potential limitations run into? aws gives complete control of os you're suggesting makes sense. the main disadvantages of running gui on network come down bandwidth , latency issues, might want consider getting ec2 instance close region possible. keep in mind aws security groups, need configured allow vnc connection. micro instances aren't made production use, may find it's not true test of typical system. should factor test may more appropriat...

linux - Why does glob lstat matching entries? -

looking behavior in this question , surprised see perl lstat() s every path matching glob pattern: $ mkdir dir $ touch dir/{foo,bar,baz}.txt $ strace -e trace=lstat perl -e 'say $^v; <dir/b*>' v5.10.1 lstat("dir/baz.txt", {st_mode=s_ifreg|0664, st_size=0, ...}) = 0 lstat("dir/bar.txt", {st_mode=s_ifreg|0664, st_size=0, ...}) = 0 i see same behavior on linux system glob(pattern) , <pattern> , , later versions of perl. my expectation globbing opendir/readdir under hood, , not need inspect actual pathnames searching. what purpose of lstat ? affect glob()s return? this strange behavior has been noticed before on perlmonks . turns out glob calls lstat support glob_mark flag, has effect that: each pathname directory matches pattern has slash appended. to find out whether directory entry refers subdir, need stat it. apparently done when flag not given.

jquery - Assigning collection object of Tuple<String,String,String> to javascript variable in .NET MVC -

i have model collection of tuple <string,string,string> public class patientdetails { public collection <tuple<string,string,string>> fieldvalidationrules { get; set; } } view stronglytyped i.e patientdetails accessed in cshtml @model now want assign fieldvalidationrules object javascript variable can refer client validations per rules specified in collection. have following line of code: $(document).ready(function(){ _jsfieldvalidationrules = "@model.fieldvalidationrules"; }); but have problem here _jsfieldvalidationrules doesn't assigned values in "@model.fieldvalidationrules instead gets assigned to: system.collections.objectmodel.collection 1[system.tuple3[system.string,system.string,system.string]] what do make work. what do make work. use json serializer: $(document).ready(function() { _jsfieldvalidationrules = @html.raw(json.encode(model.fieldvalidationrules)); });

c# - Azure Worker Role Copy File from Linux VM -

i'm pretty new azure platform, have tried search on google assistance unfortunately google searching skills aren't best. i have linux vm in azure, linux vm have wav files on it, need copied off of it. my plan use wokrer role access linux vm , copy files off using scp, , storing them in storage account in azure. is possible have few pointers in right direction of how accomplished? in case, there no need worker role (which nothing more windows server vm running in cloud service). if did need worker role instance talking linux instance, you'd have connect them virtual network. i'm guessing you're starting out, , solution sounds over-engineered. instead: write directly blob storage linux-based app. if you're using .net, java, php, python, or ruby, there sdks handle - go here , scroll down developer centers, download sdk of choice, , @ of getting-started tutorials. just remember blob storage storage-as-a-service, accessible anywhere. undernea...

camera - Face Detection in Android without user interaction -

i want detect numbers of faces in front camera frame. can detect face once image using : http://www.developer.com/ws/android/programming/face-detection-with-android-apis.html . don't know how capture image using front camera every 30 seconds without user interaction.can please me? following code capture photo camera after every 5 secs. if (timer_started) { multishottimer.cancel(); multishottimer.purge(); timer_started = false; } else { multishottimer = new timer(); multishottimer.schedule(new timertask() { @override public void run() { timer_started = true; camera camera = surfaceview.getcamera(); camera.takepicture(null, null, new handlepicturestorage()); } }, 1000, 5000l); } here, timer_started boolean indicate whether timer running or not. following code handlepicturestorage private class handlepicturestorage implements picturecallback { @override pub...

PHP try-catch not recognized on command-line? (Trying to install Composer) -

i trying install composer ( http://getcomposer.org/download/ ) on godaddy-hosted linux server it's not working. no matter method try, run against version of following error: parse error: syntax error, unexpected '{' on line 290. line 290 refers line 290 in file: https://getcomposer.org/installer start of try-catch block. and, indeed, simple script like: echo '<?php echo "hello world "; try {echo "goodbye";} catch (exception $e) {} ?>' | php produces same type of syntax error (forgive awkward piping. godaddy doesn't seem -r option). similarly, if put code in file "argh.php" , run php -f argh.php syntax error, work fine if visit page in browser. does know why php keeps choking on try-catch block or other way can install composer? (p.s., using php 5.3) echo '<?php echo "hello world "; try {echo "goodbye";} catch (exception $e) {} ?>' | /web/cgi-bin/php5 works fine...

C# - Emgu Cv - Face Recognition- Loading training sets of Faces saved to Access database as a binary in to EigenObjectRecognizer for Face recognition -

i having hard time loading training set ms access database in main form face recognition. saved training sets names , id in database binary data ole object format.the method used change, save , read data database , in training sets private static byte[] convertimagetobytes(image inputimage) { using (bitmap bmpimage = new bitmap(inputimage)) { using (memorystream mystream = new memorystream()) { bmpimage.save(mystream, system.drawing.imaging.imageformat.jpeg); byte[] imageasbytes = mystream.toarray(); return imageasbytes; } } } the method use store converted byte data database following: private void storedata(byte[] imageasbytes,string namestudent,string idstudent) { if (dbconnection.state.equals(connectionstate.closed)) dbconnection.open(); try { //messagebox.show("saving image @ index : " + row...

Linear programming library for .NET / C# -

i need solve under-determined linear system of equations , constraints, find particular solution minimises cost function. needs done in purely portable managed code run in .net , mono. freely available libraries there can use implement this? all of optimisation algorithms provided free libraries have found support interval constraints on single variables, e.g. 0 < x < 1 , not constraints x + 2y < 4 . have found linear equations solvers support linear systems 1 solution. the closest have found far dotnumerics , includes singular value decomposition solving under-determined linear systems, optimisation algorithms support single-variable constraints (as far can tell). there several other questions asking linear programming, key requirements multi-variable constraints , solving under-determined systems. have yet find free library supports multi-variable constraints. alglib usual go-to library things linear solvers. give before despairing.

java - Tomcat External Executable Call -

i using application runs on tomcat 5 environment. application needs call external application (delphi executable). using following command line make call: process pr = rt.exec(pattodelphiexe); pr.waitfor(); when start tomcat application, application delphi exe started well, however, when tomcat started service, delphi exe started attached tomcat service "as service". i need delphi exe started application when call made through tomcat service. i tried code below apache lib no success: commandline cmdline = commandline.parse(pathtodelphiexe); defaultexecutor executor = new defaultexecutor(); defaultexecuteresulthandler resulthandler = new defaultexecuteresulthandler(); executor.setexitvalue(1); executor.execute(cmdline, resulthandler);

java - JAX-WS issuing GET then GET and POST -

i wrote jax-ws client using classes generated wsimport invoke webservice. test client locally, wrote implementation of webservice , published locally , called it. worked expected. one thing noticed client connects endpoint , issues followed connection against endpoint looking wsdl, , issues post payload in same connection. here tcpmon output (edited protect guilty): get /somews http/1.1 user-agent: java/1.7.0_03 host: 127.0.0.1:9877 accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 connection: keep-alive ---------------------------------- /somews?wsdl http/1.1 user-agent: java/1.7.0_03 host: 127.0.0.1:9877 accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 connection: keep-alive post /somews http/1.1 accept: text/xml, multipart/related content-type: text/xml; charset=utf-8 soapaction: "document/http://someurl" user-agent: jax-ws ri 2.2.4-b01 host: 127.0.0.1:9877 connection: keep-alive content-length: 610 <valid soap message here/> is...

android - Why are incorrect values being passed between Java and C++ via JNI? -

i want pass double value c++ java (android) using jni. relevant c++ code: jniexport jdouble jnicall java_test_mpeg_dash_ffmpeg_playerui_notif(jnienv* env, jobject obj,jint st){ jdouble p=receiver->buffer->notify(); logi("notifyyyyyyyyy jni %d ",p); return p; } displays 35, 36, etc when accessed in java calling native method, wrong values returned: 0.0000133333 relevant java code: double buf=notify(); log.d(tag, "bufffffffffffffffffffffffffer :"+buf" ms"); why values inconsistent? "%d" not format specifier compatible floating point types. if use it, force misinterpretation of bits comprising jdouble, , print incorrect value. it's value returned java correct (there's fair amount of type enforcement there), , being logged incorrect.

c# - Building a Comic strip RSS reader - feeds won't show -

i went through this guy's tutorial build rss reader in hopes of converting comic strip reader, when try so, app never works way want to. the app in it's current state has item's page items lead split page displays blogs feed tutorial provides, when try , use my own feeds app displays empty items page tile , split page behind shows nothing "author, pub date, link, categories" stacked in centre of screen. what want have happen have app launch split screen directly , display these comic strips , i'm not sure how make happen... cheers. you might fetching data wrong rss url. follow these steps download blog reader sample that link open feeddata.cs file. see & changes in downloaded project. go getfeedsasync() method definition. contains rss channels. replace http://blogs.windows.com/bla-bla-bla rss urls theses urls. most popular : http://feed.dilbert.com/dilbert/most_popular strips : http://feed.dilbert.com/dilbert/daily_strip b...

performance - Android Client-Server architecture: GCM versus webservice -

Image
i have android application local database contains information pictures stored on device. want create server pictures provided on demand devices have application installed. application can provide local pictures or pictures server , needs information related pictures. i analyzed gcm , great message communication, since size of message limited 4kb can't send pictures. idea have this: my question is: in context gcm communication useful or more efficient have client-server communication through webservice? i assume if use gcm, in server-client communication use code bellow in "bitmap fun" example receive picture bitmapfactory.decodefile(pictureurl, options); the approach above requires more battery , bandwidth since asking 1 picture @ time instead of array of 50pictures? if don't use gcm, should handle (e.g. device in stand by)? gcm useful if server needs alert client application new data (in case new pictures). allows server send data client whi...

asp.net mvc 4 - MVC4 OAuthWebSecurity unknown method RegisterClient after upgrading DotNetOpenAuth to 4.3.0.13117 -

before upgraded using custom oauth clients, after upgrading dotnetopenauth nuget packs error of "unknown method registerclient" when calling oauthwebsecurity.registerclient. worked fine before upgrading, here code snippet. var extradata = new dictionary<string, object>(); extradata.add("icon", "/../../images/login/google.png"); oauthwebsecurity.registerclient( client: new customgoogleclient(oauthsettings.googleclientid, oauthsettings.googlesecretid), displayname: "google", extradata: extradata); sorry issues question might have cause, fixed removing dotnetopenauth , reinstalled package.

css - Div positioned absolute not showing up in firefox -

i have div (#socmed) ul containing li's have positioned @ top right of page. can find div inside header tag. these social media buttons way. http://digilabs.be/tutu/collection.php as can see, shows in chrome , safari (haven't tested in ie yet). i have tried changing z-index, because felt got overlapped parent div, colored pink. didn't seem work. have no idea do. thanks in advance help. in main.css:line 73 add width <li> item. #socmed li { list-style: none outside none; margin-top: 5px; width: 25px; /* add width..! */ } this seems fix problem. your outer #socmed div has width: 25px , <li> within not, , default larger 25px specified on #socmed , not display.

php - How to order by a segment of preg_match_all results? -

i'm using php generate list of references text doing preg_match_all search on database table. here php code: $query = "select primary_tag,display_short_title,content topics;"; $result = mysql_query($query) or die("query failed : " . mysql_error()); $num_results = mysql_num_rows($result); ($i = 0; $i < $num_results; $i++) { $row = mysql_fetch_array($result); if (preg_match_all("/(\<i\>u\<\/i\>|u) [0-9]{1,2}\.[0-9]{1,7}/", $row["content"], $matches)) { foreach ($matches[0] $match) { $match = ltrim(strip_tags($match), "u "); echo '<p class="textmark_result">' . $match; echo ' <a href="../essays/topic.php?shorttitle=' . $row["primary_tag"] . '">' . $row["display_short_title"] . '</a>'; echo "</p>\n"; } } } and results (viewing source) this: <p class="textmark_result...

Spring 3 AOP java.lang.ClassCastException: $Proxy43 cannot be cast -

i use spring 3.1 , apo(proxy). annotation provided used pointcat. in case spring aop proxy method "getmergemappingsandcals" annotated calendarmappingannotation my advise afterreturning aspect: @component @aspect public class mappingfilteraspect{ /** * * @param retval */ @afterreturning( pointcut="@annotation(...annotation.calendarmappingannotation)", returning="retval" ) public void calendarmappingfilter(object retval) { } } annotation: @retention(retentionpolicy.runtime) @target(elementtype.method) public @interface calendarmappingannotation { } usage: @component public class apoimappingmanagerimpl implements apoimappingmanager, applicationcontextaware, serializable { ... @calendarmappingannotation public mergedmapandcalsbeancollection getmergemappingsandcals(){ ... } } configuration: <context:component-scan base-package="...aus.aspect" /> ...

android - Gridview in fragment -

i trying use gridview in layout code saying can't make static reference non-static method. thought using gridview in fragment same activity this code: public static class miscfragment extends fragment { /** * fragment argument representing section number * fragment. */ public static final string arg_section_number = "section_number"; public miscfragment() { } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.misc_fragment, container, false); gridview gridview = (gridview) findviewbyid(r.id.gridview); return rootview; } } i set gridview adapter . problem caused findviewbyid(r.id.gridview); you should using rootview.findviewbyid(r.id.gridview) .

javascript - Locking elements in contenteditable="true" div -

i have contenteditable div that's used user input, when button clicked shows options replace words. first strips away html , creates span elements word can replaced. mark of these words different , face problems. when clicking directly before or after span , typing text text have same markup span. it's hard add words on line has span. thinking of solving padding spans &nbsp; looks kind of strange. user can click in span , change it, rather have user click on span , choose replace or ignore option before changing it. in other words needs locked. thinking of doing capturig keyup , if comes span e.preventdefault() on it's bit of pain program it. so questions are: is there easy way of locking span element in contenteditable doesn't involve capturing key , preventdefault (have not tried yet , not sure if it'll work)? when clicking or moving cursor directly next span , typing text it'll part of span, there way not have part of span? padding span ...

qt - QMainWindow and ownership takeover policy -

i stumbled upon in documentation qmainwindow::setmenubar(qmenubar * menubar) : note: qmainwindow takes ownership of menubar pointer , deletes @ appropriate time. example code (in method of class deriving qmainwindow ): qmenubar * menubar = new qmenubar(this); setmenubar(menubar) // <-- transfer ownership // use menubar pointer add actions, menus, , not can still rely on local pointer qmenubar after call setmenubar ? mean, guaranteed? when delete qmainwindow derived class, qmenubar object deleted because qmainwindow set parent when constructing - policy lies in later "ownership takeover" through setmenubar other copy of reference/pointer? yes, it's safe use pointer long object took ownership alive. the fact qmainwindow "takes ownership" of menu means take care of deleting when not needed anymore. common qt, see object trees & ownership documentation. that being said, sample code rewritten this: qmenubar *menu = menub...

mysql - Group sum of a column and insert -

i have unique situation here. sorry of question naive or unclear. i have table ( called table1 ) looks this: student first name | last name | id | test name | result anthony | davis | 12353 | abc_1_1 | pass chris | tucker | 23412 | abc_1_3 | fail anthony | davis | 12355 | abc_2_4 | fail anthony | davis | 12356 | abc_2_1 | pass anthony | davis | 12635 | abc_1-5 | fail anthony | davis | 12375 | abc_2_3 | pass anthony | davis | 12935 | abc_1_8 | fail chris | tucker | 23341 | abc_1_2 | pass chris | tucker | 23541 | abc_2_3 | pass chris | tucker | 23431 | abc_1_4 | fail chris | tucker | 21341 | abc_2_1 | pass chris | tucker | 32341 | abc_1_6 | fail david | steel | 34352 | abc_2_3 | fail david ...

html - Leaving a asp.net application then hitting back isn't working -

i have asp.net application , experiencing surprising behavior. whenever leave 1 particular page in application, button starts behaving in following way: hitting (which should take me offending page) makes current screen flash - if going - reloads current page instead. it doesn't matter how leave page see effect. if click on link on offending page , hit back, same thing. if on offending page , type in new address in address bar, hit back, same thing. doesn't matter if go page in same application or external application, same thing. i tried using fiddler see going on, , see when hit back, of external links (css, jquery, etc) reloaded on current site. don't see 320 offending page @ all. note: disabling active scripts hides symptom. most external page either tampering browser history (via js) , setting same page last page in history when site being loaded, or has page set between redirects page seeing, , when click loading redirect page again. try...

java - Android DatePicker showing Full Screen on Initialization -

i have followed this tutorial integrate datepicker app, have tailored original suit needs , managed working. unfortunately author doesn't go concepts of using datepicker dialog. as result, full screen calendar shown when app launched, whereas trying pull day, month , year when button 'pick date' clicked, need remove? code here: public class mainactivity extends activity implements onclicklistener, oncheckedchangelistener { tabhost th; button changedate; textview displaydate; public static final int ddialogid = 1; // date , time private int myear; private int mmonth; private int mday; @override protected void oncreate(bundle savedinstancestate) { // set activity full screen!! requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); // todo auto-generated method stu...

uiviewcontroller - Object creation of views and share data between view in iOS -

i new ios.i stuck problem. have view , view b. view has navigation controller. view has button switch b.when clicking button every time b creates new object. how can track object share data between 2 view. thanks there several ways this. you have property of b, sets before push. (nsdictionary, array, string etc) not best way work. uiviewcontroller *viewb = [[uiviewcontroller alloc]init]; [viewb setmyproperty:@"some data!"]; [self.navigationcontroller pushviewcontroller:viewb animated:yes]; you use nsnotificationcenter pass object next view. nsdictionary *dictionary = [nsdictionary dictionarywithobject: [nsnumber numberwithint:index] forkey:@"index"]; [[nsnotificationcenter defaultcenter] postnotificationname:@"mynotification" object:self userinfo:dictionary]; the way handle setup , object holds data associated p...

Access 2007: Alternative to comma join and parameter queries -

i have queries following: select storescasesbymonth.category, storescasesbymonth.chain, sum(storescasesbymonth.casesshipped) casesshipped storescasesbymonth, querydates storescasesbymonth.month between querydates.startdate , querydates.enddate; querydates used lookup table specifies date range, , 1 row of 2 columns: startdate enddate 1/1/2013 1/12/2013 the reason use table need link of these queries excel, , excel cannot when queries use parameters, otherwise first option specifying date range. so question(s) is(/are): a) there way rewrite sql doesn't use 'comma' join, know (rightly) looks fudge, and b) there way of using kind of variable value across lots of queries doesn't involve parameters, know (rightly) looks fudge. a) no, , yes does. b) no, , yes does.

ruby - Creating sortable table in Rails application with searching/filtering functionality -

i need make ui table in rails application. contain search box , sort fields. best approach this? you can use http://tablesorter.com/docs/ sorting and http://gregweber.info/projects/uitablefilter in place searching. or you can try meta search gem background searching https://github.com/ernie/meta_search

ios - xcodebuild workspace and scheme -

i little confused happens xcodebuild command line tool when specify workspace , scheme. i understand how configured scheme works in xcode ide gui. build action lists targets build , each action (analyze, test, run, profile, archive), select 1 want build action execute for. so if have each action (analyze, test, run, profile, archive) selected in build action building, happens when execute below command. xcodebuild clean install -workspace myworkspace.xcworkspace -scheme myscheme -configuration adhoc symroot=path dstroot=path... it searches myscheme.xcscheme in main xcodeproj has configuration specified when editing scheme in xcode. what xcodebuild read in file? build configured target adhoc configuration , disregard else? you're there, syntax bit off. according man page : xcodebuild -workspace workspacename -scheme schemename [-configuration configurationname] [-sdk [sdkfullpath | sdkname]] [buildaction ...] [setting=value ...] ...

css - How to fill the gap while scale -

Image
how can fill gap @ bottom while using -webkit-transform: there gap when div becoming small. body know how fix these gap here code <div id="popup"> <div id="trans"> <h1>hover me</h1> </div> <p>mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. integer ut neque. vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. nam nibh. donec suscipit eros. nam mi. proin viverra leo ut odio. curabitur malesuada. vestibulum velit eu ante scelerisque vulputate</p> </div> css #popup{ height: auto; width:400px; background: #eee; } #trans{ width:100%; height:200px; background: yellow; -moz-transition: 0.5s; -o-transition: 0.5s; -webkit-transition: 0.5s; transition: 0.5s; -webkit-transform-origin: left top 0; -moz-transform-origin: left top 0; -o-transform-origin: left top 0; -ms-transform-origi...

angularjs - Using Angular JS ng-csp directive to build privileged Firefox OS apps -

i member of team in charge of building packaged firefox os application. due restricted csp policy firefox os privileged applications i’ve added ng-csp directive body of application: <body ng-app="the-app" ng-csp> the csp specification firefox os privileged apps is: default-src *; script-src 'self'; object-src 'none'; style-src 'self' 'unsafe-inline' according logs can firefox os device angular seems calling eval() or function() constructor , both blocked in firefox os privileged apps , app stops rendering. i know if expected behavior, known issue or applying directive incorrectly? anyone similar problem? thanks in advance. angular version: v1.0.1 error log: 05-07 19:31:10.048: error/geckoconsole(1397): [javascript error: "csp error: couldn't parse invalid source 'unsafe-inline'"] 05-07 19:31:10.048: error/geckoconsole(1397): [javascript warning: "csp warn: failed parse unrecognized source...

How to get Dart native extension demo "sample_extension" to work? -

i trying dart native extension example page work. http://www.dartlang.org/articles/native-extensions-for-standalone-dart-vm/ i on windows. downloaded , extracted dart c:\program files\dart i checked out dartssvn c:\projects\dartsvn can sample_extention project when open analyzer throws these problems: "target of uri not exist: 'dart-ext:sample_extension'" and "native functions can declared in sdk , code loaded through native extensions" and when try run "cannot find extension library 'file:///c:/projects/dart/sample_extension/bin/sample_synchronous_extension.dart': error: line 7 pos 1: library handler failed import 'dart-ext:sample_extension'; 'file:///c:/projects/dart/sample_extension/bin/test_sample_synchronous_extension.dart': error: line 7 pos 1: library handler failed import 'sample_synchronous_extension.dart';" what doing wrong? you can ignore analyzer e...

web services - java webservice url encoding -

i host 10 year old java (jar) based web service on tomcat. original source service no longer exists (actually firm created service no longer exists , there doesn't seem way find former principals). i packet captured "data" field in url , include snip of below. i'm hoping recognize encoding used on field - not appear standard rest of url encoding no problem. i'm thinking application posting data field first encodes field (which again encoded url post command. http:// ... &completedbillabletransactionflag=&data=%f0j%b2g%1f-%95%f7%e3e%c0q%a6%12%11%b2%7c%d8%c7%f6%c8%24 ... have included rest of fields value thought keep short.

ios - Why does -[UIColor setFill] work without referring to a drawing context? -

it escapes me why code, inside drawrect: , works: uibezierpath *buildingfloor = [[uibezierpath alloc] init]; // draw shape addlinetopoint [[uicolor colorwithred:1 green:0 blue:0 alpha:1.0] setfill]; // i'm sending setfill uicolor object? [buildingfloor fill]; // fills current fill color my point is, uicolor object gets message setfill , somehow stack understands uicolor fill color, isn't weird , wrong? @ least expect setting fill calling cgcontext method... instead of representing color, uicolor goes on , change context of drawing. could explain happening behind scenes, because i'm totally lost here? i did check out these references before posting: http://developer.apple.com/library/ios/#documentation/uikit/reference/uicolor_class/reference/reference.html http://developer.apple.com/library/ios/#documentation/uikit/reference/uibezierpath_class/reference/reference.html my point is, uicolor object gets message setfill , somehow stack understands...

date - Finding the second and fourth Tuesday of the month with Javascript -

my association has meetings on second , fourth tuesday of each month , i'd javascript code don't have update our site every 2 weeks , date of next meeting can calculated , displayed automatically. i'd appreciate help, have absolutely no skils in javascript, in css , html. this solution html <ul id="list"></ul> javascript function gettuesdays(month, year) { var d = new date(year, month, 1), tuesdays = []; d.setdate(d.getdate() + (9 - d.getday()) % 7) while (d.getmonth() === month) { tuesdays.push(new date(d.gettime())); d.setdate(d.getdate() + 7); } return tuesdays; } var meetingtuesdays = [], ul = document.getelementbyid("list"), temp, li, i; ( = 0; < 12; += 1) { temp = gettuesdays(i, 2013); meetingtuesdays.push(temp[1]); li = document.createelement("li"); li.textcontent = temp[1]; ul.appendchild(li); meetingtuesdays.pu...

Rails + Cucumber + Selenium: How to click on a span inside a ul and li? -

i trying write tests clicking around on mobile site. however, i'm having trouble finding documentation on how click embedded non link elements. html: form id="search-results-form" action="" method="post"> <div> <ul id="see-more-search" class="see-more" style="display: block; height: auto;"> <li> <span>color</span> </li> <li> <span>width</span> </li> </ul> </div> ... this incomplete cucumber test: when(/^touch "color"$/) within(:css, '#see-more-search') #i want able click span text 'color', #don't know how target point end end does know how target first li or 'color' span? try using javascript: page.driver.browser.execute_script %q{ $('#see-more-search ul li:first'...

python - django - how to get searched object in template thru relatedmanager -

i trying write search logic. stuck here. i have location model , rate model. each location can have multiple rates. these classes class location(models.model): name = models.textfield() price = models.charfield(max_length=10) class rate(models.model): location = models.foreignkey(location,related_name="rate") rate = models.integerfield(max_length=10) now if user search location rate 3 , in view def search(request): rate = request.get.get('get') #all rates allrates = rate.objects.filter(rate=rate) #all locations rate locations = location.objects.filter(rate__in=allrates) return render_to_response('result.html',{'locations':locations},context_instance=requestcontext(request)) and in template: {% loc in locations %} {{loc.rate.rate}} <--------- wrong! how searched rate 3 here?? {% endfor %} but since every location object can have multiple rates, {{loc.rate.rate}} doesnot work. want is, wanted rate - her...

sql - Is it possible to backup records from a particular MySQL table a few at time with mysqldump? It's a table with a lot of records -

so have table 200,000 records want clean up. want up. i've tried using phpmyadmin interface script keeps timing out given huge size of database. i've event tried backing 5000 @ time , doesn't work. i'm wondering if i'll have better time doing command line using mysqldump command. however, i'm having hard time coming command to: back particular database (say db1 ) back particular table in db1 (say table1 ) back few records @ time (say 2500) i know issue not connectivity issue because can connect it. here's have far: mysqldump --opt -h somedomain.com -u dbuser -p dbpass db1 table1 > ./my-backup-file.sql any appreciated. update : i know problem is. sign-up form left open sign , spam bot found , hammered sign-up requests thereby creating ~ 199,980 new records in database. know they're standard varchar , text data being inserted. want know easiest, pain, free way clean up. you use --where argument this: --where="1...

asp.net - Amazon S3 - Where we need to store Access and Secret Keys? -

i new amazon s3 , know need store access , secret keys. using asp.net app can store these keys in web.config or better practice store these keys. web.config common place store them, appkeys. if want protect them bit better, encrypt configuration section they're stored.

xml - Confusion regarding descendant axis and '//' -

structure of document: <program> <projectionday> <projection/> <projection/> </projectionday> <projectionday> <projection/> <projection/> </projectionday> </program> i want select first , last projection ( across whole document). this returns it: /descendant::projection[position() = 1 or position() = last()] this returns first , last within projectionday //projection[position() = 1 or position() = last()] why so? your first query using descendant fetches <projection/> elements, filters result set first , last element: /descendant::projection[position() = 1 or position() = last()] // abbreviation /descendant-or-self::*/ . second query means /descendant-or-self::*/projection[position() = 1 or position() = last()] which looks elements (here: each <projectionday/> , , returns first , last <projection/> element inside element . to return first , last eleme...

Adding logo in front of Bootstrap Navbar -

Image
i trying add logo in front of bootstrap navbar - similar yellow logo on peek.com want on right side of navigation instead. i using sample template: http://twitter.github.io/bootstrap/examples/hero.html instead of project name, want image there instead. tried adding css logo fixed spot. .logo-fixed { position: fixed; top: 0; right: 90px; } i added after body in sample template: <div class="logo-fixed"><img src="test.png"></a></div> the logo shows top part of logo displayed behind black navbar. here looks like: how display in front instead? set z-index on .logo-fixed: .logo-fixed { z-index: 2000; ... } or better, don't have overlap menu bar instead have below setting css top other zero.

c# - Regex to parse a string and match a URL or folder path -

i'm trying change regex match url http://www.google.com , , allow match folder name such j:\folder\name\here i'm parsing text of message links may present within, , creating process.start(string) call matched string. the regex have looks this: (?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'"".,<>?«»“”‘’])) i'm thought add /{1,3} part match \{1,1} , might work, doesn't seem case. i'm not sure else regex doing because did not write myself. does have working example of regex match urls file system folder paths? or there way change existing regex work purpose? have tried : [^ ]+?:(//[^ ]*|\\.+\\[^ ]*) it match : http://www.google.com and c:\windows\temp internetfiles\ in string where http://www.google.com way go if want save file c:\windows\te...

Puppet Class Default Parameter/Variables -

i using custom enc , able have classes default parameters variables higher in scope. this allows me set variable in top scope, node scope, wrapper class scope, etc , value picked default parameter class. this allows me still set parameter @ class definition. 1 downside approach class potentially pick "unsafe" default although feel unlikely scenario. has else looked @ solving problem such , overall idea or bad idea? custom_enc.yaml classes: rsyslog::client: port: 1234 parameters: server: my-rsyslog-server manifest/server.pp class rsyslog::client( $server => $server, # $server = $server || undef $port => $port ? { # $port = $port || '514' '' => '514', default => $port } ) { if !defined($server) { fail "server must defined" } notify { "the server ${server}": } notify { "the port ${port}": } }

php - pretty url with $_GET -

this question has answer here: how create friendly url in php? 8 answers im trying pretty urls don't know htaccess. trying like this: domain.com/?page=login domain.com/?page=user&uid=2 to: domain.com/login/ domain.com/user/2 do have specify this?: domain.com/page?a=arg1&b=arg2&c=arg3 domain.com/page/arg1/arg2/arg3 or can "more dynamic"? i using http://www.generateit.net/mod-rewrite/ . pretty easy figure out how it's done when used tool 2 or 3 times. you can define parameters take "spot" so your: domain.com/?page=login domain.com/?page=user&uid=2 to: domain.com/login/ domain.com/user/2 you can use: rewriteengine on rewriterule ^([^/]*)/([^/]*)$ /?page=$1&uid=$2 [l] your "page" problem looks bit more difficult. you have add rewrite rules each...

javascript - jQuery UI dialog open -

i'm trying open dialog window code. internet says use $("#dialog").dialog("open"); reason isn't working. $( "#draggable" ).draggable({ connecttosortable: "#sortable", helper: "clone", revert: "invalid", stop: function(event, ui) { alert("hello world!"); $("dialog").dialog('open'); } }); $( "ul, li" ).disableselection(); }); $(function() { $("#dialog").dialog({ autoopen: false, height: 200, width: 150 }); }); i want open when user stops moving 1 of list items. alert occurs not dialog. know why? you missed # $("#dialog").dialog('open');

Bootstrap's close button doesn't work -

i'm trying display alert message close button twitter bootstrap. doesn't work chrome. created jsfiddle : http://jsfiddle.net/6vd5j/3/ , strangely jsfiddle doesn't work. <div class='alert alert-error'> <button type='button' class='close' data-dismiss='alert'>×</button> test </div> so i'm lost, , require please. [edit] if run locally on chrome, doesn't work : <?php echo "<link href='http://twitter.github.com/bootstrap/assets/css/bootstrap.css' rel='stylesheet' media='screen'> <script src='http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js'></script> <script src='http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js'></script> <div class='alert alert-error'> <button type='button' class='close' data-dismiss='alert'>x</button> test ...

matlab - Assign a Name to each Iteration -

in matlab, i'm trying assign name each iteration in loop. let's take fundamental loop: for = 1:3 x = i^2 end and the output is: x = 1; x = 4; x = 9; what want assign x's x(1) , x(2) , , x(3) . i'm trying achieve have loop output as: x(1) = 1; x(2) = 4; x(3) = 9; in loop showed, scalar value x gets updated on every iteration. can instead store values of iteration in vector. for instance: for = 1:3 x(i) = i^2; end x vector , x(i) holds ith iteration.

C++ DirectX - texturing a 2D mesh -

Image
in directx i've been working textured quads using following struct: struct tlvertex { float x; float y; float z; d3dcolor colour; float u; float v; }; however want make more complex 2d meshes , texture those, have no idea how i'm align texture on it. in textured quad, u , v properties of struct determine texture's orientation. ideally want able either have 2d mesh texture on or new struct properties need, texture stretched/manipulated fit on mesh entirely no matter how distorted may look. another thing i'd have 2d mesh texture slapped on no stretching of texture, etc. i'd want align it, if texture didn't fit shape of mesh, bits missing etc. i've tried googling can find things relating 3d graphics. whilst realise technically working in 3d space, trying create 2d graphics. appreciate answers suggestions look/get started on achieving through complete examples if possible. you should read how texture coordinates...

javascript - Regular expression X characters long, alphanumeric but not _ and periods, but not at beginning or end -

as subject indicates, in need of javascript regular expression x characters long, accepts alphanumeric characters, not underscore character, , accepts periods, not @ beginning or end. periods cannot consecutive either. i have been able want searching , reading other people's questions , answers here on stack overflow ( such here ). however, in case, need string has x characters long (say 6), , can contain letters , numbers (case insensitive) , may include periods. said periods cannot consecutive , also, cannot start, or end string. jd.1.4 valid, jdf1.4f not (7 characters). /^(?:[a-z\d]+(?:\.(?!$))?)+$/i is have been able construct using examples others, cannot accept strings match set length. /^((?:[a-z\d]+(?:\.(?!$))?)+){6}$/i works in accepts nothing less 6 characters, happily accepts longer well... i missing something, not know is. can help? this should work: /^(?!.*?\.\.)[a-z\d][a-z\d.]{4}[a-z\d]$/i explanation: ^ // matches...

php - Optimizing setCellValueExplicit() in PHPExcel -

i dealing 700 rows of data in excel. and add on column entry: foreach($data $k => $v){ $users ->getcell('a'.$k)->setvalue($v['username']); $users->setcellvalueexplicit('b'.$k, '=index(\'feed\'!h2:h'.$lastrow.',match(a'.$k.',\'feed\'!g2:g'.$lastrow.',0))', phpexcel_cell_datatype::type_formula); } $users stands spreadsheet. i see writing 700 cells above setcellvalueexplicit() takes more 2 minutes processed. if omit line takes 4 seconds same machine process it. 2 minutes can ok, if have 2000 cells. there way can speed optimized? ps: =vlookup same slow above function. update the whole idea of script: read csv file (13 columns , @ least 100 rows), write spreadsheet, create new spreadsheet ( $users ), read 2 columns, sort them based 1 column , write $users spreadsheet. read columns: $data = array(); ($i = 1; $i <= $lastrow; $i++) { $user = $feed ->get...

wordpress - Using jQuery to modify CSS: Not Affecting CSS Consistently -

i building custom child theme built on genesis framework , enqueueing jquery script calculates image bottom margin based on height of image (only in “diary” category). calculation seems working properly, css being modified inconsistently. when navigate page works properly, other times doesn’t. if refresh page, doesn’t work. happening in safari, chrome, firefox (all on mac). this how enqueuing script in functions.php: add_action( 'wp_enqueue_scripts', 'lpt_enqueue_script' ); function lpt_enqueue_script() { wp_enqueue_script( 'variable-margins', get_stylesheet_directory_uri() . '/js/variable-margins.js', array( 'jquery' ), '', false ); } the script looks this: jquery(document).ready( function() { if (jquery('.category-diary img').length > 0){ var lineheight = 21; jquery('.category-diary img').each( function() { var remainder = jquery(this).height() % lineheight; ...

mysql - Entries a specific distance away from others -

my table has name , distance column. i'd figure out way list names within n units or less same name. i.e. given: name distance 2 4 3 7 1 b 3 b 1 b 2 b 5 (let's n = 2) like a 2 4 3 1 ... ... instead of 2 2 (because double counts) i'm trying apply method in order solve customerid claim dates (stored number) appear in clusters around each other. i'd able label customerid , claim date within 10 days of claim same customer. i.e., |a.claimdate - b.claimdate| <= 10. when use method where a.custid = b.custid , a.cldate between (b.cldate - 10 , b.cldate + 10) , a.claimid <> b.claimid i double count. claimid unique. since don't need text, , want values, can accomplish using distinct : select distinct t.name, t.distance yourtable t join yourtable t2 on t.name = t2.name , (t.distance = t2.distance+1 or t.distance = t2.distance-1) order t.name sql fiddle demo given edits, if you're looking res...

java - finding the largest digit in an integer using recursion -

i have practice who's task find largest digit in integer using recursion in java. example, number 13441 digit '4' returned. i have been trying day , nothing worked. what thought work following code, can't quite "base case" for: public static int maxdigit(int n) { int max; if (n/100==0) { if (n%10>(n/10)%10) { max=n%10; } else max=(n/10)%10; } else if (n%10>n%100) max=n%10; else max=n%100; return maxdigit(n/10); } as can see it's wrong. any great. thank you the simplest base case, if n 0, return 0. public static int maxdigit(int n){ if(n==0) // base case: if n==0, return 0 return 0; return math.max(n%10, maxdigit(n/10)); // return max of current digit , // maxdigit of rest } or, more concise; public static int maxdigit(int n){ return n==0 ? 0 ...