Posts

Showing posts from March, 2010

database - Questions on Private MySQL Instances and WordPress -

hopefully job asking question... my web host (webfaction) contacted me , said 1 of sites i'm hosting using many resources shared mysql pool. said should create private mysql instance on application server , run things there not impact other sites. an understandably fair , reasonable request. i've gone ahead , created private instance database have one-click installer. can tell has no phpmyadmin, , i've never worked "private instance" db before have questions... being 95% wordpress user have have private instance db every wordpress site host, or can 1 handle needs of many? if later...how ()? i absolutely refuse ssh db make changes. i've never done before, don't know syntax, , scares hell out of me truthfully. there app/tool (i'm mac user) makes interacting private instance db simple , easy? i've been looking sequel pro i'm not sure. again, hope way asked isn't confusing. yes, can handle lots of wordpress instances si

javascript - ScrollTo Effect (href to div) -

i can't seem find working simple scrollto effect. want basic, it's when click on link in nav bar, must take me selected div id scrollto effect. this code have. <nav> <ul> <li><a href="#home">home</a></li> <li><a href="#about">about</a></li> <li><a href="#contact">contact</a></li> </ul> </nav> <section id="home"> content </section> <section id="about"> content </section> <section id="contact"> content </section> js: <!----- navegación slide ---> $(document).ready(function() {   $('a[href*=#]').each(function() {     if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')     && location.hostname == this.hostname     && this.hash.replace(/#/,'') ) {       var $targetid = $(this.hash), $targetancho

c# - NuGet Restoration Never Works on Build Server -

i have pretty simple application nuget references , works fine locally. have not committed packages folder of course, config. when have teamcity build solution, got error needed enable nuget package restore did. now when build message the build restored nuget packages. build project again include these packages in build. more information, see http://go.microsoft.com/fwlink/?linkid=317568 . makes sense, error no matter how many times build it. continually fails. missing here? run nuget package restore before build solution. team city should have nuget installer step restore nuget packages. add build steps before compilation of solution. you build step runs: nuget.exe restore yoursolution.sln however team city's built in nuget build step allows configure other things, such private nuget repository urls, easier creating own build step scratch.

java - Url loading error for image in runnable jar -

so, when try following code: //main class package com.mgflow58.main; import java.awt.image.bufferedimage; import java.io.ioexception; import java.net.malformedurlexception; import java.net.url; import javax.imageio.imageio; import javax.swing.imageicon; import javax.swing.jframe; public class game { public static void main(string[] args) { bufferedimage mainicon = null; jframe window = new jframe("guppy's adventure"); window.add(new gamepanel()); window.setdefaultcloseoperation(jframe.exit_on_close); window.setresizable(false); window.pack(); window.setlocationrelativeto(null); window.setvisible(true); try { string mainurlstring = "icon.gif"; url mainurl = new url(mainurlstring); try { mainicon = imageio.read(mainurl); window.seticonimage(new imageicon(mainicon).getimage()); } catch (ioexception e

java - I keep getting this error: An internal error occurred during: "Converting 'AngularTest' to angular project..." -

i trying test out karma on eclipse project got hung error when first trying convert angularjs: an internal error occurred during: "converting 'angulartest' angular project...". loader constraint violation: when resolving method "tern.resources.ternproject.set(ljava/lang/string;lcom/eclipsesource/json/jsonvalue;)lcom/eclipsesource/json/jsonobject;" class loader (instance of org/eclipse/osgi/internal/baseadaptor/defaultclassloader) of current class, tern/eclipse/ide/internal/core/resources/ideternproject, , class loader (instance of org/eclipse/osgi/internal/baseadaptor/defaultclassloader) resolved class, tern/resources/ternproject, have different class objects type java/lang/string;lcom/eclipsesource/json/jsonvalue;)lcom/eclipsesource/json/jsonobject; used in signature any appreciated question angularjs eclipse. perhaps have several version of minimal-json plugins?

php - How can I show a list of *all* available calendars using Google Calendar API v3 / Google API Client Library? -

i have been trying access google calendar api v3 using php. initially, want list user calendars accessible call api. to so, have downloaded google api php client library , have attempted use following code (which sourced, adaptations, https://mytechscraps.wordpress.com/2014/05/15/accessing-google-calendar-using-the-php-api/ ): <?php //error_reporting(0); //@ini_set('display_errors', 0); // if you've used composer include library, remove following line // , make sure follow standard composer autoloading. // https://getcomposer.org/doc/01-basic-usage.md#autoloading require_once './google-api-php-client-master/autoload.php'; // service account info $client_id = '754612121864-pmdfssdfakqiqblg6lt9a.apps.googleusercontent.com'; $service_account_name = '754674507864-pm1dsgdsgsdfsdfsdfdflg6lt9a@developer.gserviceaccount.com'; $key_file_location = 'calendar-7dsfsdgsdfsda953d68dgdsgdsff88a.p12'; $client = new google_client(); $client-&

Excel 2013 VBA Resize not working -

i writing excel sheet buttons run vba. each button picks cell @ beginning of range use, length(number of cells used), , couple of other parameters entered user, , sends information sub, resizes range contains 1 cell number of cells entered in length when use sub getfromctlgx(rangetofill range, name, tagname, taglength) rangetofill = rangetofill.resize(1, taglength) my range, "rangetofill" not changed @ all. if use sub getfromctlgx(rangetofill range, name, tagname, taglength) rangetofill.resize(1, taglength) the code faults , doesn't compile. has else run problem? missing something? i found mistake in code, it should have been set rangetofill= rangetofill.resize(1, taglength) it's odd though.... still doesn't explain me why rangetofill.resize(1, taglength) wasn't working, that's used in majority of examples saw. i'm surprised there wasn't error not having set keyword there.

java - mockito - how to mock different behaviors for different arguments -

i want simple mock behave 1 way when called given argument, , when called else. i've tried variations on this: when(this.mockwebelement.findelement(not(eq(by.xpath("./td[1]"))))).thenreturn(this.mockwebelement); when(this.mockwebelement.gettext()).thenreturn("somestring"); when(this.mockwebelement.findelement(by.xpath("./td[1]"))).thenreturn(datemockelement); when(datemockelement.gettext()).thenreturn("8/1/2014", "7/1/2014", "6/1/2014", "5/1/2014"); the call gettext(by.xpath("./td[1]")) returns "somestring" . i've tried and(eq(any(by.class)), not(eq(by.xpath("./td[1]"))) . using code basis, following test passed me: @before public void setup() throws exception { mockitoannotations.initmocks(this); } @mock private webelement mockwebelement; @mock private webelement datemockelement; @test public void testx() throws exception {

jquery - Why is setTimeout not working with .hover()? -

jsfiddle: http://jsfiddle.net/yl1uu0hv/ i'm trying create simple hoverintent using settimeout. i'm not sure problem provided code. if comment out hovertimer = settimeout(function(){ , }, 500); addclass i'm using works. if aforementioned items active (not commented out), addclass doesn't work. i'm getting kind of error due syntax of $('ul#megamenulist li').each($(this).addclass(opts.mmactiveclass.mmclassname)); , keeps bubbling doing nothing. what's supposed happen after x milliseconds of hovering on item, class 'active' supposed added hovered 'li' tag. if not hovered on x milliseconds or longer, 'active' not added. and, if 'active' added, on mouseleave class 'active' should removed. any appreciated. jquery(document).ready(function($){ $('ul#megamenulist li').hover( function(){ console.log('over'); //hovertimer = settimeout(function

c++ - Incomplete type error header -- how to fix? -

i thought had handle on how fix circular dependencies, can't fix following, i'd grateful help! i writing chess program , have class pieces . it's in file pieces.cpp , includes pieces.h. pieces.h include rook.h. rook.h include chesspiece.h chesspiece.h include chessboard.h. now, chessboard.h include pieces.h. i have include guards everywhere, goes right; except chessboard owns pieces rather having pointers/references them: private: pieces black_pieces; pieces white_pieces; i did forward declaration of pieces , compiler complains incomplete type on line. can see why: @ point, compiler not know how space allocate class of type pieces , though knows 1 exists forward declaration. my problem want chessboard store these pieces objects, cannot have pointers them. suppose put them on heap, i've heard using heap discouraged. case maybe useful, or there solution overlooking? i hope explanation understandable without posting code -- there

jquery - Content toggling issue -

i want info hidden default , reveal when clicking on item. grabbed toggle script off net, reason it's doing opposite of want. here's script goes between head tags: <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").click(function(){ $("ul").toggle(); }); }); </script> here's code in body: <p class="toggle">+ apple ipad 2</p> <ul> <li>display screen (lcd) replacement - $99.99</li> <li>top glass (digitizer) replacement (black) – $109.99</li> <li>top glass (digitizer) replacement (white) – $109.99</li> </ul> if please explain i'm doing wrong i'd appreciate it. thanks! :) hide after loading page, toggle on click: $(document).ready(function(){ $("ul").hide(); //added line $("p").cli

xml - XSLT - Accessing outer element with inner loop of nested for-each loop -

i new xslt , have problem requires me access values elements in outer loop of nested for-each within inner loop. xml looks follows <searchresults> <journeygroup> <journeygroupnum>1</journeygroupnum> <journeydetails> <flightsegments>1</flightsegments> <journeyid>1</journeyid> <currency>usd</currency> <fare>399.00</fare> <taxes>99.00</taxes> <flights> <segmentid>1</segmentid> <legid>1</legid> <marketingcarrier>dl</marketingcarrier> <operatingcarrier>dl</operatingcarrier> <flightnum>9695</flightnum> </flights> </journeydetails> <journeydetails> <flightsegments>1</flightsegments>

spring - How to resolve java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice error? -

i trying use spring aop framework. code compiled without error. when tried run it, got above exception. using netbeans ide 8.0.1. have following libraries , jar files included. 1) spring framework 4.0.1 2) aspectjrt.jar 3) aspectjweaver.jar 4) aopalliance-alpha1.jar 5) asm-5.03.jar 6) cglib-3.1.jar here spring.xml config file <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema

asp.net mvc 4 - How to update property on KO object for when a radio button is checked/clicked? -

i have read docs on knockoutjs , understand radio button use check bindings. issue me way binding works doesn't fit scenario. in examples, radio button assigned value , when radio button selected, validates value of radio button versus value in ko.computed function determine radio button checked. however, in below example, have radio button per table row. i need property "isprimary" update true when select radio button row..the name of radio buttons being same prevents multiple selections. have been able property update ko not update property in mvc model post nor check radio button show selected. <table data-bind="foreach: details"> <tr> <td> <div> <input data-bind="value: standardaccountno, attr: {name: 'newaccountgroupdetails[' + $index() + '].standardaccountno'}" /> </div> </td&g

bash - Shell script to switch processes from one server to other server in case of failovers -

i trying develop shell scripting below results: some cron jobs/monitoring scripts scheduled 1 primary database server. say if primary server fails on standby server. i want cron jobs/monitoring automatically start running on standby server , stop on primary server in case. can me logic used here please? on secondary server: use crontab set path of command /bin/bash scriptname a bashscript can attempt heartbeat server attempt connection service status=nmap <ipaddr> -pn -p ssh | egrep 'open|closed|filtered' if [ $status = "close" ] /path/to/command fi

is SimpleDateFormat diffrent in Java & Android? -

i use below code in java , works perfect ! simpledateformat format = new simpledateformat("e, dd mmm yyyy hh:mm:ss z"); date date = format.parse("sun, 11 may 2014 23:11:51 +0430"); but in android got exception ! java.text.parseexception: unparseable date: "sun, 11 may 2014 23:11:51 +0430" (at offset 0) what's wrong ?! the problem code execute correctly if default locale english, otherwise throw exception. can solve adding correct locale. //locale locale = new locale("en-us"); locale locale = locale.us; simpledateformat format = new simpledateformat("e, dd mmm yyyy hh:mm:ss z", locale); date date = format.parse("sun, 11 may 2014 23:11:51 +0430"); probably android device has different language setting. consider using constant locale rc stated in comment, in case wouldn't need variable, use constant directly in constructor.

logstash - Is it possible to have Centralised Logging for ElasticBeanstalk Docker apps? -

we have custom docker web app running in elastic beanstalk docker container environment. have application logs available viewing outside. without downloading through instances or aws console. so far neither of solutions been acceptable. maybe achieved centralised logging elastic benastalk dockerized apps? solution 1: aws console log download not acceptable - requires download logs, extract every time. non real-time. solution 2: s3 + elasticsearch + fluentd fluentd not have plugin retrieve logs s3 there's excellent s3 plugin, it's log output s3. not input logs s3. solution 3: s3 + elasticsearch + logstash cons: can pull logs entire bucket or nothing. the problem lies elastic beanstalk s3 log storage structure. cannot specify file name pattern. it's either logs or nothing. elasticbeanstalk saves logs on s3 in path containing random instance , environment ids: s3.bucket/resources/environments/logs/publish/e-<random environment id>/i-<random ins

css3 - Change the background color of each element in the checkboxlist in struts2 when hovered -

<s:checkboxlist list="fruits" name="selectfruits" listkey="id" listvalue="description" id="fruitsid"> suppose have above checkboxlist contains multiple checkboxes. change background color grey , color of label white when mouse hovers upon respective checkbox or label. how achieve changing style in css? i tried following in css file referring checkboxlist's id not work: #fruitsid:hover { color:white; background-color:grey; } the generated html above code: <input type="checkbox" name="selectfruits" value="apple" id="selectfruits-1">apple <br/><br/></input> <input type="checkbox" name="selectfruits" value="melon" id="selectfruits-2">guava <br/><br/></input> <input type="checkbox" name="selectfruits" value="orange" id="selectfruits-3">orange

Set a variable in a quoted text in php -

i wondering if can php: <?php die(" <input name='data' type='hidden' value='". $minute=date('i')-15;echo($minute)."'/>"); ?> the question if can set variable inside "die". useful because way see easier variables , mean... possible? if not think try else. sorry english..this not original language. well, die avoid other code run on but, need. just structure before putting in, die doesn't allow kind of contacts, punctuation, etc. $minutes=$minute=date('i')-15; $var='<input name="data" type="input" value="'. $minutes .'"/>'; die($var);

Elixir: IEx.pry error: IEx shell running? -

on elixir sips 33 - pry: while i'm trying use iex.pry, have basic this: require iex defmodule iexprytest def add(a, b) c = + b iex.pry c end end i pry error: iex(1)> iexprytest.add(1, 2) cannot pry #pid<0.88.0> @ lib/iex_pry_test.ex:24. iex shell running? i think iex running, since thats i'm running from. i'm on windows 8.1 if makes difference. any suggestions pry running? thanks. i tried on windows 7 vm standard command prompt, , seems bug. perhaps open issue on elixir-lang github? however, when starting gui shell iex --werl , pry worked. can try one?

multithreading - Python Game Timer (Threads?) -

i designing game in python , know how make efficient timer can run along side game. note: using pygame. i have timer so: import time seconds = 60 def start_timer(): global seconds while seconds > 0: print seconds seconds -= 1 time.sleep(1) however, when run in main game function game hangs because of timer.sleep . def main(self): timer.start_timer() i'm pretty sure issue has not using threading, although i'm not 100% sure. can explain me proper solution is? if you're using pygame, has own time functionality should using. if you're using event-loop or hybrid design, loop on pygame.event.get() or similar , call "event handlers" different events mouse-click or key-down, can use set_timer create event fires every second. example: timer1_event = pygame.userevent + 1 def start_timer1(): global seconds seconds = 60 pygame.time.set_timer(timer1_event, 1000) def on_timer1(): glob

multithreading - Efficient multithreaded shared access to memory buffer -

this question might pretty simple still can't figure out efficient way this. have following setup: 1) thread downloads data internet memory buffer. 2) @ same time, thread b wants read data has been downloaded buffer. the buffer not circular or anything. there write cursor , read cursor. once thread has written buffer, updates write cursor tell thread b how data available reading. the problem thread b reads thousands of bytes in steps of single byte @ time. need efficient way of synchronizing 2 threads. i've tried setevent() , waitforsingleobject() seems quite slow (or did wrong) because thread b reading in packets of 1 byte buffer thread b has call waitforsingleobject() every byte needs read. sounds lot of overhead. shouldn't possible without mutex (critical section) protection? i.e. thread b poll write cursor until enough data available , copy it. question of synchronization comes up, i.e. when thread updates write cursor, change reflected in thread b? don

c++ - Cannot convert from utf16 little endian to utf8 -

Image
desperately need help. "c:\temp\1 (2).txt" testing file in little endian utf16: 3c 00 64 00 69 00 76 00 3e 00 <div> trying utf8 file following code: #include <vector> #include <string> #include <locale> #include <codecvt> #include <vector> using std::string; using std::wstring; using std::vector; std::ifstream logfile("c:\\temp\\1 (2).txt", std::ios::binary); vector<char> paste_code_buf((std::istreambuf_iterator<char>(logfile)), (std::istreambuf_iterator<char>())); wstring paste_code; paste_code.assign(paste_code_buf.begin(), paste_code_buf.end()); std::wstring_convert < std::codecvt_utf8_utf16 < wchar_t, 0x10fffful, std::little_endian>> cv; string mbs = cv.to_bytes(paste_code); looking @ mbs @ debugger ( visual studio 2013) shows no conversion has happened. what's wrong?

java - Converting LinkedList to Arrary -

this question has answer here: convert list array in java 11 answers i have created linkedlist employee object stored in it. need write method converttoarray make array of employee s taking linkedlist . any ideas? the easiest way utilize linkedlist.toarray method // create array , copy list employee[] array = list.toarray(new employee[list.size()]); however, if learning , iteratively. think how declare , of items array. first, need do? 1) declare array of employee's in order that, know how big make array since size of array cannot changed after declaration. there method inherited list called .size() employee[] array = new employee[list.size()] 2) each slot in array, copy corresponding element in list to this, need utilize loop for(int = 0; < array.length; i++) { //access element list, assign array[i] }

csv - Python Pandas read_csv skip rows but keep header -

i'm having trouble figuring out how skip n rows in csv file keep header 1 row. what want iterate keep header first row. skiprows makes header first row after skipped rows. best way of doing this? data = pd.read_csv('test.csv', sep='|', header=0, skiprows=10, nrows=10) you can pass list of row numbers skiprows instead of integer. reader ignore rows in list. by giving function integer 10, you're skipping first 10 lines. to keep first row 0 (as header) , skip row 10, write: pd.read_csv('test.csv', sep='|', skiprows=range(1, 10))

java - Trouble creating a method to reverse an arraylist -

i'm having problem trying reverse arraylist using loop. did, doesn't reverse array: import java.util.*; class test { public static void main(string[] args) { arraylist<integer> list = new arraylist<integer>(); list.add(3); list.add(4); list.add(5); reverse(list); } public static void reverse(arraylist<integer> list){ integer [] reverse = new integer[list.size()]; (int i=0; i<li

ruby - Jekyll: check if post content empty -

i have series of posts in jekyll project of have title , have title , content. want different things post in each case. example: {% post in site.categories.publications %} {{ post.title }} {% if post.content == "" or post.content == nil or post.content == blank %} <p>nothing here.</p> {% else %} {{ post.content }} {% endif %} {% endfor %} but if statement doesn't catch empty posts. based conditions on this page , none of 3 possibilities catch empty posts. ideas on how handle these posts? make sure have nothing after front matter --- --- no new line here !! no space, no new line sometimes text editor add newline @ end of file. can rid of : {% assign content = post.content | strip_newlines %} and test : {% if content == "" %}

sockets - Is it possible for multiple unrelated processes to use the same UDP port? (Linux) -

i have linux program sends & receives udp packets (it interacting various remote machines according protocol). "inject" additional udp packets second program return address ip/port used main program. for example, imagine main program sending "ping" style udp packets various remote hosts, , send "pong" packets. injector program send ping somewhere, , have main program receive pong. (the main program wouldn't expecting pong, because didn't send out ping, that's ok.) a complex way have main program accept injected packets local pipe or , send them out. easier if injector set "from" address on sendto() packet. (i don't want injector steal packets meant main program. injector short-lived, if bound main program's port, theoretically system deliver pongs instead of main program?)

c++ - Understanding BufferStruct + WriteMemoryCallback -

struct bufferstruct { char * buffer; size_t size; }; // function pass lc, writes output bufferstruct static size_t writememorycallback (void *ptr, size_t size, size_t nmemb, void *data) { size_t realsize = size * nmemb; struct bufferstruct * mem = (struct bufferstruct *) data; mem->buffer = realloc(mem->buffer, mem->size + realsize + 1); if ( mem->buffer ) { memcpy( &( mem->buffer[ mem->size ] ), ptr, realsize ); mem->size += realsize; mem->buffer[ mem->size ] = 0; } return realsize; } i found here what trying here? espacially multiplying size_t's? trying show how export html code file. why necesarry write complex (for me) function that? if can explain or post source can me understand :) this code below "c" way of doing it.. libcurl c library (there c++ wrappers well): struct bufferstruct { char* buffer; size_t size; }; static size_t writememorycallback(void *ptr, size_t size, size_t nmemb, void *data) { s

How to do set sessionflash if SQLSTATE[23000] foreign key cakephp -

Image
i have 2 tables: when try delete product_categories shows following error: sqlstate[23000] integrity constraint violation: 1451 cannot delete or update parent row: foreign key constraint fails i want set session flash if error? its hard answer without actual code have written here generic answer based on little have shared. more detail found @ cake website @ this link assuming calling controller if ($this->productcategory->deleteall(array('conditions' => array('id' => $someid)) { // else - set success flash message $this->session->setflash('something good.', 'default', array(), 'good'); } else { // error occurred $this->session->setflash('something bad.', 'default', array(), 'bad'); } you can cascade deletes child tables setting additional parameter in delete statement above - found @ same link. if cascade deletes statement below - notice true second para

android - How can I add checkbox ListView like in Google Keep? -

Image
i'm looking listview checkboxes , arrangeable drag & drop. in google keep's listview: i'm new part of building applications, if requires adding eclipse, i'd love attached guide :) you can try having textview user make entry. below textview, can create listview each element in listview have checkbox. once user enters in textview , presses submit, can add entry arraylist adapter listview. refresh listview , new entry appear @ bottom.

jquery - rails ajax detect form parameters -

i using ajax submit form 2 buttons. detect button pressed using params[:commit] in controller. using jquery's ajaxcomplete function manipulation on front end. question how access value of commit button within jquery's ajax complete function can tell button pressed without going through controller? for example, i'm kind of doing similar check url see ajax request sent , doing action, i'd drill down deeper , see parameters being sent ajax request (code coffeescript) $(document).ajaxcomplete (event, xhr, settings) -> if settings.url.indexof('mode=2') > 0 $('#nav_tabs').show(); take @ documentation settings argument passed ajaxcomplete handler. depending on version of jquery, may able directly access settings.data pojo. if can't, can pretty want playing around settings.url . for example, let's performing http://www.google.com data object { herp: "derp", karp: "larp"} . data appended url que

ruby - Convert floating-point number to words -

how word-equivalent of floating-point number? e.g. 10.24 → ten point twenty-four 5.113 → 5 point hundred , thirteen there's gem called numbers_and_words that! i've used in several projects without problems far.

c# - Using an array in a MongoDB aggregation query with $or -

i'm trying use array in mongodb c# aggregation query $or statement. code follows: var groupsarray = new bsonarray {new bsondocument { { "role", 1 } }, new bsondocument { { "role", 2 } }, new bsondocument { { "role", 3 } } }; var bsonor = new bsondocument { { "$or", groupsarray } }; var match = new bsondocument { { "$match", new bsondocument { { "$or", bsonor } } } }; however, i'm getting following exception: mongodb.driver.mongocommandexception: command 'aggregate' failed: exception: bad query: badvalue $or needs array (response: { "errmsg" : "exception: bad query: badvalue $or need

java - DataBufferInt cannot be resolved to a type -

i'm using eclipse java , i'm newbie programmer, lately i've been using different online resources try make own simple game. have run issue databufferint cannot resolved type . public main() { screen = new screen(width, height); img = new bufferedimage(width, height, bufferedimage.type_int_rgb); pixels = ((databufferint) img.getraster().getdatabuffer()).getdata(); } ((databufferint) img.getraster().getdatabuffer()) error happening. i have tried restarting, , deleting , re-adding jre library. are importing java.awt.image.databufferint ? check whether have import java.awt.image.databufferint; or import java.awt.image.*; at top of main.java file (above public main() { )

navigationbar - Hiding navigation bar without rooting on android -

i want make fullscreen application android tablets , try hide navigation bar , 4.0+. read similar questions , answers found dont work me. if not possible hide navigation bar forever, how can hide , after make visible slide bottom? saw in games , think possible. far tried , @ first hides navigation bar when touched screen navigation bar become visible again , dont want it. decorview = getwindow().getdecorview(); int uioptions = view.system_ui_flag_hide_navigation | view.system_ui_flag_fullscreen; decorview.setsystemuivisibility(uioptions); and tried again doest work me decorview.setonsystemuivisibilitychangelistener (new view.onsystemuivisibilitychangelistener() { @override public void onsystemuivisibilitychange(int visibility) { // note system bars "visible" if none of // low_profile, hide_navigation, or fullscreen flags set. if ((visibility & view.system_ui_flag_fullscreen) == 0) {

matlab - Implementing Euler's method for solving differential equations -

Image
this code find euler's method on matlab function [x,y]=euler_forward(f,xinit,yinit,xfinal,n) h=(xfinal-xinit)/n; % initialization of x , y column vectors x=[xinit zeros(1,n)]; y=[yinit zeros(1,n)]; % calculation of x , y i=1:n x(i+1)=x(i)+h; y(i+1)=y(i)+h*f(x(i),y(i)); end end` 'f=@(x,y) (1+2*x)*sqrt(y); % calculate exact solution g=@(x,y) (1+2*x)*sqrt(y); xe=[0:0.01:1]; ye=g(xe); [x1,y1]=euler_forward(f,0,1,1,4); % plot plot(xe,ye,'k-',x1,y1,'k-.') xlabel('x') ylabel('y') legend('analytical','forward') % estimate errors error1=['forward error: ' num2str(-100*(ye(end)-y1(end))/ye(end)) '%']; error={error1} so have far problem , gives error saying y not defined. do? the problem here: % calculate exact solution g=@(x,y) (1+2*x)*sqrt(y); exact solution function of 1 variable, x. presumably, supposed find paper , pencil (or wolfram alpha, etc): g=@(x) .25*(x.^2+x+2).^2 then code works expe

javascript - document.registerElement extending HTMLInputElement prototype while using custom tag name to avoid implicit browser style -

my goal two-fold: display html element keeps track of 'checked' state , triggers 'change' events without having manually implement code myself. not fight browser's implicit styling of element -webkit-appearance: none , more fussing. i need support current, stable channel of google chrome. such, not have concern compatibility non-modern browsers. i've approached problem using document.registerelement . method, register new tag, custom-checkbox , , inform browser tag inherit input. from there, need setup fact input's type checkbox. so, set type in createdcallback method ran when html element created. this code has issues: it works when not use custom tag , instead leverage is property inform browser input 'is' custom-checkbox . however, using <input> tag causes browser take on styling element. not wish have happen. when using custom tag, createdcallback method not ran. such, element not setup fact checkbox , not fire &#

javascript - ng-class not responding to change in model in Angular? -

having searched extensively, got a ternary in templates , getting partially functional results, i'm 99% sure i'm doing 99% right, but...obviously not completely, i'm here. the basic html structure: <ul> <li class="week-row" ng-repeat="week in weeks" id="{{$index}}"> <ul class="tiles" ng-class="{ 'expanded': week.isopen, 'hidden': !week.isopen }"> <li class="day-tile" ng-class="{'active': (activeday == $parent.$index + '-' + $index) }" id="{{$parent.$index + '-' + $index}}" ng-repeat="day in week.days" ng-click="fn2({ week: $parent.$index, day: $index })"> <!-- moved ng-class here, , works? --> <div>some stuff in here</div> </li> </ul>

java - How can I fix my program so that it can work with any number of rows and column user asks? -

import java.util.scanner; public class hi { public static void main(string[] args) { // test //int[][] testarray = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; int[][] testarray = { { randomnumber(), randomnumber(), randomnumber() }, { randomnumber(), randomnumber(), randomnumber() }, { randomnumber(), randomnumber(), randomnumber() } }; // // display array printarray(testarray); } // end main // display tables private static void printarray(int[][] array) { scanner sc = new scanner(system.in); //ask user system.out.println("how many rows: "); int rows= sc.nextint(); system.out.println("how many columns: "); int columns= sc.nextint(); (int row = 0; row < array.length; rows++) { (int col = 0; col < array[rows].length; col++) { system.out.print(array[rows][columns] + " ")

rally - How do I query for tag names with :find in SnapshotStore store config -

i trying setup filter similar defect view within trend chart. filter in defect view is: (state < closed) , (severity <= major) , (tags !contains not stop ship) i cannot seem tags find work correctly. suggestions? this.mytrendchart = ext.create('rally.ui.chart.chart', { storetype: 'rally.data.lookback.snapshotstore', storeconfig: { find: { _typehierarchy: "defect", state: { $lt: "closed" }, severity: { $lte: "major" }, tags: { $ne: "not stop ship" }, _projecthierarchy: projectoid }, hydrate: ["priority"], fetch: ["_validfrom", "_validto", "objectid", "priority"] }, calculatortype: 'my.trendcalc', calculatorconfig: {}, chartconfig: { chart: { zoomtype: 'x', type: 'line' },

dictionary - Python ValueError: chr() arg not in range(256) -

so learning python , redoing old projects. project involves taking in dictionary , message translated command line, , translating message. (for example: "btw, hello how r u" translated "by way, hello how you". we using scanner supplied professor read in tokens , strings. if necessary can post here too. heres error: nathans-air-4:py1 nathan$ python translate.py test.xlt test.msg traceback (most recent call last): file "translate.py", line 26, in <module> main() file "translate.py", line 13, in main dictionary,count = makedictionary(commanddict) file "/users/nathan/cs150/extra/py1/support.py", line 12, in makedictionary string = s.readstring() file "/users/nathan/cs150/extra/py1/scanner.py", line 105, in readstring return self._getstring() file "/users/nathan/cs150/extra/py1/scanner.py", line 251, in _getstring if (delimiter == chr(0x2018)): valueerror: chr() arg not in range

how to add add extra action in yii2 rest api? -

i have problem yii2 rest. follow http://budiirawan.com/setup-restful-api-yii2/ begin. now, want add new action countrycontroller return "hello world". have add extrapatterns api config according 2 links ; http://stackoverflow.com/questions/25701247/yii2-restful-api-example-to-add-a-new-action , http://stackoverflow.com/questions/25522462/yii2-rest-query i can't comment there ask problem. when want test helloworld action, there problem "404 : object not found". likes explain me how should config new action?

css - Keep an image centered regardless of screen size? -

here's fiddle created. want decorative ornament stay in middle of screen. can't figure out how it. tried wrapping in div didn't work either. html <span class="border-top"></span> css .border-top { background: url("http://i.imgur.com/txoi4sd.png") no-repeat; clear: both; display: block; height: 47px; margin-bottom: 50px; width: 100%; } .border-top { background: url("http://i.imgur.com/txoi4sd.png") center center no-repeat; clear: both; display: block; height: 47px; margin-bottom: 50px; width: 100%; } <span class="border-top"></span> this trick. reference: http://www.w3.org/tr/css3-background/#the-background

I want to update my C code with eliminating Ctype.h library -

i have written c code using ctype.h library . must update code same output , can't use ctype.h , string.h libraries . think should use new functions in , math not , don't know how can . searched couldn't find useful results . can me update code ? code works in way : when give reverse sentence , converts sentence usual. example input: od uoy tnaw ot eunitnoc? output: want continue? here code : #include <stdio.h> #include <ctype.h> int main() { char sentence[100]; int ch, i, j, k; (i=0; i<sizeof(sentence)-1; i++) if ((sentence[i] = getchar()) == '\n') break; sentence[i] = '\0'; (j = 0; j <=i; j++) { if(sentence[j]==' ' || sentence[j]=='\0') { for( k=j-1;sentence[k]!=' ' && k>=0;k--) { ch=sentence[k]; putchar(ch); } printf(" "); } } return

java - convert pdf to html pagewise using pdfbox -

i converting pdf html overriding processtextposition method in pdftextstripper know getting entire text in single .html want every pdfpage .html there way through processtextposition method code is: here "f" path processtextposition called sub class pdftext2html protected void processtextposition( textposition text ) { boolean showcharacter = true; positionwrapper p =new positionwrapper(text); textposition t=p.gettextposition(); try { f.createnewfile(); bw= new bufferedwriter(new filewriter(f, true) ); float a; = t.gettextpos().getyposition(); b=compare(a,b,t); system.out.println(b); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } { try { bw.flush(); bw.close(); } catch (ioexception e) { // todo auto-generated catch block e.printstack

range - Prolog: Get values from 0 to K - 1 -

i'm attempting create program given n, need q = 0...n. so if given n = 1: q = 0. if given n = 5: q = 0, q = 1,...,q = 4 my attempt far: values(n,q) :- values_helper(0,n,q). values_helper(n, n, q). values_helper(x,n,q) :- x0 x + 1, x0 < n, values_helper(x0,n,x0). my logic behind increment x until reaches value of n, @ point program stops. however, i'm not getting bindings q, empty set. know i'm neglecting stop @ n - 1. edit: fixed ambiguities description. both of values_helper clauses don't expect. first 1 succeeds if first 2 arguments same, , doesn't impose constraints on q. want q set equal first argument, long it's smaller second argument: values_helper(q, n, q) :- q < n. in second clause, again don't use q anywhere. recursive call should values_helper(x0, n, q) , giving: values_helper(x, n, q) :- x0 x + 1, x0 < n, values_helper(x0, n, q). these clauses give expected output: ?- values(5,q).

javascript - regex pattern for max length 12 -

i need regex pattern max length 12 , should not accept 0 if entered user. my current pattern not working. here is: [0-9]{0,12} any suggestions welcome , explanation of pattern. ^[1-9]{0,12}$ means 12 digits (excluding 0), left emtpy allowed. if field required, change minimun 1, ^[1-9]{1,12}$ and way, ^ , $ means start , end of input string. if regexp [1-9]{1,12} , without ^ , $ , "abc123def" allowed because center part 123 matched.

java - Breadth First Search Not Working -

i'm building game build hashtable of words (a dictionary) , take 2 strings , int user. try permute first string second string. done permuted 1 letter @ time , putting new word tree structure child node holding original word. done until original word permuted second word or until number permutations exceeds int given user. in basic test case giving program cat , cot , 3 hops. doesn't work. i've tried several things @ point can't figure out more , can't more specific. here code public static void permute(hashtable dict, queue<tnode> nodes, arraylist<string> oldwords, string destination, int hops, int hopcounter) { char[] alphabet = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', //array every letter in alphabet used permutations 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't&