Posts

Showing posts from February, 2012

r - Use axis() to draw axis without ticks -

Image
given plot without axes, use axis add horizontal axis. on left hand side see given "baseline" plot, on right hand side desired result: the baseline plot generated using plot(1, axes = false, main = "baseline") question : how generated desired output? (condition: using axis after plot has been generated.) i expected want when specifying tick = false, labels = false , doesn't work. below tests, self-explanatory: par(mfrow = c(2,2)) plot(1, axes = false, main = "full axis") axis(1) # axis, ticks , labels plot(1, axes = false, main = "no labels") axis(1, labels = false) # axis, ticks plot(1, axes = false, main = "no ticks (and no axis)") axis(1, tick = false) # no axis (unexpected), labels plot(1, axes = false, main = "nothing (instead of axis)") axis(1, tick = false, labels = false) # nothing - expected: axis without ticks, without labels i expected last plot deliver desired output, axis not drawn @ al

java - Generate new byte[] from existing byte[] -

i generate "new" byte array existing one, without having allocate heap. in other words, "new" byte array should share same underlying data existing one. catch new byte array have different length. byte[] buffer = { 0x01, 0x02, 0x04, 0x08, 0x10 }; byte[] shared = slice(buffer, 1, 3); /* shared should { 0x02, 0x04, 0x08 } , have length of 3 */ i'm doing because have byte array need extract packet, pass packet single-parameter method takes byte[] . want avoid making copy of data contained in packet. purposes, can assumed contents of buffer not change within scope of shared . is possible? seems common thing 1 want when working buffers. in advance, no, not possible in java have different byte[] (partly) share same memory. instead of using byte[] , use java.nio.bytebuffer allow slice buffer in way want to. bytebuffer buffer = bytebuffer.wrap(new byte[]{ 0x01, 0x02, 0x04, 0x08, 0x10 }); buffer.position(1); buffer.limit(4); bytebuffer s

java - Expandable List View items without Group -

i'm trying implement expandable list view navigation drawer menu. wondering if there way make 1 of items in menu expand? example, opening navigation drawer menu yield a b c ->c1 ->c2 ->c3 d so, c group while a, b, , d singular items don't have children. have insight this? you can that. map child "c" c1, c2, etc. , replace @override public int getchildrencount(int groupposition) { return this._listdatachild.get(this._listdataheader.get(groupposition)) .size(); } this in expandablelistadapter with @override public int getchildrencount(int groupposition) { try { return this._listdatachild.get(this._listdataheader.get(groupposition)) .size(); } catch (nullpointerexception e) { e.printstacktrace(); return 0; } } this return 0 child count a, b, d etc.

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

oauth 2.0 - org.springframework.web.client.RestTemplate - POST request for resulted in 400 (Bad Request); invoking error handler -

i'm looking developed spring oauth2resttemplate code , taken reference access tokens using 2 legged oauth 2.0 , apache oauthclient . there 2 suggestions been given, first suggestion using apache oltu worked absolutely fine me. now, looking developed second option using spring oauth2 resttemplate. the error getting:- warn : org.springframework.web.client.resttemplate - post request "https://graph.facebook.com/oauth/access_token" resulted in 400 (bad request); invoking error handler exception in thread "main" error="access_denied", error_description="error requesting access token." @ org.springframework.security.oauth2.client.token.oauth2accesstokensupport.retrievetoken(oauth2accesstokensupport.java:145) @ org.springframework.security.oauth2.client.token.grant.client.clientcredentialsaccesstokenprovider.obtainaccesstoken(clientcredentialsaccesstokenprovider.java:44) @ org.springframework.security.oauth2.client.token.access

php - how to display image on success notification message in opencart? -

how display image of product in success message of opencart when user click on add cart button? changed in catalog/controller/checkout/cart.php code: $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart')); to $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['image'], $this->url->link('checkout/cart')); but result this: you added data/demo/hp_1.jpg cart. just post answer here, had commented. in reply, put image url <img> tag. that's there it.

vhdl - How to solve a 'protected_enter(2)' error in GHDL -

Image
i'm trying implement vhdl-08 version of our poc.simulation helper package. the original package uses shared variables track simulation status: pass : asserts passed stop : stop processes there several functions , procedures using internal state. example tbgenerateclock() procedure used create clock signal. in vhdl-08 version, i'm using protected types shared variable. implemented several 'methods' (what correct terminus that?), using or modifying internal state variable. ghdl compiles sources , throws error @ runtime: c:\tools\ghdl\0.33dev\bin\ghdl.exe:internal error: protected_enter(2) c:\tools\ghdl\0.33dev\bin\ghdl.exe:error: simulation failed is ghdl internal error or using protected types in wrong way? i created (hopefully) minimal example ( download gist ) has 2 procedures: generateclock , stopsimulation . there tb* wrapper procedures ensure compatible interface vhdl-93 implementation. library ieee; use ieee.std_logic_1164.all; pac

graph - Runtime error in java code -

i'm creating program assignment takes input system.in in following format: inky pinky blinky clyde luigi mario bowser 0 2 1 2 5 6 3 5 2 4 4 5 2 3 1 4 closefriends 1 2 4 where first line persons, numbers friendships. the program checks whether or not people listed in last line in "close friendship", they're friends. i represent network incident matrix, , passes every test on test site use, except one, fails "runtime error". know it's not exception, because catching exceptions nothing error, while catching errors does. here's code: public class closefriends { // contains edges represented incident matrix private static boolean edges[][]; // adds directed edge between v1 , v2 // method sorts edges reduce space used public static void addedge(int v1, int v2) { if (v1 > v2) { edges[v1][v2] = true; } else { edges[v2][v1] = true; } } // creates graph v

java - Can CDI inject standard library POJOs into an EJB? -

i can inject own pojo managed object this: import javax.ejb.stateless; import javax.inject.inject; @stateless public class someejb { @inject private somepojo somepojo; } and have pojo: // no annotations public class somepojo { } this works fine. if inject ejb jsf backing-bean, can see value of somepojo non-null value, expected. however, if try inject java.util.date someejb , following exception on deployment: severe: exception while loading app : weld-001408 unsatisfied dependencies type [date] qualifiers [@default] @ injection point [[field] @inject private someejb.date] org.jboss.weld.exceptions.deploymentexception: weld-001408 unsatisfied dependencies type [date] qualifiers [@default] @ injection point [[field] @inject private someejb.date] @ org.jboss.weld.bootstrap.validator.validateinjectionpoint(validator.java:311) someejb now: // no annotations public class someejb { @inject private date date; } date has public, no-argument con

scala - Scalaz use applicative builder with validations and a list of validations -

i'm working scalaz validations , i've run situation (note heavily simplified actual code, idea same) given: case class foo(bar: int) val x1: validation[string, foo] = foo(1).success val x2: validation[string, foo] = foo(2).success val x3: validation[string, foo] = foo(3).success val l1 = list(x1, x2) i able along lines this: (x3 |@| l1) { (x1, x2, x3) => /*do of foo's*/ } of course if there errors, either in list or outside of list i'd them accumulate would. i know above syntax not work, advice on how achieve result i'm looking appreciated. if have list[f[a]] , f has applicative functor instance, can turn list inside out in effect sequenceu f[list[a]] : scala> l1.sequenceu res0: scalaz.validation[string,list[foo]] = success(list(foo(1), foo(2))) or: scala> (x3 |@| l1.sequenceu) { case (third, rest) => // values } it's worth noting if find writing things of xs.map(f).sequenceu , can use xs.traverseu(f) instead

android - How to enable MainActivity from second Activity that was DISABLED via PackageManager -

i have disabled main activity hide icon drawer .. how reanable ? my disabling code is packagemanager p = getpackagemanager(); p.setcomponentenabledsetting(getcomponentname(),packagemanager.component_enabled_state_default,packagemanager.dont_kill_app); no want reanable via secondactivity button.

java - Regex not working with Stream filter() -

i trying text out line when using new stream in java 8. this reading in: 46 [core1] 56 [core1] 45 [core1] 45 [core2] 67 [core2] 54 [core2] and here code read currently: path path = paths.get("./src/main/resources/", "data.txt"); try(stream<string> lines = files.lines(path)){ list<integer> temps = new arraylist<>(); lines .filter(line -> line.contains("[core1]")) .filter(line -> line.contains("(\\d+).*")) .flatmaptoint(temperature -> intstream.of(integer.parseint(temperature))) .foreach(system.out::println); system.out.print(temps.size()); } i have checked regex expression in https://www.regex101.com/ , seems work fine. if search [core1] string, find it. the problem when using of together, 0 matches. logic behind read line, see core is,

Error sending bitmap between activies android -

i know how send images between activities. can't emulate android app in eclipse, everytime want test have install phone, can't see error returns me. as said before, having problems between 2 activities when want send , image "acceso_camara" (main activity) "visualizar_imagen" (activity in want recieve image). here, code did send image: protected void onactivityresult(int requestcode, int resultcode, intent data) { intent siguienteactividad = new intent(this,visualizar_imagen.class); switch(requestcode) { case request_image_capture: if (resultcode == result_ok) { bundle extras = data.getextras(); bitmap bitmap = (bitmap) extras.get("imagen"); bytearrayoutputstream bs = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.png, 50, bs); siguienteactividad.putextra("bytearray", bs.tobytearray()); startactivity(siguienteactividad

php - Clean solution for using APIs within Laravel? -

does have nice clean & code efficient solution using apis within laravel? thanks one thing lot of folks seem forget model in mvc. of time, abstraction layer database, don't have be. can service interacting external api. so said, when building out feature on site uses external api, start creating model api. try name methods similar possible eloquent methods because used working , tends make sense. these methods interact api , can use results api fill out collection object well. idea design model in way don't feel interacting third-party api. on top of model, build repository contain business logic app requires interact api. example, if you'd need grab item api, might want check own database first cached version. if there none, grab item api , cache/recache , return results controller. then you'd inject repository controller , whatever need it. also, might pretty obvious, things api key , entry point api go in config files or .env file

javascript - React-Native fetch XML data -

i'm new react-native. trying make simple apps. can't figure out how fetch xml data. json clear , simple. but how fetch xml? tried convert json via this , other similar scripts, without success. need :/ my code looks simple: var xml_url = 'http://api.example.com/public/all.xml'; var exampleproject = react.createclass({ getinitialstate: function() { return { data: {results:{}}, }; }, componentdidmount: function() { this.fetchdata(); }, fetchdata: function() { fetch(xml_url) .then((response) => response.json()) .then((responsedata) => { this.setstate({ data: responsedata.data, }); }) .done(); }, render: function() { return ( <view style={styles.wrapper}> <view style={styles.container}> <view style={styles.box}> <text style={styles.heading}>heading</text> <text>some text</text>

java - How to make .jar from .class -

i have working .class file when use jar cvf myjar.jar *.class i resulting myjar.jar not opened: "the java jar file “myjar.jar” not launched. check console possible error messages." thanks helping. ========== edit: > build > myclass.class > myclasscanvas.class > myclassframe.class > manifest.txt manifest.txt: main-class: myclass as mentioned in comment, need add manifest jar. call manifest.txt , must have @ least following line: main-class: yourclass # remove comment, leave empty line yourclass same name yourclass.class file without extension , class must have main method (public static void main(string[] args). if have main class in subdirectories, must use them (they considered packages. instance if have directory com/foo/yourclass.class main-class: com.foo.yourclass # remove comment, leave empty line then pack jar: jar cvfm myjarname.jar manifest.txt *.class for more see manifest edit: i recommend

javascript - Does DST need to be manually parsed in UTC conversions with moment.js? -

i'm defining time moment-timezone 2015-06-05 10:00 in greece (utc+2 dst = utc+3). store in utc later use. from see, when use .local local date it's converted utc+2 ignoring in dst (daylight saving time) , should utc+3. you can see here: var moment = require('moment-timezone'), mytime = moment.tz('2015-06-05 10:00', 'europe/athens') mytime.format() // '2015-06-05t10:00:00+03:00' // ok, utc+3 mytime.utc().format() // '2015-06-05t07:00:00+00:00' // ok, time changed 7:00 mytime.local().format() // '2015-06-05t09:00:00+02:00' // ??? why doesn't take on account dst? mytime.utc().local().format() // '2015-06-05t09:00:00+02:00' // should give initial value? not. from documentation not clear me if dst considered. missing something? approach on this? some explanation: mytime = moment.tz('2015-06-05 10:00', 'europe/athens') this creates moment object timezone information attache

php - When to use single quotes, double quotes, and backticks in MySQL -

i trying learn best way write queries. understand importance of being consistent. until now, have randomly used single quotes, double quotes, , backticks without real thought. example: $query = 'insert table (id, col1, col2) values (null, val1, val2)'; also, in above example, consider "table," "col[n]," , "val[n]" may variables. what standard this? do? i've been reading answers similar questions on here 20 minutes, seems there no definitive answer question. backticks used table , column identifiers, necessary when identifier mysql reserved keyword , or when identifier contains whitespace characters or characters beyond limited set (see below) recommended avoid using reserved keywords column or table identifiers when possible, avoiding quoting issue. single quotes should used string values in values() list. double quotes supported mysql string values well, single quotes more accepted other rdbms, habit use single quot

bash - Hiding passwords from the command line in linux -

for bash script, using read -s hide password input user. after script has run, used history command see if passwords showed up, , did not. later learned type of history, csh history. cannot seem figure out how view history. if show in csh history, how hide user input showing on histories on linux box. csh shell, alternative bash. history matter if uses it. if script doesn't take passwords on command line, should fine when run csh well. can test it: $ csh <-- launches interactive csh $ ./script.sh <-- run script <whatever> $ history <-- show csh history ... $ exit <-- drops out of csh , previous shell so if nothing concerning shows in history, you're fine.

Why isn't Rollbar catching my exceptions in my Django/Python app? -

technologies , applications used : rollbar, django 1.7, python 3.4 so, i'm following official documentation found here integrating rollbar python , django based application: https://github.com/rollbar/pyrollbar . includes: pip installing rollbar, adding middleware class , creating rollbar dictionary configuration in settings file, etc. just test things out added example provided in docs 1 of views, , rollbar/django works fine (i.e. rollbar registers exception , exception sent rollbar account in cloud): try: main_app_loop() except ioerror: rollbar.report_message('got ioerror in main loop', 'warning') except: # catch-all rollbar.report_exc_info() but, example, in 1 of template files misspell block tag , error via django's default error logging system. however, rollbar doesn't record error and/or isn't sent rollbar account in cloud. because rollbar has integrated manually via kind of try, catch scenario? or can rollbar grab errors

Desire2Learn Valence API | JSON not loading -

i'm using python requests library valence-provided python sdk attempt request. odd happening url , i'm not sure what. response 200 (which leads me believe authentication working), when try print json request object, instead prints html of page instead of json. i'm using modified code read http://docs.valence.desire2learn.com/clients/python/auth.html . here's python code: import requests import auth d2lauth auth import * app_creds = { 'app_id': '----', 'app_key': '----' } ac = d2lauth.fashion_app_context(app_id=app_creds['app_id'], app_key=app_creds['app_key']) auth_url = ac.create_url_for_authentication('ugatest2.view.usg.edu', 'http://localhost:8080') redirect_url = "https://localhost:8080?x_a=3----&x_b=3dmrgcbahxjdta2e6djifdwq-gyl-pk77ff_3x5oduuqc" uc = ac.create_user_context(auth_url, 'ugatest2.view.usg.edu', true) route = 'ugatest2.view.usg.edu/d2l/api/versions/

PHP shopping cart cant understand the error -

this question has answer here: reference - error mean in php? 29 answers i getting error in cart.php parse error: syntax error, unexpected '' (t_encapsed_and_whitespace), expecting identifier (t_string) or variable (t_variable) or number (t_num_string) in cart.php on line 74 line 74 $subtotal = $_session['cart'][$row['id_number']]['quantity']*$row['price']; <?php if(isset($_post['submit'])) { foreach($_post $items => $item) { $items = explode("-",$items); $items = end($items); $items = explode("submit",$items); $items = end($items); if($_post['quantity-'.$items]<=0) { unset($_session['cart'][$items]); } else { $_session['cart'][$items][&

Replace or add code to HTML with CSS -

it's challenge , not sure if that's possible here problem: i don't have full access website. can edit external css. menu code: <ul id="navprimary" class="nav"> <li id="navlink1"><a href="#">link1</a></li> </ul> i want add first position on list: <li id="navhome"><a href="/"><i class="icon-home"></i></a></li> i can ask system administrator add link home code this: <li id="navhome"><a href="/">home</a></li> so there still problem replacing text home <i class="icon-home"></i> . the thing comes mind regarding css :before , :after , content not quite sure how use it. before i've tried adding single word. edit1 i have tired this: #navlink1:before{ content:'<li id="navhome"><a href="/"><i class=&quo

python - How do you print the output this [6,4,2,0] in a single row rather that sequence -

i using below manual method happens find high bits =1 of binary value given integer. for eg: when enter 85, 6th, 4th, 2nd , 0th bit high , getting output 6 4 2 0 in sequence. need output this: [6,4,2,0] . 1 me in ? def high_bit(num): in range(0,100): if (num/(pow(2,i)))==1: print num = (num - (pow(2,i))) y = high_bit(num) return y i find recursion bit confusing, can work: def high_bit(num, lst=none): if lst == none: toplevel = true lst = [] else: toplevel = false in range(0,100): if (num/(pow(2,i)))==1: lst.append(i) num = (num - (pow(2,i))) high_bit(num, lst) if toplevel: print lst high_bit(85) # prints [6, 4, 2, 0] i recommend doing iteratively, though.

shell - Bash script, command - output to array, then print to file -

i need advice on how achieve output: myoutputfile.txt tom hagen 1892 state: canada hank moody 1555 state: cuba j.lo 156 state: france output of mycommand: /usr/bin/mycommand tom hagen 1892 canada hank moody 1555 cuba j.lo 156 france im trying achieve shell script: ifs=$'\r\n' globignore='*' :; names=( $(/usr/bin/mycommand) ) name in ${names[@]} #echo $name echo ${name[0]} #echo ${name:0} done thanks assuming can rely on command output groups of 3 lines, 1 option might be /usr/bin/mycommand | while read name; read year; read state; echo "$name $year" echo "state: $state" done an array isn't necessary here. one improvement exit loop if don't 3 required lines: while read name && read year && read state; # guaranteed name, year, , state set ... done

selenium - How can I pass this code successfully? Java Webdriver TestNg -

i want pass code other classes don't have keep pasting it. this class containing code: package utility; import org.openqa.selenium.webdriver; import org.openqa.selenium.chrome.chromedriver; import org.openqa.selenium.firefox.firefoxdriver; import org.testng.annotations.parameters; import org.testng.annotations.test; public class browsertype { public static webdriver driver; @parameters("browser") @test public static void callbrowser(string browser) { if(browser.equalsignorecase("firefox")) { driver = new firefoxdriver(); // if browser ie, }else if (browser.equalsignorecase("chrome")) { // here setting path iedriver {system.setproperty("webdriver.chrome.driver","c:/users/elsid/desktop/eclipse/selenium/chromedriver.exe");} driver = new chromedriver(); driver.get(constant.url); } } }

graphics - C# DrawElipse Method without specifying a fill -

Image
simple question - how use drawing context make ellipse not fill colour? at moment have: drawingcontext.drawellipse(drawbrush, null, jointpoints[jointtype], jointthickness, jointthickness); this gives me ellipse filled colour @ every joint position tracked kinect. i want display outter circle without fill, how can this? for example image above, how make outter circle? simply pass null brush , pass in pen of desired color instead. from msdn : the brush fill ellipse. optional, , can null. if brush null, no fill drawn.

java - Efficient way to transform ByteBuffer stream into lines in Rx -

i want transform observable<bytebuffer> lines ( observable<string> ) splitting line ending character. if have functions such tostring , concat , splitbyline , must able following: observable<bytebuffer> o = ...; o.map(tostring).reduce(concat).flatmap(splitbyline); this algorithm, however, needs scan whole bytes first , store them in memory before emit first line of deserialized string. how emit new line each time line ending appears in bytes incrementally? i found rxjava-string . provides rx operators handle stream of chunked byte arrays , strings. api document found here . the question can achieved following: observable<byte[]> o = ...; charset charset = charset.forname("utf-8"); // stringobservable have no operators bytebuffer yet stringobservable.byline(stringobservable.decode(o, charset));

Python pandas for reading in file with date -

in dataframe below, 3rd line header , y, m , d columns giving year month , day respectively. however, not able read them in using code: df = pandas.read_csv(file_name, skiprows = 2, index_col='datetime', parse_dates={'datetime': [0,1,2]}, date_parser=lambda x: pandas.datetime.strptime(x, '%y %m %d')) oth-000.opc xkn1= 0.500000e-01 y m d prcp vwc1 2006 1 1 0.0 0.17608e+00 2006 1 2 6.0 0.21377e+00 2006 1 3 0.1 0.22291e+00 2006 1 4 3.0 0.23460e+00 2006 1 5 6.7 0.26076e+00 i keyerror: list index out of range. suggestions? the default separator in read_csv comma. file doesn't use commas separators, you're getting 1 big column: >>> pd.read_csv(file_name, skiprows = 2) y m d prcp vwc1 0 2006 1 1 0.0 0.17608e+00 1 2006 1 2 6.0 0.21377e+00 2 2006

exception - System.TypeLoadException in C# -

i have c# application , modified show new window using lines: private void button1_click(object sender, eventargs e) { welcomescreen channelbar = new welcomescreen(true, "http://www.trade-ideas.com/cms_static/channelbar/channelbar.html"); } it compiles fine, when run app , click on button, error: an unhandled exception of type 'system.typeloadexception' occurred in windowsformsapplication1.exe additional information: not load type 'tradeideas.tiprodata.oddsmakercolumnconfiguration' assembly 'tiprodata, version=1.0.0.0, culture=neutral, publickeytoken=null'. what doesn't make sense welcomescreen comes tiprogui.dll not tiprodata. have included both dll's in project along 3rd dll: using tradeideas.tiprodata; using tradeideas.tiprogui; using tradeideas.tiprodata.configuration; also, when run project initially, see strange message. says: loading symbols tiprodata.dll from: \\missioncontrol\users\klewis2\do

multithreading - Tracking changes made to a NSManagedObject on a different thread -

i want send changes made nsmanagedobject server , want in background. therefor, setup background thread own nsmanagedobjectcontext registers nsmanagedobjectcontextdidsavenotification . however, cannot access changedvalues on userinfo 's nsinserted/updated/deletedobjectskey , because it's on different thread. how can done then? the easy way is: don't bother changedvalues . send attributes of managed object changes. overhead not much, , code simpler. if want send values of attributes have changed, gets more complicated: you can use changedvalues , long using nsmainqueueconfinement or nsprivatequeueconfinement and call changedvalues using performblock: or performblockandwait: block gets changes. changed values , copy them outside of core data. make sure access core data in 1 of blocks. changedvalues useless after save, so... if use changedvalues , you'll need use nsmanagedobjectcontextobjectsdidchangenotification notified of changes, can

mysql - Laravel Eloquent REPLACE -

i'm creating database migration script in laravel 4 command. all database migration process fine i'm having trouble changing user prefixes: need change user-john-jb user-john-od, user suffixes need changes '-jb' '-od'. the current line of code have is: db::table('users')->update(['username' => db::raw("replace(username, '-".$suffix."', '-".$thissuffix."')")]); if run code in repl works fine doesn't work in command. looking @ logs generated sql query is: update `users` set `username` = replace(username, "-jb ", "-od") for reason line break being inserted query. i'm not sure if has problem. does know how fix this? appreciated. thanks in advance. as ben harold pointed out, problem came $suffix containing line break. adding trim() fixed problem.

eclipse - GWT module [name] may need to be (re)compiled error -

installed latest eclipse (luna) , added latest gwt plugin (no maven), gwt project try run in eclipse gives same error gwt module [name] may need (re)compiled. tried projects worked in older versions of eclipse before, same error. tried deleting generated files/cache files , clearing browser cache, per old stackoverflow recommendations. tried different versions of jdk. tried reinstalling scratch, creating new workspace , new empty project using web-app eclipse wizard, same result. no errors in logs. any ideas appreciated. thanks. solved deleting everything, installing new gwt 2.7 , launching project in super-dev mode. apparently, unless launch in supr-dev mode, correct javascript not generated @ all.

c# - How to split file into parts and download -

Image
i'm working on split downloader c#. downloading fine (so logic working) problem whatever file downloads corrupts. have no idea on how fix it. here's code: private void mergeclean() { const int chunksize = 1 * 1024; // 2kb using (var output = file.create("output.jpg")) { foreach (var file in files) { using (var input = file.openread(file)) { var buffer = new byte[chunksize]; int bytesread; while ((bytesread = input.read(buffer, 0, buffer.length)) > 0) { output.write(buffer, 0, bytesread); } } } } foreach (var file in files) { file.delete(file); } } private void savefilestream(string path, stream stream) { var filestream = new filestream(path, filemode.create, file

php - How to select users friends post and users post -

i need way mysql select * photos username equal "user" or "users friends". mysql_query("select * photos username='king' or username='$user' or username='wale' or username='prince' order id desc"); above, played around see work , seems work when add specific usernames. however, program automatically select friends. this original code. need way sql select * photos username equal user or "users friends". $friendsarray = ""; $countfriends = ""; $friendsarray12 = ""; $addasfriend = ""; $selectfriendsquery = mysql_query("select friend_array users username='$user'"); $friendrow = mysql_fetch_assoc($selectfriendsquery); $friendarray = $friendrow['friend_array']; $friendarray = explode(",",$friendarray); $countfriends = count($friendarray); $friendarray12 = array_slice($friendarray, 0, 12); ` this selects friends array within database

Android studio logcat timestamps EDT time zone -

i use android studio under windows server 2008r2 the time stamps in logcat in edt timezone. while server's clock shows 5:40pm (utc+1) logcat time stamps show 11:40 is there way configure android studio\logcat display server's local time ? logcat uses android device's time. set correct time on device

sql - Group By Count and Total Count -

i trying figure out how can following result query unable same. table name: productmaster productcode quantity entrydate a1 10 10/03/2015 a1 10 15/03/2015 a2 10 18/03/2015 a2 10 25/03/2015 a1 10 10/04/2015 a2 10 15/04/2015 i want result if select march month, result should as: productcode monthcount totalcount a1 20 30 a2 20 30 if select april month, result should as: productcode monthcount totalcount a1 10 30 a2 10 30 my query: select productcode, sum(quantity) productmaster datepart(month, entrydate) = @month group productcode where @month = 3 or 4 , based on input. additionally, how can count of productcode. month = 3 productcode monthcount totalcount a1 2 3 a2 2 3 y

How to limit the length column in sql server reporting services -

i have table , of cells contain lot of data. want truncate after 10 characters. in design view right clicked column , clicked text box properties unchecked allow height increase. checked preview , fixed problem, after deployed report reporting server length of column increased again. please help. three methods use: sql query in sql query, truncate column so: select left(foo,10) calculated field in dataset, truncate field new column using expression: =left(fields!foo, 10) textbox field the same method applies above in textbox: =left(fields!foo, 10)

shell - Find and move command in Unix throwing some error -

when run queries manually, throws error. actual command in script: find $tmpdir/tmp0 -name "*.w080" -type d -exec mv -f {} $tmpdir/w0 \; find $tmpdir/w0 -name "*.tif" -type f -exec mv -f {} $finaldir/$date/w080-rf \; error throws @ runtime: find: 0652-081 cannot change directory </sapxchange/opentext/symcor/tmp/tmp0/batch.b75355.l9135.d20150326.t022818.w080>: : file, file system or message queue no longer available. find: 0652-081 cannot change directory </sapxchange/opentext/symcor/tmp/tmp0/batch.b75356.l9135.d20150326.t022818.w080>: : file, file system or message queue no longer available. p.s – please note after above error comes in runtime, job completes , process data… i think find looking files in subdirs of /sapxchange/opentext/symcor/tmp/tmp0/batch.b75355.l9135.d20150326.t022818.w080 , whole dir has been removed. find doesn't understand is searching. when w080 files @ same level, try without find: mv -f $tmpdir/t

javascript - use css link with script gets encoded -

i using static server ip in references .js , .css, .js files pick .css files being encoded <link href="http://<%=set_server()%>/css/jquery-ui-1.10.4.min.css" rel="stylesheet" /> gets <link href="http://&lt;%=set_server()%>/css/jquery-ui-1.10.4.min.css" rel="stylesheet" /> . did has before , knows solution how not encoded? i recommend not using inline code in href path. if change <link href="/css/jquery-ui-1.10.4.min.css" rel="stylesheet" /> should work (note leading slash, go root directory of site). if really need use inline code build url reason, should build whole link tag in code (so have call function , builds proper link tag).

internet explorer - SCRIPT16389: Unspecified error -- Javascript code -

i'm getting "script16389: unspecified error" defining small piece of javascript. thing works in browsers except ie (yeah, freaking ie -- don't me started). testing in ie10, told happening in ie11. this have in code it's failing (!!!): <script type="text/javascript"> var ischild; if (window.opener == null) { ischild = false } else { ischild = true } </script> i've looked @ other posts have same error. none of them answers question. ideas, anyone?!? i have since discovered ie spits out generic error if doesn't piece of javascript code. i don't remember javascript issue question, remember once resolved it, error went away. edit: seem keep getting downvotes on this, let me clarify i'm talking about. i'm saying javascript error -- javascript error, not specific -- cause script16389 error appear. if resolve error -- whatever you're getting -- script16389 should disappear.