Posts

Showing posts from February, 2011

How to stop jQuery Mobile calling $.mobile.loading('hide') during changePage? -

i'm trying stop jquery mobile hiding loading spinner when changepage called. the program flow goes this, starting clicking link, has click event defined this: $('body').delegate('.library-link', 'click', function() { $.mobile.loading( 'show' ); $.mobile.changepage($('#page-library')); return false; }); upon clicking link, pagebeforeshow event fired, triggers function populate page local storage, or else make ajax call data. $(document).on('pagebeforeshow', '#page-library', function(event){ ui.populate_data(); }); in ui.populate_data() data local storage or make ajax call. ui.populate_data = function() { if (localdata) { // populate ui on page $.mobile.loading( 'hide' ); } else { // make ajax call } }; if data there, load data container , hide loading spinner. if not makes ajax call, on complete saves data in local storage, , calls ui.populate_data

python - How to find the two indexes from a list whos values are closest to zero -

i'm working on piece ga (fitness calculation actually) , need indexes of 2 values list whos values closest zero. have been looking hour on internet , though seems have become extremely close, , looks should work, testing print statements show code isnt working.. my process right is: find closest index , store it delete original array find new closest this code in question: closest = min(range(len(fitness_levels)), key=lambda i: abs(fitness_levels[i]-0)) fitness_levels.pop(closest) second_closest = min(range(len(fitness_levels)), key=lambda i: abs(fitness_levels[i]-0)) when fitness_levels = [-20, 23, -55, 11, 10, -18, -48, 16, -60, 20, 22, 16, 21, 66, 10, 46, -42] granted numbers generated @ random. like said, when checking print statements find method doensnt work in multiple ways, @ 1 point ended same index different values. have better workable way this? - python 2.7.x side note- come php background, still warming python, syntax wrong... while sort

c# - Transistion from Winforms to WPF MVVM -

i have program @ heart fancy keyboard hook , wedge. keyboard hook portion separate library main program. in main program gather keys want monitor config file , instantiate keyboard hook. keys monitoring have tasks can perform when key pressed and/or when released. (tasks such open program, turn on scanner..etc) since project started in winforms felt idea make folder in library called controls. made dialog form user select task wanted perform. there has been need me switch winforms wpf. nothing add winform controls class library. trial , error appears doing same thing wpf user controls different story. decided easier created new wpf usercontrol project. (if possible can please leave comment how to?) so new wpf, , decided particular library use mvvm pattern feet wet. small in have 6 subclasses of type abstracttask . part of me itching use abstract task model. i'm not sure how yet, think model. i'll have add description string field view, shouldn't problem. since atleast

mysql - Multiple Where clause with decryption -

would query decrypt usernames each condition or once , apply each condition? select * tablea ( concat_ws( ' ', aes_decrypt(tablea.firstname, "fnkey"), aes_decrypt(tablea.lastname, "lnkey") ) '%ray%' or concat_ws( ' ', aes_decrypt(tablea.lastname, "lnkey"), aes_decrypt(tablea.firstname, "fnkey") ) '%ray%' ); i cannot tell if function evaluated once each row or more. depends on query optimizer. establish benchmark. anyway, query inefficient. full table scan , calculate function each row. cannot use index here. not implement query on table more couple of rows.

css - Html file works locally on IE, but not on server. Works fine for Opera, Chrome, Safari and Firefox -

Image
basically, title states, file works locally, not when uploaded server. here's live working version: jsfiddle code extracted http://www.onextrapixel.com/2013/07/31/creating-content-tabs-with-pure-css/ *the divs displaying right below parent tab. that's ok, striped down code post question. this in 1 file, there's no reference external files, path problems should ruled out. thanks. google chrome ie local ie when uploaded webserver <!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>pure css tabs fade animation demo 1</title> <style type="text/css"> body, html { height: 100%; margin: 0; -webkit-font-smoothing: antialiased; font-weight: 100; background: #aadfeb; text-align: center; font-family: helvetica; } .tabs input[type=radio] { position: absolu

frameworks - Why "no such file or directory ... autoload.php" when accessing Laravel app? -

i newbie laravel, have been trying install laravel, wasted 3 hours unfortunately didn't work. when access through public directory, these errors: warning: require(c:\wamp\www\laravel\bootstrap/../vendor/autoload.php): failed open stream: no such file or directory in c:\wamp\www\laravel\bootstrap\autoload.php on line 17 call stack and following: fatal error: require(): failed opening required 'c:\wamp\www\laravel\bootstrap/../vendor/autoload.php' (include_path='.;c:\php\pear') in c did install laravel's dependencies? when unzip framework in work environment (i.g. htdocs) must install necesary dependencies command php composer.phar install (assuming have installed composer , git). when done, able see home page of framework.

visual studio - Post-build event command fails -

i have project creates dll intended used powershell profile; whenever finish creating new version of it, have copy/paste bin directory (which powershell profile looks these little toys of mine). one day thought myself, "self, why not use post-build event command automatically?" ...well, answer question "because doesn't damn work, that's why." among simplest commands on planet , exits code 1, whatever means. cp originpath destinationpath if run in ps, turns out fine. have quotes in paths , everything. on earth wrong? my mistake: have never used build events before , guess misunderstood supposed typing, apparently this works: powershell cp originpath destinationpath so, else might confused, that's how that. >.> guess it's not powershell command? not sure is, exactly.

html - Styling <select> menus using only CSS/CSS3 -

this question has answer here: how style <select> dropdown css without javascript? 24 answers i wish know why can't style select menu(not dropdown menu) using css alone can style buttons or checkboxes. have come across many articles have styled them used javascript manily imitate select behavior in <ul>...<li> methods. have tried style select , not option. i looking css method only. regards. i wish know why can't style select html 4.01 (or css 2.1?) let user agents style form elements way want. there has been little standardisation , when filed bug in bugzilla of webkit (mostly), answer " show me part of recommendation buggily implemented in rendering engine. none? ok wontfix kthxbye ". fair, 3 vendors have 3 os , 3 ui consider, apple had 2 , 1 , 5th had more important problems solve. here's state of a

c++ - Merge sort make wrong answer -

i trying implement merge-sort, code: #include <stdio.h> #include <stdlib.h> #include <iostream> #include <fstream> using namespace std; void merge_inplace (int *elem , int *axu, int lo, int mid, int hi) { int =lo; int j= mid +1; (int k=lo;k<hi; k++) { axu[k]=elem[k]; } for(int k=lo; k<hi;k++) { if(i> mid) elem[k]=axu[i++]; else if(j> hi) elem[k]=axu[j++]; else if (axu[i]<axu[j]) elem[k]= axu[i++]; else elem[k]= axu[j++]; } } void mergesort(int *elem ,int *axu, int lo,int hi) { if(hi<=lo) return; int mid = lo + (hi-lo)/2; mergesort(elem,axu, lo, mid); mergesort(elem,axu, mid+1,hi); merge_inplace(elem,axu,lo, mid, hi ); } int main() { ifstream in_file ; ofstream out_file; int size =0; int element; int* elem; in_file.open("in_file.txt"); if (!in_file )perror ("error openn

ffmpeg-detect audio level from live audio streaming(php) -

i have live audio stream service. need use ffmpeg check audio level of stream in real time. i have tried ffmpeg -i sample.aac -filter:a volumedetect -vn -f null /dev/null i need live audio streaming link in place of sample.aac .

jsf - POST http://localhost:8080/Languages/WEB-INF/inventory.xhtml 404 (No Encontrado) -

i using facelets in views jsf 2.0. have 2 backing beans, 2 xhtml view files , xhtml template file. when have second view in webapp directory , change language ok when put mi second view web-inf folder , change language have following error in chrome network console: post http://localhost:8080/languages/web-inf/inventory.xhtml 404 (no encontrado) these backings beans: languagebean.java: package com.testapp; import java.io.serializable; import java.util.linkedhashmap; import java.util.locale; import java.util.map; import javax.faces.bean.managedbean; import javax.faces.bean.sessionscoped; import javax.faces.context.facescontext; @managedbean(name = "language") @sessionscoped public class languagebean implements serializable { private static final long serialversionuid = 1l; private string localecode; private static final string default_local_code = "es"; private static map<string, object> countries; static { countrie

include - PHP including file only for admin -

my site consists of single page (or well, allmost), on top handling of post , stuff. now, have post -things solely admins. these located in separate file, include following: if($_session['type'] == 'admin'){ include('adminhandler.php'); } now, in adminhandler.php check in each post or function whether type of user correct, example: if(isset($_post['deleteuser']) && $_session['type'] == 'admin'){ /* stuff;*/ } now, i'm wondering if indeed necessary. there chance user can manipulate somehow include php file without having $_session['type'] of admin ? this silly question, security i'd rather take before uncertainty. as noted marc b (see comments on question), advised second check in case should forget it.

sql server 2008 - SQL Join Statement based on date range -

new sql dev here. i'm writing call log application our asterisk server. in 1 table (cdrlogs), have call logs phone system (src, dst, calldate, duration). in table have (employees) have empname, empext, extstartdate extenddate). want join 2 on src , empext based on using particular ext on date of call. 1 user per extension in given time frame. for example, have had 3 different users sitting @ x100 during month of july. in employees table, have recorded dates each of these people started , ended use of ext. how join reflect that? thanks in advance perhaps like: select a.*, b.* cdrlogs inner join employees b on a.src = b.empext , a.calldate between b.extstartdate , coalesce(b.extenddate,getdate()) please replace * relevant fields needed , there may better way join on between seems possibly cause overhead, can't think of better way presently.

Jquery Image not visibly dragging after first drop -

i'm jquery neophyte i'm trying simulate lightbox number of images may exist on page , have have "floating" dropzone user can drag , drop images drop zone added lightbox. the lightbox consists of table 2 rows , 4 cells, there divs within each cell dropzones. i going use table/cells adjust order of images (which saved (among other things) via ajax server.) i have centered image via snap need position div statically contained. perhaps there's solution in each case when omit adding position/static draggable not position within container div s or table cells: $(".dropboxes").droppable({ // recenter image once dropped drop: function (event, ui) { //need check if exists first more logic follow $(this).find("div").attr("class", "drag2").remove(); $(this).append(ui.draggable.css('position', 'static')) } }); the image dragged dropzo

javascript - IE9 not firing DOMCharacterDataModified event -

i have div element dynamically changed based on current state of jquery data table. example when filtered shows "showing 1 100 of 145 entries (filtered 1,064 total entries)". based on way 1 of tables loaded 1,064 misleading while records returned 1,064 records have been divided groups see is 266, "showing 1 100 of 145 entries (filtered 266 total entries)". the reason why 1,064 needed , not 1 group can switch between groups , filtering on group number column. because of misleading number have domcharacterdatamodified listener modifies text in div correct number. problem code used table loads same records has ability view groups through regexp filtering. now works perfect in chrome, domcharacterdatamodified not fired in ie9. the listener function function testfunct() { debugger; var pause = ""; } the div. var doc = document.getelementbyid("tmain_info"); the listener. doc.addeventlistener("domcharacterdatamodified

How to populate a sql db with t.decimal precision and scale via rails c -

t.decimal "eur", precision: 8, scale: 2 this row in database table (name wallet). how can populate data in rails console? i have tried wallet.eur=10 ok 1 easy , doesnt work. wallet.eur=bigdecimal.new('154.00') 1 throws => #<bigdecimal:56cadb8,'0.154e3',9(18)> cant save , stay @ 0.0. any idea or suggestion? use built-in rails facilities, check numberhelper documentation examples. use code add migration: add_column :items, :price, :decimal, :precision => 8, :scale => 2 and use method: number_to_currency(price, :unit => "€") if you've got nomethoderror add line: include actionview::helpers::numberhelper

bash - ImportError when calling python script via a shell script -

i've reduced problem having this. here contents of python script tmp.py : import numpy print "imported numpy!" if call python script directly @ command line $ python tmp.py it imports numpy , prints print statement. here contents of bash script test.sh : #!/bin/bash echo "pythonpath:: $pythonpath" echo "path:: $path" echo "ld_library_path:: $ld_library_path" pyver=`which python` echo "using python version $pyver" python tmp.py if call script @ command line, $ ./test.sh i following error: traceback (most recent call last): file "tmp.py", line 1, in <module> import numpy file "/home/alex/enthought/canopy_64bit/user/lib/python2.7/site-packages/numpy/__init__.py", line 148, in <module> import add_newdocs file "/home/alex/enthought/canopy_64bit/user/lib/python2.7/site-packages/numpy/add_newdocs.

jquery - flot piechart from PHP -

Image
i having strange issue creating piechart in flot data php. it seems drawing incorrectly, , can't figure out why. my php code (for testing) is: echo json_encode( '[{ label: "series1", data: 10}, { label: "series2", data: 3}, { label: "series3", data: 9}, { label: "series4", data: 7}, { label: "series5", data: 8}, { label: "series6", data: 17}]' ); my js file is: $.ajax({ type:'get', datatype:"json", url:'../phpfile.php', success: function(data) { console.log(data); $.plot($("#piechart"),data,{ series: { pie: { show: true } } }); } }); the consol log shows: [{ label: "series1", data: 10}, { label: "series2", data: 3}, { label: "series3", data: 9}, { label: "series4", data: 7}, { label: "series5", data: 8}, { label: "series6",

linux - Command to disconnect SSH connection from Script -

i have script: #!/bin/bash #!/usr/bin/expect dialog --menu "please choose server connect to:" 10 30 15 1 ras01 2>temp #ok pressed if [ "$?" = "0" ] _return=$(cat temp) # /home selected if [ "$_return" = "1" ] dialog --infobox "connecting server ..." 5 30 ; sleep 2 telnet xxx fi # cancel pressed else exit fi # remove temp file rm -f temp in part of code says: # cancel pressed want insert type of command disconnect session , close terminal automatically. ive tried different variations of exit , exit 1 , exit 5 , close , etc. none seem trick here can do: kill -9 "$(ps --pid $$ -oppid=)" but suggest not use way. better solution exit code of script , exit if needed. example yourscript : #... ... else exit 1 fi and in ssh connection do: ./myscript || exit this correct way. try use it

Ubuntu: Remote Logins (SSHD) - Kill Session & Jobs at Timeout -

server scenario: ubuntu 12.04 lts torque w/ maui scheduler hadoop i building small cluster (10 nodes). users have ability ssh child node(ldap auth) unnecessary since computation jobs want run can submitted on head node using torque, hadoop, or other resource managers tied scheduler insure priority , proper resource allocation throughout nodes. users have priority on others. problem: you can't force user use batch system torque. if want hog resources on 1 node or head node can run script / code directly terminal / ssh session. solution: my main users or "superusers" want me set remote login timeout current cluster uses eliminate problem. (i not have access cluster can not grab configuration). want setup 30 minute timeout on remote sessions inactive(keystrokes), if running processes want session killed along job processes. eliminate people not using available batch system / scheduler. question: how can implement this? help! i've seen sys a

iphone - iOS UITableView not displayed -

Image
i have inherited old ios code , have attempted integrate new ios 6 application. have implemented of code , far has worked. i'm working on last bit of old code. i'm implementing set of views show rss news section of app. i've implemented categories view, upon selecting item display individual items within category. nothing gets displayed. i've made modifications i'm aware of needed do, i'm no expert @ ios development , in need of guidance. below snapshot of simulator it's attempting display view, , below copy of .h , .m files. don't know preventing in table showing up. , preemptive help! here's snapshot of simulator here snapshot of storyboard showing linking table view here's .h file #import <uikit/uikit.h> #import "blogrssparser.h" @class blogrssparser; @class blogrssparserdelegate; @class blogrss; @class xmlcategory; @interface newsviewcontroller : uiviewcontroller <uitableviewdatasource,uitableview

c# - NameValueCollection not grabbing first value of query string -

i using simple statement namevaluecollection nvcollection = httputility.parsequerystring(querystring); i trying grab values passed in query string. simple example of passed be form_id=webform_client_form_4&referrer=http://myurl/webform/request-information?agent=agent&keyword=keyword&full_name=jon harding&company=rts financial - test&phone=913-555-5555 the issue having referrer full string after it. need other values. in case becauase parsequerystring splits string @ & character first value ignored in namevaluecollection currently when try value of agent blank value, understandably. what best method make sure grab variables? split string @ question mark , prepend ampersand string before parsequerystring . there more elegant want this? this work least effort: namevaluecollection nvcollection = httputility.parsequerystring(querystring.replace("?","&"));

javascript - KendoUI Bar chart not working in IE8 -

i have page 3 charts kendo ui, , 1 not loading in ie8, chart im having problem bar chart configuration: $(elementname).kendochart({ seriesdefaults: { type: "column", stack: stacked, opacity: 1.0 }, legend: { visible: true, position: "bottom" }, series: dataseries, categoryaxis: { categories: [carregado,tentativas,atendido,cpc,boletos enviados,boletos pagos], labels: { visible: true, font: ".85em, verdana, helvetica, sans-serif", rotation: 0 } }, valueaxis: { visible: true, max: 1, min: 0, labels: { visible: true } }, tooltip: { visible: true, template: "#= series.name #: #: (value * 100).tofixed (2) + '%' #" }, chartarea: { background: "transparent" } }); note: method configurarion came parameters

javascript - Angularjs use custom interpolation symbols for scope -

i have underscore.js template use angular , still able use underscore. wondering if it's possible change interpolation start , end symbols particular scope using directive, this: angular.directive('underscoretemplate', function ($parse, $compile, $interpolateprovider, $interpolate) { return { restrict: "e", replace: false, link: function (scope, element, attrs) { $interpolateprovider.startsymbol("<%=").endsymbol("%>"); var parsedexp = $interpolate(element.html()); // replace element contents interpolated contents } } }) but spits out error error: unknown provider: $interpolateproviderprovider <- $interpolateprovider <- underscoretemplatedirective is $interpolateprovider available module configuration? better solution using string replace change <%= {{ , %> }} ? also, noticed element.html() escapes < in <%= , &

Open spreadsheet xml, save as Excel by default -

in web application, generating spreadsheet xml using xsl template. want spreadsheet xml open in excel default. so, add below properties response: response.contenttype = "application/vnd.ms-excel"; response.addheader("content-disposition", "attachment;filename=export.xls"); response.charset = ""; this however, has 2 issues, first message below: the file trying open, 'response.xls', in different format specified file extension. verify file not corrupted , trusted source before opening file. want open file now? and 2nd, when try save it, tries save .xml file default. want save excel file default, know of way this? an excel xls file not same format open spreadsheet xml file, why excel moans @ when tries open xls , find not one. excel can, of course, open open spreadsheet xml files, why still opens in excel. xml file, , when save again, still xml file. way around issue, think, save as, , change format manually .xls. for

excel - How to subtract 08/22/2013 18:38:42 - 07/26/2013 14:56:39 with output format 2.4 days -

how subtract 08/22/2013 18:38:42 - 07/26/2013 14:56:39 in excel return in format 2.4 days? just subtract - if have start date/time in a2 , end date time in b2 can use formula in c2 =b2-a2 format c2 number - won't 2.4 example, though. looks more 27.2

entity framework migrations midway through project -

i wrote small wpf app using ef without enabling migrations while ago , deployed. have continued work on application , have realised current version going fail when redeploy because have not got upgrade scripts. does idea below sound work? create new project , use ef, enabling migrations. create new model project , dal. create model pointing existing deployed db , set initial migration. enable migrations on existing project , paste migrations folder existing project add migration. my thinking initial db matching existing deployed schema when add migration check against initial , create me up/down when next deploy. any advice appreciated. my deployment had had migrations enabled (i found out after taking backup, don't remember running must've because have _migrationhistory table!!!!), unfortunately, , amateurishly, had deleted migrations folder dev code , not checked source control prior doing so.... i: backed client database restored backup step 1 on loc

c++ - How to write from array to outputfile? -

i have vector vec (256, 0) use record type of characters , frequency input file. given 3 a's vec[65] hold value of 3. trying write output file count non-empty chars in total followed ascii character , frequency of occurrence. int count = 0; (int = 0; < 256; i++) if (vec[i] != 0) // if not 0 count count++; // print count first char in output file outfile << count; (int = 0; < 256; i++) if (vec[i] != 0) outfile << (char) << vec[i]; given input "a bb c" want is: 4a1b2c1 but is: 5 1 2a1b2c1 what can fix this? your input file looks this: "a bb c\r\n" instead of "a bb c". means have 5 character types: 1 '\n' (ascii code: 10), 1 '\r' (ascii code: 13), 2 spaces (ascii code: 32), 1 'a', 2 'b' characters, , 1 'c'. code works correctly! problem is, when print '\r', '\n' , ' ' output file, show whitespaces. if remove newline input f

How can I call a bookmarklet from Selenium webdriver? (Visual Studio, C#) -

the firefoxdriver instance opened seleniums webdriver not have bookmarks menu , not respond hotkeys assigned imacros. is there way include bookmarks in firefoxdriver instance? or way call imacros? you may need create separate firefox profile has bookmarks/hotkeys enabled (it sounds enabled on default profile) , set test use profile. check answer: https://stackoverflow.com/a/7680516/2386700

regex - What is the format of regular expressions in SonarQube? -

i'm trying set mutable exception coding rule in sonarqube, requires regular expression , standard regular expression give results in: validation failed: value 'regex' must regular expression google had no results "regular expression sonarqube" either, i'm @ loss. it's checkstyle rule. see http://checkstyle.sourceforge.net/config_design.html#mutableexception . regular java expression , there supposed validation of regular expression when click on "update".

How can I prevent my python game from reiterating and instead carry on? -

i've made simple game using pygame , livewires, sprite has avoid falling mushrooms. number of mushrooms falling @ time meant increase score increases. here mean: from livewires import games,color import random games.init(screen_width=633,screen_height=479,fps=50) class stick_man(games.sprite): def update(self): self.x=games.mouse.x if self.left<0: self.left=0 if self.right>games.screen.width: self.right=games.screen.width self.check_collision() def check_collision(self): if self.overlapping_sprites: self.over_message() def over_message(self): b=games.message(value="game over", size=100, color=color.red,x=games.screen.width/2,y=games.screen.height/2,lifetime=250,after_death=games.screen.quit) games.screen.add(b) class mushroom(games.sprite): score=0 start=200 score_required=100 level=1 total_score=0 speed=1 mushroom=games.load_image("mushroom.jpg") x_position=random.randrange(640) @staticmethod def nex

php - codeigniter access the result set -

i new codeigniter , have following code: $userauthenticated = $this->membership_model->userlogin($email, $pass); and in model, following method: function userlogin($email, $password) { $this->db->select('*'); $this->db->from('members'); $this->db->where('email', $email); $this->db->where('password', $password); $query = $this->db->get(); return $query->result(); } i facing problem accessing $userauthenticated shown above. contains details of user tried login. how can access attributes? regards, replace this return $query->result(); with this: if ( $query->num_rows() == 1 ) { return $query->row(); } else { return false; } replace this $userauthenticated = $this->membership_model->userlogin($email, $pass); with // check negative condition first if( ! $data['userauthenticated'] = $this-

svnadmin - Import an existing SVN repository to an SVN server -

i want use repository have in pc on c:\mylamerepo (which access using file:///c:/mylamerepo/lameproj/trunk/ ) remote server on plan configure using svn or http, want preserve "whole history" of projects have (logs, comments, etc.). i've read questions here and here , not helpful. you want do: svnadmin dump /path/to/local/repo | svnrdump load http://svn.example.com/svn/repo assuming you're starting fresh repo on remote server side. before can run above you'll need create repo on remote side with: svnadmin create /path/to/repo you'll need configure access there's ton of information available on how that. alternatively, if want move repo can move whole repo whatever file transfer tools prefer. if you're using bdb based repo locally (doubtful unless it's old) wouldn't recommend that.

c# - Append string in another string -

this question has answer here: append string string after specified character 4 answers i have string a="<tr>i'm working in c#<tr/> abcdefghjiklmnopqr ii oo yy uu hh gg rr" , , b="<td>finish</td></tr>" . need string a a="<tr>i'm working in c#<tr/> <td>finish</td></tr> abcdefghjiklmnopqr ii oo yy uu hh gg rr". how append string in string above? asked same question earlier wrong. here have find first ">" character , append b in a. i suppose indexof , substrings var a="<tr>i'm working in c#<tr/>abcdefghjiklmnopqr ii oo yy uu hh gg rr"; var b="<td>finish</td></tr>"; var insertpoint = a.indexof("<tr/>")+5; var c = a.substring(0,insertpoint) + b + a.substring(insertpoint);

wampserver - Famous 403 Forbidden error when trying to access phpmyadmin. Windows 8 -

i trying use wamp localhost getting famous error 403 when trying access phpmyadmin, have looked online possible solutions nothing working me :(. have attempted change phpmyadmin3.5.1 file still not working. can please kindly me issue. many thanks

java - ClientRequestFactory RestEasy Deprecated... Any other RestEasy alternative ? -

i need create rest-easy client, using de interface of restservice created others... that's work good, except 1 thing... when update rest-easy 2.3.5.final rest-easy 3.0.x, clientrequestfactory class appear @deprecated. the actual code is: clientrequestfactory crf = new clientrequestfactory(uribuilder.fromuri("http://url-of-service").build()); somerestinterface client = crf.createproxy(somerestinterface.class); client.themethod(); any one, alternative of rest-easy clientrequestfactory @ version 3.0.x? resteasy client-api has been marked deprecated jax-rs standardized client-api. can find information resteasy-integration of new client-api in documentation . your example (untested): client client = clientbuilder.newclient(); response response = client.target("http://url-of-service").request().get(); // read , close response or if want use resteasy proxy framework: client client = clientfactory.newclient(); resteasywebtarget target = (r

c# - Does ASP.Net MVC4 Cache References? -

i ran issue today making me pull hair out. i've created wcf service simple exposes 2 operations , no data contracts. wcf service sits on top of business logic layer. inside business logic layer dll exposes contracts (just plain interfaces). i've created 2 test clients service. 1 console client , other mvc4 application. both reference same endpoints , both reference, through project reference, contract dll. now, fine until change contract adding or removing method, or changing signature of existing method. @ point mvc4 app blows , throws on place. keep in mind i'm not changing wcf contract, internal contracts. the reason inside of business logic layer initializing automapper profiles via static constructor. inside static constructor assemblies of current domain , iterate through them looking objects implement iprofile. it's when start trying types out of 1 of dlls reference contracts dll fatal exception: system.typeloadexception. now, console cli

c# - nunit how to have a once off setup method (for all tests) -

this question has answer here: can have code executes before , after tests run nunit? 3 answers i need once-off setup method, called once, across test fixtures. this setup common stuff automapper, mocks used everything. how can this? (and i'm not talking testfixturesetup) you have test classes inherit base test class, , setup in constructor. public class testbase { public testbase() { // global setup } } public class mytest : testbase { // tests }

ServiceStack caching strategy -

i'm learning servicestack , have question how use [route] tag caching. here's code: [route("/applicationusers")] [route("/applicationusers/{id}")] public class applicationusers : ireturn<applicationuserresponse> { public int id { get; set; } } public object get(applicationusers request) { //var cachekey = urnid.create<applicationusers>("users"); //return requestcontext.tooptimizedresultusingcache(base.cache, cachekey, () => return new applicationuserresponse { applicationusers = (request.id == 0) ? db.select<applicationuser>() : db.select<applicationuser>("id = {0}", request.id) }; } what want "applicationusers" collection cached, , times when pass in id, use main cached collection individual object out. if uncomment code above, main collection cached under "users" key, specific query submit hits db again. thinking

php - Wordpress custom titles -

i trying add custom titles wordpress theme , having bit of trouble. i know can use aioseo adds many functions wont use, trying make on own. i have added few inputs in theme settings page (one home, 1 categories , on) , able store title structure in fields. i have managed storing part, cant make proper output. for instance, if index title store "get_bloginfo('name')", when echo it, says "get_bloginfo('name')" , not "my blog name" how can achieve that? btw, trying this if ( is_page() ) { echo $pagetitle; best regards! you can use filter wp_title , manipulate output. check whole function see how wordpress deals this. here's example: add_filter( 'wp_title', 'title_so_18414286', 10, 3 ); function title_so_18414286( $title, $sep, $seplocation ) { if ( is_category() || is_tag() ) { $title = 'title category'; } if ( is_404() ) { $title = 'page not found&#

zend studio - Undefined Variable Errors -

i receive lot of undefined variable errors in zend studio 10. i have php file : file var.php <?php $functions = $root."/requires/functions.php"; $top_utf = $root."/requires/top_utf.php" ; $database = $root."/requires/db.php" ; $footer = $root."/requires/pagefooter.php" ; ?> now if use following code in php file, zend studio shows undefined variable errors on require_once lines. (if access page browser page displayed expected , works perfectly.) <?php $root = $_server['document_root']; require_once($root."/requires/vars.php") ; require_once($functions); require_once($top_utf); require_once($database); require_once($footer); ?> doesn't zend studio recognize declared variables in included file (var.php in case)? since $functions , $top_utf variables defined in var.php, believe shouldn't receive these errors. kind of advice appreciated. if you're going use style of programming, i

javascript - datetimepicker does not appear for dynamically created field in phonegap android -

i creating input field dynamically display datetimepicker.when create field in body , give class='datetimepicker' display datepicker in app when tried create field dynamically , give class name datetimepicker doesnot display datepicker can 1 tell me whats issue. here code date time picker: var input_date=$(document.createelement('input')).attr('id','brthdate'); input_date.attr('class','datetimepicker'); input_date.attr('onclick','displaydate()'); input_date.attr('type','text'); input_date.appendto('#contentdemo'); $('#demopage').trigger('create'); function displaydate(){ $("#brthdate").datetimepicker();} here list of js files used datetimepicker: jquery.mobile-1.3.1.min.css" mobiscroll.css" jquery.js jquery-ui.js jquery.mobile-1.3.1.min.js jquery-ui-timepicker-addon.js mobiscroll.js application.js try like var input_date=$(

redactor - Image security in redactorjs editor -

there security settings perform check if picture, when user uploads picture. function is_image($image_path) { if (!$f = fopen($image_path, 'rb')) { return false; } $data = fread($f, 8); fclose($f); // signature checking $unpacked = unpack("h12", $data); if (array_pop($unpacked) == '474946383961' || array_pop($unpacked) == '474946383761') return "gif"; $unpacked = unpack("h4", $data); if (array_pop($unpacked) == 'ffd8') return "jpg"; $unpacked = unpack("h16", $data); if (array_pop($unpacked) == '89504e470d0a1a0a') return "png"; return false; } but can't understand how add code in redactorjs file check image. have added code on image-processor.php no result. i have added code: if (is_image($_files['file']['path']) == false){ die("not image @ all"); }; not sure working cause, if add movie instead of image file upload first , happens not

vb.net - How to store image in password protected folder on network -

we have customer database 100,000 records. have scan , store id cards copies in database. sake of database performance, storing images on network drive (shared folder) , path in database. shared folder not password protected , accessible whosoever navigates it. now, want password protect share folder , access through vb.net application developing. kindly advice how implement or other best solution in scenario. ps: first project.

Execute script in js file on MongoDB server and view output in shell -

i have script can run on mongo command line follows : load("test/my.js") the script executes , returns true. however, see output of script in mongo shell. possible ? thanks. for output please use printjson.

apache - Can we use RewriteRule for internal paths? -

i've seen rewriterule used public url paths, can map urls internal paths? for example, redirect links my_page.php, allowed? : rewriterule .* /home/yccaucom/public_html/my_page.php [last,noescape] you cannot redirect folder or file not within domain root. given root folder is: /home/yccaucom/public_html/ you can redirect within public_html , example public_html/css or public_html/some_folder , can make symbolic link internal folder or file , should work well. given rule, this: rewritecond %{request_uri} !^/my_page.php$ [nc] rewriterule ^ /my_page.php [l,ne] you want condition avoid falling infinite loop. or check existent files/folders instead 2 conditions: rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f basically says if file or folder not exist redirect. if try use rule is, try redirect to: /home/yccaucom/public_html/home/yccaucom/public_html/my_page.php however not fail since don't have verification stop loop g

php - Printing the content of each subarray on individual lines -

i have array code, : $responearray = array(); $_counter = 0; foreach ($xmlresp->readcalls->classify $readcalls) { $classificationclass = array(); foreach ($readcalls->classification->{'class'} $classes) { $classificationclass[] = implode(" ", array('p' => (string)$classes['p'])); } $responearray[] = $classificationclass; $_counter++; } return $responearray; that give result like array ( [0] => array ( [0] => 0.999999 [1] => 5.65423e-007 [2] => 2.3301e-008 ) [1] => array ( [0] => 0.333333 [1] => 0.333333 [2] => 0.333333 ) [2] => array ( [0] => 1.19172e-007 [1] => 0.999993 [2] => 6.75659e-006 ) ) my purpose result like 0.999999 5.65423e-007 2.3301e-008 ... 1.19172e-007 0.999993 6.75659e-006 i

android - Which one drains more battery: listen to volume change or accelerometer? -

my app need play music whenever user want in screen off mode. know 2 ways it: - use fake mediaplayer volume = 0 listening volume button. - use accelerometer dectect shake. so, 1 drains more battery? 1 should choose? there other way? ur helps the accelerometer more battery intensive. if nothing else using it, need turned on costs power. if using it, you'll receiving regular updates take more cpu power process single message when button pushed.

microsoft glee - Is there Drag and drop function in MSAGL -

i use glee in application, , want drag , drop 1 node. google it, no it. there drag , drop function or api in glee? [a link] ( http://msdn.microsoft.com/en-us/library/ms973845.aspx#dragndropops_topic2 ) go link clear doubt friend

php - File exists issues -

i'm attempting try , debug following code file_exists function. i've ran var_dump on avatar directory , returns bool(false). i'm not sure why. tested code below , gets file exists proves if statement false everytime. thoughts? have looked , image in directory correctly. $default_avatar = 'default.jpg'; $avatar_directory = base_url() . 'assets/globals/images/avatars/'; if (!is_null($user_data->avatar)) { $avatar = $avatar_directory . $user_data->avatar; if (file_exists($avatar)) { $user_data->avatar = $avatar_directory . $user_data->avatar; } else { $user_data->avatar = $avatar_directory . $default_avatar; } } else { $user_data->avatar = $default_avatar; } $default_avatar = 'default.jpg'; $avatar_directory = 'assets/globals/images/avatars/'; if (!is_null($user_data->avatar)) { $avatar = $avatar_directory . $user_data->avatar; if (file_exists(fcpath .

r - data.table way of doing this dcast -

i have data.table looks this: tbl lon lat hour ens date value 1: 254 31 12 0 1994010100 0 2: 254 31 12 0 1994010200 0 3: 254 31 12 0 1994010300 0 4: 254 31 12 0 1994010400 0 5: 254 31 12 0 1994010500 0 --- 40494956: 269 39 24 10 2007122700 200 40494957: 269 39 24 10 2007122800 130 40494958: 269 39 24 10 2007122900 240 40494959: 269 39 24 10 2007123000 230 40494960: 269 39 24 10 2007123100 150 and 1 looks like: locs lon lat 1: 260 33 2: 261 33 3: 262 33 4: 263 33 5: 260 34 6: 261 34 and doing dcast in shape need: temp <- dcast(tbl[locs], date ~ lon + lat + hour, fun.aggregate=mean, value.var="value") this want (even column names!) slow. data.table way of doing after reading few threads here, still can't quite work out. latest attempt this: temp <- tbl[locs, list(mean =

how to change eclipse html formatting -

when open html file in eclipse, after format it, looks this: <form> <fieldset> <label for="membername">login name:</label> <input type="text" name="membername" id="membername" value="" class="text ui-widget-content ui-corner-all" /> <label for="memberpass">password:</label> <input type="password" name="memberpass" id="memberpass" value="" class="text ui-widget-content ui-corner-all" /> </fieldset> </form> but want each tag of attributes on same line how make eclipse understand that? under window->preferences->web->html files->editor there options in terms of html formatting. in comparison java, there no options available,

c# - HttpClient request throws IOException -

the following code throws ioexception message: "the specified registry key not exist." httpclient client = new httpclient(); uri uri = new uri("http://www.google.com"); client.getasync(uri); this in console app in main. looks error being thrown mscorlib.dll!microsoft.win32.registrykey.win32error(int errorcode, string str). have no idea why error being thrown or how start debugging it. edit stack trace: at microsoft.win32.registrykey.win32error(int32 errorcode, string str) it's 1 line , there no inner exxception etc.. the call stack is: mscorlib.dll!microsoft.win32.registrykey.win32error(int errorcode, string str) + 0x189 bytes mscorlib.dll!microsoft.win32.registrykey.getvaluekind(string name) + 0x7f bytes system.dll!system.net.hybridwebproxyfinder.initializefallbacksettings() + 0x9e bytes [native managed transition] [managed native transition] system.dll!system.net.autowebproxyscriptengine.autowebproxyscriptengine(system.net.we