Posts

Showing posts from February, 2011

c++ - Signed Char ATAN2 and ATAN approximations -

c++ - Signed Char ATAN2 and ATAN approximations - basically, i've been trying create 2 approximation functions. in both cases input "x" , "y" components (to deal nasty n/0 , 0/0 conditions), , need signed char output. in atan2's case, should provide range of +/-pi, , in atan's case, range should +/- pi/2. i spent entire of yesterday trying wrap head around it. after playing around in excel find overall algorithm based on approximation: x * (pi/4 + 0.273 * (1 - |x|)) * 128/pi // scale factor @ end switch char format i came next code: signed char nabssc(signed char x) { if(x > 0) homecoming -x; homecoming x; } signed char signsc(signed char input, signed char ifzero = 0, signed char scalefactor = 1) { if(input > 0) {return scalefactor;} else if(input < 0) {return -scalefactor;} else {return ifzero;} } signed char divisionsc(signed char numerator, signed char denominator) { if(

JavaScript Same Origin Policy - How does it apply to different subdomains? -

JavaScript Same Origin Policy - How does it apply to different subdomains? - how same origin policy apply next 2 domains? http://server1.mydomain.com http://server2.mydomain.com can run js on page hosted on server1, if content retreived server2? edit according daniel's reply below, can include scripts between different subdomains using <script> tag, asynchronous requests? if download script server2 onto page hosted on server1. can utilize script communicate asynchronously service on server2? you can include scripts between different subdomains using <script> tag, exempt policy. using http://www.example.com/dir/page.html source (from wikipedia): compared url outcome reason --------------------------------------------------------------------------------------------- http://www.example.com/dir/page.html success same protocol , host http://www.example.com/dir2/other.html success same protocol , host h

c# - Identify If Access database having ReadOnly Permission -

c# - Identify If Access database having ReadOnly Permission - for acccess database open message "this database has been opended read-only". for db when connect using c#.net application oledbconnectio ..at time of updating query give error "operation must utilize updateable query." i want prompt user if db opened readonly permission in access database.. how can add together code in c#.net application identiy oledb database readonly permission. thanks you can utilize fileinfo fileinfo f = new fileinfo(@"c:\mydb.accdb"); if (f.isreadonly) { console.writeline("file read only"); } else { console.writeline("file not read only"); } c# ms-access

ios - AVCaptureSession startRunning is unmuting device -

ios - AVCaptureSession startRunning is unmuting device - my application has various sound effects buttons , other actions, if device muted/silenced don't create sounds expected. however, 1 of screens video recording, , if screen navigated enables of sound effects everywhere in app. commenting out things determined startrunning function - i'm not sure if normal behavior because starting photographic camera enables related things, audio, or if there's weird going on can change. if you're doing video recording you're using avaudiosessioncategoryplayandrecord category. category ignore mute switch on side of device, design. see here definitions of avaudiosession categories. in short, there's no way respect mute switch when using sound category. maybe when switch away screen, should set sound session category else avaudiosessioncategoryambient if not impact app. ios objective-c cocoa-touch avcapturesession

django - DeleteView with a dynamic success_url dependent on id -

django - DeleteView with a dynamic success_url dependent on id - i have app posts, url each post: url(r'^post/(?p<id>\w+)/$', 'single_post', name='single_post'), on each post, have comments. able delete each comment post page , homecoming post on. i have next url deleting comments: url(r'^comment/(?p<pk>\d+)/delete/$', commentdelete.as_view(), name='comment_delete'), and know previous research need override get_success_url, i'm not sure how reference post id on. think need utilize kwargs, not sure how. have currently, doesn't work... class commentdelete(permissionmixin, deleteview): model = comment def get_success_url(self): homecoming reverse_lazy( 'single_post', kwargs = {'post.id': self.kwargs.get('post.id', none)},) ideas appreciated! this should work: def get_success_url(self): # assuming there foreignkey comment post in model post

c# - How to get IOwinContext from SignalR hub? -

c# - How to get IOwinContext from SignalR hub? - how access iowincontext signalr hub (for instance hubcallercontext )? you can access iowincontext current connected client via hubcallercontext (context property of hub base of operations class): context.request.gethttpcontext().getowincontext() gethttpcontext extension under microsoft.aspnet.signalr , getowincontext extension under system.web, create sure you're using both of namespaces. c# .net signalr owin signalr-hub

javascript - Jasmine - Test a service that returns a localStorage item -

javascript - Jasmine - Test a service that returns a localStorage item - i have authentication service stores current user object in localstorage when user logs in successfully. service used many other services. service, abcservice calls method in authentication service token required communication. spec abcservice fails in grunt test, , says this: typeerror: 'null' not object (evaluating 'abcconfig.getuser().token') obviously token set when user logged in. how rid of this? or in other words, how test right? to solve issue can emulate logged in state false local storage entry along lines of this: describe("when user logged in", function () { beforeeach(function () { // ensure user logged in localstorage.setitem('loggedin', 'testuser'); }); it("should work", function () { // run function, should work }); }); it opens possibility test how service behaves if there no u

javascript - New feature or page introduction on website using fancy tooltip and cookies? -

javascript - New feature or page introduction on website using fancy tooltip and cookies? - excuse lack of proper knowledge or terminology on subject here goes question: websites have new feature introduction based on tooltip shown when log in first time. thereafter tooltips disappear , work normally. can please tell me how accomplished in html5, css , js and/or asp.net? see response question above... javascript html5 css3 cookies tooltip

sql - Find last match with latest inserted name in table -

sql - Find last match with latest inserted name in table - i have table personalinfo having columns such id, name, address . suppose have next data 1 john 2 mark uk 3 john uk 4 david now when insert next new record 5 john china i want update lastly record having same name new 1 illustration shown here record 3 john uk updated 3 john china . when insert 5th record table should 1 john 2 mark uk 3 john china 4 david 5 john china what sql query should use? assuming id auto-incremented, highest value name , address combination. update personalinfo set address = 'us' id = (select max(id) personalinfo name = 'john' , address = 'uk' ) sql sql-server

Neo4J - Extending Cypher -

Neo4J - Extending Cypher - i looking developing neo4j plugins/extensions; however, create functions utilize in browser (i.e. code own graph_size() , utilize in cypher return graph_size() ). familiar , how accomplished? you unmanaged extensions written in java , can exposed on rest api interface. details these here. unfortunately, there not yet back upwards user-defined functions can accessed within cypher query, though. these on roadmap have no timescale attached @ stage. neo4j cypher

c# - SqlParameter value or sqlValue? -

c# - SqlParameter value or sqlValue? - i error saying this: sqlparametercollection accepts non-null sqlparameter type objects, not string objects on code: .parameters.add(new sqlparameter("@username", sqldbtype.nvarchar,128).value = username); if alter to: .parameters.add(new sqlparameter("@username", sqldbtype.nvarchar,128).sqlvalue = username); shouldn't value work? is'nt sqlvalue database type? here dal use: public class dbaccess : idisposable { private idbcommand cmd = new sqlcommand(); private string strconnectionstring = ""; private bool handleerrors = false; private string strlasterror = ""; public dbaccess() { strconnectionstring = configurationmanager.connectionstrings["db"].connectionstring; sqlconnection cnn = new sqlconnection(); cnn.connectionstring = strconnectionstring; cmd.connection = cnn; cmd.commandtype = command

sql - Can't update table off ST_INTERSECT Query in Netezza -

sql - Can't update table off ST_INTERSECT Query in Netezza - so have 2 simple line datasets in netezza, want create table includes lines dataset 1 not intersect lines dataset 2. st_disjoint doesn't seem work, returns thousands , thousands of duplicate values, assume because netezza runs query row row , returns record everytime 2 specific lines don't intersect? so thought flag each line dataset 1 , select without flag, using update datset 1 st_intersects(dataset1,dataset2). however returns many 1 relationship error. there way can create check first intersect or somethign stop trying assign multiple values individual records? i sense there simpler solution problem (selecting lines set 1 never intersect lines set 2), help appreciated. cheers! st_disjoint homecoming boolean value of true or false when comparing columns each contain geometry. i'm not sure understand how info stored based on wording of question, if tables called dataset1 , dataset2

How to get Angularjs UI Router list of states? -

How to get Angularjs UI Router list of states? - is there way list of states configured application through angularjs ui router? i.e after configuring states (aka routes in angular), how array of these states or state objects. in other words, equivalent of angular's built in router's " $route.routes " in angular ui router? tried find in ui router's api documentation, can't find it. use $state.get() . following in controller app.controller('mainctrl', function ($state) { console.log(angular.tojson($state.get())); }); would spit out like [{ "name":"", "url":"^", "views":null, "abstract":true },{ "name":"main", "url":"/main", "controller":"mainctrl", "templateurl":"main.html" }] angularjs angular-ui-router

web services - Read data from different system in different format, like xml, csv, database, etc in IBM BPM -

web services - Read data from different system in different format, like xml, csv, database, etc in IBM BPM - i new ibm bpm. want know how can read/write info from/to different scheme ibm bpm ? different formats supported ? xml, csv, database, wsdl etc. ?? let suppose have scheme can data, may in form of xml, csv or database, etc (without wsdl contract. want create interface in ibm bpm, can used read/extract info above mentioned system. possible without wsdl contract ? when "import remote location" of next mean a user looking @ coach , uploading server computer user lookking @ coach , uploading server network location user looking @ coach , selecting location on bpm server server accessing file on file scheme server accessing file on file system if 1 of coach options, utilize file upload widget coaches , parse file uploaded file repository using 1 of open source java packages allow reading of excel spreadsheets. you can info here: https://www

Get & Set Value of my Activity from a fragment - Android -

Get & Set Value of my Activity from a fragment - Android - i know how can , set value of activity fragment?? possible? below activity , attribute 'mystation' value want , set fragment. public class myactivity extends activity implements navigationdrawerfragment.navigationdrawercallbacks { public static station mystation; in fragment can execute 'getactivity()' don't know if can that. if i'm wrong, right process?¿ thanks. if fragment used in activity, can cast activity. otherwise you'll have verify right activity perhaps using instance of. let's @ simpler case: public class myactivity extends activity { private boolean myflag; public boolean getmyflag() { homecoming myflag; } public void setmyflag(boolean myflag) { this.myflag = myflag; } and here fragment adjust flag. public class myuniquefragment extends fragment { public void updateactivityflag(boolean myflag) {

Running an external process in Rust -

Running an external process in Rust - i saw question how invoke scheme command in rust program? seems has changed. how run external process in rust now? have tried std::io::process::command ? you seek like. let process = match std::io::process::command::new("ls") .args(&["-l", "/home/hduser"]) .spawn() { ok(process) => process, err(err) => panic!("running process error: {}", err), }; allow output = match process.wait_with_output() { ok(output) => output, err(err) => panic!("retrieving output error: {}", err), }; allow stdout = match std::string::string::from_utf8(output.output) { ok(stdout) => stdout, err(err) => panic!("translating output error: {}", err), }; print!("{}", stdout); you don't have spawn process, rust great at, why not. command::new returns optio

linux - Running a ssh command inside Mathematica -

linux - Running a ssh command inside Mathematica - lately i've been trying run shell ssh command mathematica notebook. tried several suggested methods no positive outcome. search reply lead me next result: runprocess[$systemshell, all, " ssh <login>@<server> exit "] but gives next error <|"exitcode" -> 127, "standardoutput" -> "", "standarderror" -> "ssh: /usr/local/wolfram/mathematica/10.0/systemfiles/libraries/\ linux-x86-64/libcrypto.so.1.0.0: no version info available \ (required ssh) ssh: /usr/local/wolfram/mathematica/10.0/systemfiles/libraries/\ linux-x86-64/libcrypto.so.1.0.0: no version info available \ (required ssh) ssh: relocation error: ssh: symbol evp_aes_128_ctr, version \ openssl_1.0.1 not defined in file libcrypto.so.1.0.0 link time \ reference "|> do have thought how prepare it? p.s. overall goal import , export info between external server

ios - NSStreamDelegate not receiving NSStreamEvent.HasSpaceAvailable: -

ios - NSStreamDelegate not receiving NSStreamEvent.HasSpaceAvailable: - i had code working in project, in class next signature: class viewcontroller: uiviewcontroller, nsstreamdelegate, uitextfielddelegate { then moved connection it's own class, can potentially reuse in each connection: class xmppconnection: nsobject, nsstreamdelegate when did this, moved viewdidload() code init() . tried putting init code in separate function, , calling function after instantiating class. did not alter anything. i can switch between 2 projects, old , new, create sure it's not server problem, , doing confirms it's not. after each run of application, result different. either not phone call hasspaceavailable , sits there, or there (lldb) error thrown on thread 1 in class class appdelegate: uiresponder, uiapplicationdelegate, fbloginviewdelegate . error may related facebook integration though, lldb there not much at. however, each , every run, hasspaceavailable

sql - Error in query, two select statements with left join? -

sql - Error in query, two select statements with left join? - i have 2 select statements: a: select a.1,a.2,a.3 table1 b: select b.1,b.2,b.3 table1 b now bring together these 2 statements? i tried in below way , got error: select * (select a.1,a.2,a.3 table1 a) aa left bring together (select b.1,b.2,b.3 table1 b) bb aa.a.1 = bb.b.1; within left join, need include on/where clause: select * (select a.1,a.2,a.3 table1 a) aa left bring together (select b.1,b.2,b.3 table1 b) bb aa.a.1 = bb.b.1, should in format: select * (select a.1, a.2, a.3 table1 a) aa left bring together (select b.1,b.2,b.3 table2 b) bb on a.1 = b.1 ... for more clarification, please see image: as stands, it's quite hard distinguish requirements in terms of want query return, op image visually display syntax each of joins. sql left-join

java - Android Custom ListView with ArrayList How do I open a second activity -

java - Android Custom ListView with ArrayList How do I open a second activity - i have custom listview arraylist , trying open sec activity using icon used in folder drawable setonitemclicklistener(new onitemclicklistener() {} but forcefulness closes app when click on listitem cbmain.java package com.frostistudios.circuitbasicspro; import java.util.arraylist; import java.util.list; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview; import android.widget.listview; import android.widget.adapterview.onitemclicklistener; public class cbmain extends activity { string[] listitems = {"menu one","menu two","menu three"}; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_cb_main); listview lv = (lis

android - Why I have the ActionBar under my tabs? -

android - Why I have the ActionBar under my tabs? - there's i'm missing can't find out. help me please? style.xml: <style name="apptheme" parent="theme.appcompat.light"/> <style name="theme.styled" parent="@style/theme.appcompat.light"> <item name="android:windowcontentoverlay">@null</item> <item name="android:windowdisablepreview">true</item> <item name="android:actionbaritembackground">@drawable/selectable_background_example</item> <item name="android:actionbartabstyle">@style/widget.styled.actionbar.tabview</item> <item name="android:actionbarstyle">@style/widget.styled.actionbar</item> <item name="android:actionbartabtextstyle">@style/mycustomtabview</item> <item name="android:actionbardivider">@color/tab_color</item> </style&

php - Laravel routes don't seem to go to correct place -

php - Laravel routes don't seem to go to correct place - i linking localhost/offers/create doesn't seem find right template, instead sent single.blade.php when should edit.blade.php http://codepad.org/vpyj1bub link code. route::get('offers/{id}', function($id) { $offer = offer::find($id); homecoming view::make('offers.single') ->with('offer', $offer); }); the above route seems 1 getting hit. my problem revolved around missing route::pattern('id', '[0-9]+'); which kept create showing under id php laravel laravel-4 routes

html - How to align form inputs -

html - How to align form inputs - what best way align form inputs next labels without using fixed label width, looks bad if labels much shorted specified length (especially when using textarea in same form, looks very bad) without using 2 columns (as inline div or table), 1 labels , 1 inputs, break responsive layouts label , input on separate lines check fiddle..link <label class="medium-inline"> label </label> <div class="medium-inline"> <input type="text"/> </div> @media screen , (min-width: 30em) { .medium-inline{ display:inline; } } @media screen , (max-width: 30em) { .medium-inline{ display:block; } } all did alter display property inline , block respectively. html css alignment html-form html-input

extjs - Page not resizing in safari mobile when user opens a tab -

extjs - Page not resizing in safari mobile when user opens a tab - i'm not sure if relevant, app uses sencha touch 2.3.1, , base of operations element container 'vbox'. anyway, when user loads app in safari mobile while not having tabs , opening new tab, bottom of page cutting off. also, "resize" event not fired, though innerheight has been changed. does know if sencha issue? why "resize" event isn't fired/how observe change? thanks! extjs sencha-touch mobile-safari

asp.net web api2 - Exception for Request.Path when consuming Web Api 2 from Android -

asp.net web api2 - Exception for Request.Path when consuming Web Api 2 from Android - i have web api 2 application created controllers uses authentication. written in .net using c#. consuming via android application. initial request works fine validate user , homecoming true. on 2nd url request calling method via web api 2 uses authentication work bombs out request.path exception message. below android .java files in question. httphelper class: package com.example.helpers; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.util.list; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.namevaluepair; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.cookiestore; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.c

How to get the xml node value in jqgrid? -

How to get the xml node value in jqgrid? - i need xml node value of particular rowid in jqgrid,below xml construction <row id="2"> <cell>2014-10-01</cell> <cell>planning</cell> <cell>ag1454245847</cell> <cell></cell> <cell>product</cell> <group>1</group> </row> i retrieved info using rawobject parameter in cellattr method,i need retrieve grouping node value of row id 2 xml jqgrid

web applications - Different urls on same website being served by different apps? -

web applications - Different urls on same website being served by different apps? - suppose there website www.xyz.com, possible serve www.xyz.com/firstapp/* 1 application(say rails app) while serving www.xyz.com/secondapp/* application(a nodejs app)? a reverse proxy can accomplish this. e.g using nginx location /firstapp/ { proxy_pass http://rubyonrails.org/documentation/; } location /secondapp/{ proxy_pass http://nodejs.org/documentation/; } web-applications

android - how to implement a button with a tab activity -

android - how to implement a button with a tab activity - i have tab activity , in 1 of activities want place button take different activity. when code button (getting no errors) when launching app crashes error code: 11-14 12:50:43.783: e/androidruntime(10933): java.lang.runtimeexception: unable start activity componentinfo{com.dist.distguide/com.dist.distguide.mainactivity}: java.lang.nullpointerexception however when remove button coding app launches fine. here xml file: <?xml version="1.0" encoding="utf-8"?> <tabhost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/logo1"> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:p

c++ - creating template function with different parameters -

c++ - creating template function with different parameters - so illustration want create function add together 2 numbers , homecoming total. template<typename t1, typename t2> t1 add( t1 n1, t2 n2 ){ homecoming n1 + n2; } problems if t1 int , t2 float . function return int . want return float . there trick or way accomplish it? yes template<typename rt, typename t1, typename t2> rt add( t1 n1, t2 n2 ){ homecoming n1 + n2; } now phone call like:- add<float>(2,3.0); c++ templates

java - whats the purpose of having infinite for loop in following code -

java - whats the purpose of having infinite for loop in following code - can explain ....this official java atomicboolean getandset method's definition public final boolean getandset(boolean newvalue) { (;;) { boolean current = get(); if (compareandset(current, newvalue)) homecoming current; } } in java 8, sourcecode has been restructured, making easier understand: public final boolean getandset(boolean newvalue) { boolean prev; { prev = get(); } while (!compareandset(prev, newvalue)); homecoming prev; } as can see, compareandset, returns boolean, comes native function unsafe.compareandswapint, might fail. in case, operation repeated. according documentation of unsafe.compareandswapint, atomically update java variable x if holding expected. returns: true if successful the function fail if value of atomicboolean has been changed between calling get() , point

php - Display users email address on form thank-you page -

php - Display users email address on form thank-you page - i'm creating forms thank-you page, thank-you page read: <p>an activation link beingness sent email address <b>custom-email@gmail.com</b>. if not receive it, please check spam filter. </p> i want email address appear on thank-you page (where custom-email@gmail.com shows above). what code need put, show this? form coded php , can seen at: http://www.workbooks.com/sign-up/free-edition many thanks, sam there answers suggestions output straight $_post/$_get unsafe, particularly if don't know how validated user input has been point. rule 1 of dealing user input - unsafe , should never trust it. at to the lowest degree run through basic php string sanitization function filter_input. like: <p>an activation link beingness sent email address <b><?php echo filter_input(input_post,'email',filter_validate_email) ; ?></b>. if not receive it,

c - extended asm: invalid instruction suffix for 'mov' -

c - extended asm: invalid instruction suffix for 'mov' - using i686-elf-gcc , i686-elf-ld compile , link. /tmp/ccyjfcee.s:25: error: invalid instruction suffix 'mov' makefile:21: recipe target 'release/boot.o' failed when tried modify movw %0, %%dx movw $0x1, %%dx . compiled , linked successfully. wonder why there wrong line. in lite of .code16 , offset address of pstr should 16bit, fits dx register well. what's wrong it? __asm__(".code16\n"); void printstring(const char* pstr) { __asm__ __volatile__ ("movb $0x09, %%ah\n\t" "movw %0, %%dx\n\t" "int $0x21" : :"r"(pstr) :"%ah", "%dx"); } void _start() { printstring("hello, world"); } technically can utilize .code16gcc directive generate 16 bit code , %w0 substit

apache - Logstash count by unique IP -

apache - Logstash count by unique IP - i'm trying log analysis logstash. i need count unique ips apache access log, need match them count filter, determine if email sent. something this: if 10+ access unique ip in 5 minutes interval found, them need send email ip on it. what best solution this? doing surprisingly hard -- need create meter per ip address. 1 time have meter per ip address, need @ it's rate_5m , decide if it's on threashold (note rate_5m per sec rate on lastly 5 minutes). 1 time you've decided need send off alert, you'll want include ip address in (so need extract using ruby filter)... in all, not sure i'd ever utilize in production because chew memory crazy (because of meter per ip address). filter { metrics { meter => "%{ip}" add_tag => ["metric"] } ruby { code => ' ip = nil if event["tags"].include? "metric" event.to_hash.each |key,val

PHP 5.5, NGINX and Memcached - 502 Error -

PHP 5.5, NGINX and Memcached - 502 Error - i'm having problem memcached pools. seek add together context of error see if guys can help me this. context: php 5.5.17 (cgi-fcgi) (built: sep 24 2014 20:38:04) php-pecl-memcache-3.0.8-2.fc17.remi.5.5.x86_64 nginx version: nginx/1.0.15 my problem: i creating connection memcached , saving several keys, in 1 server first, this: $_memcache = new memcache; $_memcache->addserver("127.0.0.1", "11211", true, 50, 3600, 45); so, allow suppose add together several keys, in server , can without problem, can, when see site , code calling keys, it's getting it. now problem, allow keys saved , working without problem, added memcached server pool, way: $_memcache = new memcache; $_memcache->addserver("10.0.0.2", "11211", true, 50, 3600, 45); $_memcache->addserver("10.0.0.3", "11211", true, 50, 3600, 45); but before refreshed site run code , keys h

tfs2012 - TFS Macro for current Area/Team? -

tfs2012 - TFS Macro for current Area/Team? - we've moved "single team project" way of working, , our different teams split different areas (because works us). our urls http://tfsserver/projecta , http://tfsserver//projectb etc.. etc.. auto populates area, , makes sure work items go right place. however, our queries simple each team. has led have query folders duplicate many of queries, scope downwards single areas, create sure that query targets right work items. is there @currentteam macro can apply our queries prevent duplicating our queries? we can't people problem can - or we're doing wrong. no, there's no such thing right in tfs. predefined macros are: @project , @me , @today . can create own macros when using tfs object model running queries there's no way in ui. sample code: var tpc = new tfsteamprojectcollection(new uri("http://localhost:8080/tfs/defaultcollection")); var store = tpc.getservice<workitemsto

Placing Javascript ad zone in PHP function -

Placing Javascript ad zone in PHP function - i trying place javascript advertisement zone within php function. doing command advertisement zones placed on each page. in php template using: <?php if(is_page('welcome-president')) { oiopub_banner_zone(9); oiopub_banner_zone(19); } ?> i trying place javascript code within if conditional tag instead of oiopub_banner_zone(9); ads not cached , rotate. <script type="text/javascript" src="http://rutgers.myuvn.com/wp-content/plugins/oiopub-direct/js.php#type=banner&align=center&zone=9"></script> thanks in advance! rather phone call function oiopub_banner_zone(9) display banner code, can replace function phone call echo , actual script tag output on page. <?php if(is_page('welcome-president')) { echo '<script type="text/javascript" src="http://rutgers.myuvn.com/wp-c

javascript - Writing test for angular directive with dynamic template -

javascript - Writing test for angular directive with dynamic template - here directive: app.directive('templates',function() { homecoming { restrict:'e', templateurl: function(s,e) { switch (e.template) { case 'temp1': homecoming 'temp1.html'; case 'temp2': homecoming 'temp1.htm2'; default: // nothing... ; } } }; }); i can compile in test i'm not sure how test if right templates beingness called there not much test here. sense test can load template cache , test if specific element has been rendered or not sense test. example:- describe('templates', function () { beforeeach(inject(function ($rootscope, $templatecache, $compile) { // set arbitrary template test $templatecache.put('temp1.html', '<div class="test">hello&l

php - Get latitude and longitude from address using Google Geocoding API error message: “you have exceeded your daily request quota for this api..” -

php - Get latitude and longitude from address using Google Geocoding API error message: “you have exceeded your daily request quota for this api..” - here code $url = "https://maps.google.com/maps/api/geocode/json?address=$address&sensor=false"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_proxyport, 3128); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, 0); $response = curl_exec($ch); curl_close($ch); $response_a = json_decode($response); how can increment quota. have 30k+ data you have pay google maps license php json google-maps google-maps-api-3

Matlab, How to copy all the files in a zip file without unzipping? -

Matlab, How to copy all the files in a zip file without unzipping? - my manager allow me this, because zip file huge , unzipping takes long time. within zip file, have names of files still not know how re-create files folder.here codes names: zipjavafile = java.io.file('filename.zip'); zipfile = org.apache.tools.zip.zipfile('filename.zip') entries = zipfile.getentries filelist={}; while entries.hasmoreelements filelist = cat(1,filelist,char(entries.nextelement)); end thanks time , help! can me favor base of operations on codes, can tell me improve way. matlab zip

c# - Unable to create a constant value of type . Only primitive types or enumeration types are supported in this context -

c# - Unable to create a constant value of type . Only primitive types or enumeration types are supported in this context - i have next method generic check exist, public virtual bool checkexist(t entity) { var context = new etrdataentities(); iqueryable<t> dbquery = context.set<t>(); if (dbquery.any(e => e == entity)) { homecoming true; } homecoming false; } however returns exception: unable create constant value of type . primitive types or enumeration types supported in context. please advice, many thanks, try changing code taking in type t next method name, this: public virtual bool checkexist<t>(t entity) { var context = new etriksdataentities(); iqueryable<t> dbquery = context.set<t>(); if (dbquery.any(e => e == entity)) { homecoming true; } homecoming false; } you

java - Color for JFrame not working even though getcontentpane is already added -

java - Color for JFrame not working even though getcontentpane is already added - i pretty new java. class homework. finished except jframe color doesn't show. looked @ other similar questions. of them said utilize getcontentpane(). problem added not showing. below code. separated 2 parts. sec part has jframe.getcontentpane().setbackground(color.**) code. give thanks you. import java.awt.borderlayout; import java.awt.color; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jlabel; import javax.swing.jpanel; import javax.swing.jtextfield; public class numbergame extends jframe { private jpanel content; private jframe displayframe; private jtextfield input; private jlabel displaytext, message; private int guess; private jbutton button; private jbutton newgame; private int number; private int lowest = 0; private int highest = 0; public void numbergame () {

c# - ASP.NET: Remove specific item in Dropdownlist -

c# - ASP.NET: Remove specific item in Dropdownlist - i'm doing code time start , time end. did manual coding. here's illustration gui: its hh:mm value hr 00 - 23 minutes 00 - 59 scenario: my start time 8:00 [8-hour,00-minutes], have autopostback. end time of hr not display 00-07 hr display number 8 23. here's code: int _intdiff = _tmrstart - _tmrend; (int x = 0; x <= _intdiff; x++) { dropdownlist3.items.remove(dropdownlist3.items[x]); } its working displaying wrong output.. here's illustration output: as can see there, programme removes number 00,02,04,06,08. how can create staring 00 - 07 remove in dropdownlist? if iterate through forwards first element removed on first iteration 00. on sec iteration sec element removed, no 02 01 has moved first element. need iterate backwards elements removed lastly 1 first. try: for (int x = _intdiff -1; x > -1; x--) { dropdownlist3.items.remove(dropdownlist3.items[x]

node.js - Using Passport to authenticate based on dynamic route -

node.js - Using Passport to authenticate based on dynamic route - i'm building api node.js, , have endpoints want secure. for simplicity let's assume i'm using http basic authentication ( passport-http ) of endpoints. what i'd on top of that, create sure route this: api.example.com/users/:uid/ accessible user id. i can this: app.get('/users/:uid', passport.authenticate('basic', { session: false }), function (req, res, next) { if (req.params.uid !== user.id) { homecoming next(new error('unauthorized')); } homecoming next(); }, function (req, res, next) { // secret stuff } ); but wonder if there's way without adding additional middleware, using passport itself: app.get('/users/:uid', passport.authenticate( ??? ), function (req, res, next) { // secret stuff } ); is possible? if not, there improve way?

algorithm - Communication complexity -

algorithm - Communication complexity - i sending strings server , want calculate complexity. for each string s sending prefices of s . hence start sending 1 character, 2 characters, 3 ... until sending |s| characters. what communication complexity here? have said o(|s|²) not certain. also in algorithm sending each character in s fix-sized amount of data, let's 100 characters. sending |s| * 100 characters. should in o(|s|) right? 1 worse? short s first algorithm better, or off here? please, right me if wrong. sending 1 character, 2 characters, 3 ... until sending |s| characters. when send first character, remaining charcters (|s|-1) or starting 1 time again everytime |s| for first possibility: let's |s|=n 1+2+...+n=n(n-1)/2 the complexity in case is: o(|s|^2) for sec possibility: 1+2+...+a=|s| the complexity in case is: o(|s|) linear-time complexity time better, check tutorial more info complexity time algorithm co

javascript - How do I get a form to stop after a curtain amount of charackters? -

javascript - How do I get a form to stop after a curtain amount of charackters? - so got code, cant figure out how create stop after curtain amout of charackers, how can that? in advance answers!. class="snippet-code-html lang-html prettyprint-override"> <!doctype html> <html> <head> <title>hover</title> <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery- 1.8.1.min.js"> </script> </head> <body> <h1>keyup</h1> <hr> <form action="#"> <textarea rows="10" cols="20" id="message" name="message"> </textarea> <p>characters remaining: <span id="remaining">50</span></p> </form> <script type="text/javascript"> $(document).ready(function(){ var maxcharacters = 50; $("#message").on("keyup&quo

java - Data transfer in Android -

java - Data transfer in Android - i'm working on project has multiple stages set thing. in stage one, user provides title, description, , required int value. need 2 things data: take title, , set actionbar title. not hard means. i've set variable title value stored in on intent, , retrieved in new activity, , set using .settitle(); method on actionbar. here's 1 need help with... i need integer value transferred on can utilize number returned sectionspageradapter, when calls getcount(); returns value. i can value within of same class title value, cannot seem in sectionspageradapter. any help appreciated! alternately can extend sectionspageradapter , include setter value or utilize convenience constructor. something this: public class custompageradapter extends pageradapter { private int mpagecount; /** * * @param pagecount */ public custompageradapter(int pagecount) { this.mpagecount = pagecount; }

Inserting into Excel using OleDb overwriting the wrong row multiple times -

Inserting into Excel using OleDb overwriting the wrong row multiple times - i trying insert existing excel spreadsheet using oledbconnection . noticing when insert, though specify sheet offset, still writing wrong row. worse, every record getting written same row! here code: static void main(string[] args) { string destination = @"c:\publish\output.xlsx"; file.copy(@"c:\publish\template.xlsx", destination, true); string connectionstring = getconnectionstring(destination); using (oledbconnection connection = new oledbconnection(connectionstring)) { connection.open(); using (oledbcommand command = connection.createcommand()) { command.commandtext = @" insert [advertisers$a3:ac] values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"; // spit out 29 bogus values (int = 0; != 29; ++i) { addparameter(com