Posts

Showing posts from June, 2011

How can I implement a Zoom Panel with Java Swing libraries -

i've implemented jframe java swing libraries visualize map. i'd realize zoom function within frame. code of jframe: package components; import java.awt.borderlayout; import java.awt.container; import javax.swing.jframe; import javax.swing.jscrollpane; public class myframe extends jframe { private static final long serialversionuid = 1l; private container contentpane; public static final int startwidth = 1280; public static final int startheight = 800; public static mypanel earthpanel; public myframe(){ initcomponents(); } public void initcomponents(){ contentpane = getcontentpane(); this.settitle("tle graphic propagator"); this.setdefaultcloseoperation(jframe.exit_on_close); this.setsize(startwidth, startheight); this.setlocation(0,0); this.setlayout(new borderlayout()); earthpanel = new mypanel(startwidth,startheight); jscrollpane scroll = new jscrollpane(earthpanel, jscrollpane.vertical_scrollbar_always, jscroll...

symfony - Speedup symfony2 fixtures loading in tests with security.encoder_factory -

i create lot of users (using fosuserbundle user manager) in fixtures , load them on set tests. updatepassword() method takes lot of time execute, because calculates hash (very expensive operation) each user. how can speedup it? what in own project change password encoder test environment faster compute bcrypt. the testsuite not need store password safety provided bcrypt (the test database exists on developer machines or on travis, , uses weak passwords regularly anyway, , written in clear in tests). using simpler encoder makes test run faster if create lot of users. it important make such config change in config_test.yml file though. real environments must use safe password encoder.

How do I install PyPy on appveyor? -

i have python extension needs compiled against pypy interpreter on windows-based appveyor continuous integration service. how pypy in environment? add powershell commands "install" phase of build: (new-object net.webclient).downloadfile('https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-win32.zip', "$env:appveyor_build_folder\pypy3-2.4.0-win32.zip") 7z x pypy3-2.4.0-win32.zip | out-null $env:path = "$env:appveyor_build_folder\pypy3-2.4.0-win32;$env:path" then can call pypy.exe anywhere in build.

php - Matlab urlread error within timer function -

i using timer function in matlab continuously execute script. within script, using urlread retrieve data webservices, works charm. i trying use urlread execute simple http-request within script insert data mysql-database. thus, specify url-string , define value parsed php parser. code-within script being executed in timer-function: db_url = 'http://someurl/update.php?value='; db_url = strcat(db_url,num2str(value)); urlread(db_url); clear db_url my problem following: when run timer, works fine 1 execution, stops displaying following error: "either url not parsed or protocol not supported." what going wrong? when check mysql database, see 1 new line has been added database, means works, won't execute multiple times within timer. any idea going wrong? many in advance! i figured out problem was. value variable array increasing in size each iteration. thus, needed specify value(end) , so: db_url = 'http://someurl/update.php?value=...

Need help understanding how vectors are represented in binary [C++] -

this question has answer here: serialise , deserialise vector in binary 4 answers i'm trying learn how crack file formats, started simple example i've taken there: how read / write struct in binary files? #include <fstream> #include <iostream> #include <vector> #include <string.h> using namespace std; typedef struct student { char name[10]; double age; vector<int> grades; }student_t; void readbinaryfile(string filename) { ifstream input_file(filename, ios::binary); student_t master[3]; input_file.read((char*)&master, sizeof(master)); (size_t idx = 0; idx < 3; idx++) { // if wanted search specific records, // should here! if (idx == 2) ... cout << "record #" << idx << endl; //cout << "capacity: " << mas...

How to send as many inputs as we have to the program using bash script? -

running arithmetic parser using bash script inside bash reading inputs using : $@ because every time can have different number of inputs. when send 1+1 can parse fine when send (1+1) error: -bash: syntax error near unexpected token `1+1' how can change able read parenthesis well? note: parser works fine parenthesis. quote arguments when calling bash script: bash myscript.sh "(1+1)" or escape special characters: bash myscript.sh \(1+1\)

Android: Detect status bar notification click -

when application fires notification want method called after user clicks notification this's how create notification : intent alarmintent = new intent(mainactivity.this, alarmreceiver.class); alarmintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top); bundle bundle = new bundle(); pendingintent pendingintent; alarmmanager manager = (alarmmanager) getsystemservice(context.alarm_service); date date = new date(); bundle.putstring("name", "name"); bundle.putstring("body", "body"); alarmintent.putextras(bundle); pendingintent = pendingintent.getbroadcast(mainactivity.this, 10000, alarmintent, pendingintent.flag_cancel_current); manager.setexact(alarmmanager.rtc_wakeup, date.gettime()+5000, pendingintent); // fire after 5 seconds of launch so how edit code achieve .. thank you try code notification for calling notificationshow(this); method defi...

php - Match a given sequence only if not between quotes, taking escaped quotes into consideration -

i use below regular expression match given character sequence if not surrounded quotes - is, if followed number of quotes (using positive lookahead) until end of string. say want match word section if not between quotes: \bsection\b(?=[^"]*(?:"[^"]*"[^"]*)*$) working example on regexr how extend take escaped quotes consideration? is, if insert \" between quotes in linked example, results stay same. using pcre skip quoted stuff: (?s)".*?(?<!\\)"(*skip)(*f)|\bsection\b in string regex pattern have triple-escape backslash, \\\\ match literal backslash in lookbehind . or in single quoted pattern double escaping sufficient case. $pattern = '/".*?(?<!\\\)"(*skip)(*f)|\bsection\b/s'; see test @ regex101 .

python - Pass a value by reference in a function to find level of node in a binary tree -

i trying write function find level of node in binary tree. here implementation: def level_of_node(root, node, level): if root none: return -1 if root.data == node: return level return level_of_node(root.left, node, level+1) return level_of_node(root.right, node, level+1) here tree: root = node(6) root.left = node(10) root.right = node(3) root.left.left = node(4) root.left.right = node(30) root.left.right.left = node(16) root.left.right.right = node(8) root.right.right = node(3) root.right.left = node(5) level = 0 x = level_of_node(root, 16, level) print x when call function, should return level of node returns -1. i think because level passed value. can suggest me better way recursively ?

css - Prevent div from exceeding screen -

Image
i have div displaying under button. works file long button on left side of screen. if button on right box exceeds size of screen. i box try display under button , right if possible. if not possible as needed screen left right edge of modal div edge of screen. preferbly jqlite if possible. hope makes sense , can help. the markup: .dd-combo .dd-combo-wrapper { z-index: 10; text-align: left; background-color: #ffffff; position: absolute; max-width: 1024px; min-width: 900px; min-height:300px; max-height:600px; top: 100%; left: -250px; right:10px; width: 1700%; margin: 5px auto; box-shadow: 10px 10px 5px #888; overflow:scroll; border-top: 1px solid #ddd; border-left: 1px solid #ddd; } .dd-combo .dd-combo-wrapper:before { content: ''; display: none; width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 11px solid #bf1e...

grails - Hibernate proxies - classes with unusual names -

while doing gorm research better understanding of gorm, using practice grails project had pet domain class. came across casting error noticed in error message there class name pet_$$_javassist_3 . hibernate proxy? yes, instance of proxy class.

swift - Subscript Syntax to append values in array -

in swift programming language book explicitly states: you can't use subscript syntax append new item end of array the example provided in book states if replacement set of values has different length range replacing fine. example: var shoppinglist = ["eggs", "milk", "chocolate"] shoppinglist[0...2] = ["bananas", "apples"] // shoppinglist = ["bananas", "apples"] which makes sense because replacing 3 values values of banana , apple. however, if did instead: var shoppinglist = ["eggs", "milk", "chocolate"] shoppinglist[0...2] = ["bananas", "apples", "sausage", "pear"] // shoppinglist = ["bananas", "apples", "sausage", "pear"] i thought not allowed use subscript syntax append new item end of array, seems loophole in language. can explain me why happens and/if valid behaviour or bug? thanks...

c# - Refresh binding with converter bound to other property -

i building winrt app windows 10 , facing issue can't seem find answer for. in main page, have list of map markers bound observablecollection in viewmodel. each of these markers, need display text can either property1 or property2 mapmarker class, based on value of property (let's call propertyselector) of viewmodel. the best solution found make struct contains both property1 , property2 in mapmarker class, bind text field of marker , use converter choose 1 display. since can't bind property converterparameter, implemented dependencyproperty in converter give access propertyselector. dp works fine, property in converter gets updated, markers never updated. it's because didn't trigger event told marker update, didn't manage achieve adding propertychanged("markerlist") propertyselector setter or trying refresh programmatically bindings when change property things getbinding(text).updatesource() , way seem have different implementation wpf. am...

java - App crashing in emulator -

i've searched plenty , have found nothing prevent error. making simple stopwatch application crashing in emulator when try , test it. the code matters: public class myactivity extends activity implements actionbar.tablistener { /** * {@link android.support.v4.view.pageradapter} provide * fragments each of sections. use * {@link fragmentpageradapter} derivative, keep every * loaded fragment in memory. if becomes memory intensive, * may best switch * {@link android.support.v13.app.fragmentstatepageradapter}. */ sectionspageradapter msectionspageradapter; /** * {@link viewpager} host section contents. */ viewpager mviewpager; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_my); button start; final textview stopwatch_num; final double mcount = 0.0; start = (button)findviewbyid(...

OpenCV & Python: quickly superimpose mask over image without overflow -

Image
i'd superimpose binary mask on color image, such mask "on", pixel value changes amount can set. result should this: i using opencv 2.4 , python 2.7.6. have way works well, slow, , way fast has issues overflow , underflow. here result of faster code, overflow/underflow artifacts: here code, showing both fast version , slow version: def superimpose_mask_on_image(mask, image, color_delta = [20, -20, -20], slow = false): # superimpose mask on image, color change being controlled color_delta # todo: works on 3-channel, 8 bit images , 1-channel, 8 bit masks # fast, can't handle overflows if not slow: image[:,:,0] = image[:,:,0] + color_delta[0] * (mask[:,:,0] / 255) image[:,:,1] = image[:,:,1] + color_delta[1] * (mask[:,:,0] / 255) image[:,:,2] = image[:,:,2] + color_delta[2] * (mask[:,:,0] / 255) # slower, no issues overflows else: rows, cols = image.shape[:2] row in xrange(rows): c...

put - Starring a repository with the github API -

i'm trying star repository using githubapi. done via put request /user/starred/:owner/:repo . attempted implement feature in python using requests library, isn't working. here minimum working example: the constant defined github_api = api.github.com , github_user = username of owner of repo starred , , github_repo = name of repo starred url = urljoin(github_api, (user + '/starred/' + github_user + '/' + github_repo)) r = requests.put(url,auth=(user,password)) print r.text this code results in error reads: {"message":"not found","documentation_url":"https://developer.github.com/v3"} i think i'm missing fundamental process of issuing put request. the problem here parameters pass urljoin() . first parameter supposed absolute url, while second parameter relative url. urljoin() creates absolute url that. also, "user" in case supposed literal part of url, , not username. in case, forgo u...

Using NavigationView from Android Design Support Library -

i'm trying follow this tutorial use new drawerlayout design support library. it seems android studio isn't recognizing navigationview layout. this main_activity layout: <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:padding="20dp"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello"/> </linearlayout> <android.support.design.widget.navigationview android:layout_width="wrap_content" ...

logging - Do I need to explicitly check for __name__ == "__main__" before calling getLogger in Python? -

i believe it's standard practice when using python's built-in logging module have logger in main module root logger. assuming correct, seems me module may or may not run main need explicitly check. reason if follow standard practice of calling logging.getlogger(__name__) i'll logger named __main__ rather root logger: import logging print logging.getlogger().name # root print logging.getlogger(__name__).name # __main__ is best practice check? if __name__ == "__main__": logger = logging.getlogger() else: logger = logging.getlogger(__name__) this not bad because i'll have other code runs if __name__ == "__main__" (often including call logging.basicconfig ) nice need 1 line instead of more. the practice of using logging.getlogger(__name__) meant module-level logger , explained in advanced logging tutorial . in script (or main module of application) don't create logger @ all, change configuration of root logger; ...

javascript - Make whole page draggable -

i not sure start or keywords search for, asking point me in right direction. here wanting. i wanting make webpage can dragged in directions different html elements in directions , load new elements close edges via ajax. hoping achieve via bootstrap or jquery. any ideas on how page draggable that? jquery ui has draggable method work you, long target viewable area element initiallize plugin on. if prefer more lightweight approach can use plugin created chris coyier.: https://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/ . an example of working in 2 directions found in thread well: scroll page on drag jquery actual plugin being used in demo supports direction dragging - see authors site: http://davetayls.me/jquery.kinetic/

javascript - How stub a global dependency's new instance method in nodejs with sinon.js -

sorry confusing title, have no idea how better describe it. let's see code: var client = require('some-external-lib').createclient('config string'); //constructor function myclass(){ } myclass.prototype.dosomething = function(a,b){ client.dowork(a+b); } myclass.prototype.dosomethingelse = function(c,d){ client.dowork(c*d); } module.exports = new myclass(); test: var sinon = require('sinon'); var myclass = requre('./myclass'); var client = require('some-external-lib').createclient('config string'); describe('dosomething method', function() { it('should call client.dowork()',function(){ var stub = sinon.stub(client,'dowork'); myclass.dosomething(); assert(stub.calledonce); //not working! returns false }) }) i working if .createclient('xxx') called inside each method instead, stub client with: var client = require('some-external-lib'); sinon.stub(clie...

python - Tkinter example for multiple frames, grid error -

i'm using below example, found on portal. , try add listbox. know can use pack, instead grid, pack quite messy, , grid can more specific. import tkinter tk title_font = ("helvetica", 18, "bold") class sampleapp(tk.tk): def __init__(self, *args, **kwargs): tk.tk.__init__(self, *args, **kwargs) # container we'll stack bunch of frames # on top of each other, 1 want visible # raised above others container = tk.frame(self) container.pack(side="top", fill="both", expand=true) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} f in (startpage, pageone, pagetwo): frame = f(container, self) self.frames[f] = frame # put of pages in same location; # 1 on top of stacking order # 1 visible. frame.grid(row=0, column=0, sticky="nsew...

c++ - Writing binary data to private ofstream produces unexpected result -

i working on class read , write binary data to/from file. testing sending 'a' . when sent cout , worked. sent text file, sent î. what different ofstream causing this? #include <iostream> #include "bin2.h" using namespace std; int main() { bin mybin("e:\\temp\\test.txt"); char data[1]; data[0] = 'a'; mybin.write(data, 1); system("pause"); return 0; } bin2.h #pragma once #include <fstream> class bin { std::ofstream outfile; std::ifstream infile; std::filebuf *outbuff, *inbuff; int buffsize = 5; char* buffer; //0 = input, 1 = output, 2 = ready delete, 3 = unitialized char mode = 3; public: //constructor no parameters bin(){ ; }; //if 'this' constructed file, call init() set object bin(char filename[]) { init(filename); }; void init(char filename[]) { try { //check if isuninitialized ...

vb.net - Component Design - Visual Basic DotNetBar -

i have form way more 1500 objects in multiple tabs, , getting awful maintain , develop new features. i'm using dotnetbar components wanted design each tab (supertabcontrolpanel) separately , add them manually in run time. but can't seem able design solely component.

how to start tomcat service as administrator -

i had met problem.i want use "runtime.exec()" run cmd in web app while tomcat service doesn't start adminstrator , has no privilege run cmd. ,if there has way start service adminstrator auto not manual click tomcat.exe ? there's 1 principle shall keep in mind: application can reach internet must always run minimal permissions possible. totally (always!) rules out run administrator. in case finds security issue in application, don't want provide them free administrator privileges on top. even permission execute cmd questionable have internet-reachable process. in hardened system rather task of server, running different privileges (again, not administrator) webserver (tomcat) connect to. as quickfix might want provide cmd execution permissions user tomcat runs on. very-quick-fix might change tomcat service configuration - configure tomcat shall run service (and configure list of autostarting services) can specify user account runs under. i'm ...

c# - Youtube api get subscription video feed -

i refer this page . i had succeeded subscription list. i fill 2 field "part", "channel id(my channel id)" , authorize requests using aouth 20. now, want subscriptions feed. i had tried request, it's error. i fill follow field: "part(snippet)", "channel id" , set "mine" & "mysubscribers" true why can't success, error reason "incompatibleparameters" btw, try fill "id" field, don't know should fill it's annotation "subscribe id". should fill? update(06/19/2015): i find solution, in activity section, response youtube home page feed, that's not sorted.

asp.net - Preventing XSS attacks to dynamically created DOM webpages and dynamically generated javascript event handlers -

i have read following article: https://msdn.microsoft.com/en-us/library/bb355989.aspx now article allows me understand xss vulnerability defense webpage statically made of asp , html controls built on webpage in true markup layout fashion. understand that control input should use not server side in validation input should validate length, range, format , type. question have trying sanitize website page layout controls build on dom object dynamically when page loads. example on page load event methods add controls document object 1 @ time in method builds entire webpage during calling method. also, control event handling done methods send concatenated javascript strings, during page load, output page handle page control events. guess question is, how use asp.net validation controls, regex checking, etc. functionally when built, dom , javascript event handling on loading of webpage? i'm afraid ms article has misled you. represents misguided, discredited approach han...

python - Django does not send messages about 500 errors -

okay. not happy posting duplicate question, nothing relevant seems me. so problem want receive emails containing server error messages (500), , don't. what know: everything works fine on local machine: messages when set debug = false . many of them, being honest. calling django.core.mail.mail_admins() within ./manage.py shell on production server working fine: emails, sent send_email() within view i have debug = false set on production server trying email messing home template missing parentheses , putting assert 0 string home view. getting 500.html rendered alright that. here email settings in settings.py: email_host = 'smtp.yandex.ru' email_host_user = 'noreply@<project-name>.ru' email_host_password = '<password>' email_port = 587 email_use_tls = true default_from_email = 'noreply@<project-name>.ru' server_email = 'noreply@<project-name>.ru' here logging settings in settings.py: logging = ...

swift - Random Line Appearing on Moving Texture Node -

Image
i have several texture nodes move right constantly. reason, 1 of types of texture nodes generates white line in-between , next node when moving, when moving. the image 60 x 60 , 3/4 of image transparent , 1/4 coloured green color. when change image solid color @ 60 x 60 (no transparency) , run app, line disappears? here code: func generategroundsegment_singlesegment() { nodesegment = skspritenode() nodesegment.texture = arraytexturesegment[int(myelement)] nodesegment.size.width = sizesegmentwidth nodesegment.size.height = sizesegmentheight nodesegment.position.x = countsegmentx * sizesegmentwidth nodesegment.position.y = (countsegmenty * sizesegmentheight) - nodewaterlayer1_1.size.height - nodesegment.size.height/2 nodesegment.zposition = 190 //generategroundsegment_type() nodemovingplatform9.addchild(nodesegment) } the node white line child node has zposition of 0, coloured clear , node moves left. node move left child 1 other node, ...

elisp - Emacs helm: Adding new sources to helm-mini -

helm has builtin helm-mini command includes buffers , recentf in sources. (setq helm-source-buffers-list (helm-make-source "buffers" 'helm-source-buffers))) (helm :sources helm-mini-default-sources :buffer "*helm mini*" :truncate-lines t) there 1 more package helm recent dirs provides helm interface recentd uses '(helm-source-dired-recent-dirs) source. i trying combine 2 adding in helm-mini (append helm-mini-default-sources '(helm-source-dired-recent-dirs)) but doesn't work. missing something? the append form doesn't change value of helm-mini-default-sources , it, i.e., m-x helm-mini , not work. can combine setq , append or add-to-list : (setq helm-mini-default-sources (append helm-mini-default-sources'(helm-source-dired-recent-dirs))) ;; or (add-to-list 'helm-mini-default-sources 'helm-source-dired-recent-dirs 'append) but more flexible way using plain setq because can c...

javascript - Sending OAuth token with API request? -

i need details google+ activity id , while i'm successful of time api key, require oauth token sent along request them seen or returns not found. my question is, how can send token along api request? so far i've been doing in javascript: https://www.googleapis.com/plus/v1/activities/' + activityid + '?key=myapikey i have token requested , stored part of program i'm missing how send along request. i'm doing comments.list javascript need having oauth 2.0 toggle switch right turned "on".

java - Inner class declaration and initialization -

i used code in c++, have convert project c++ java. in c++ using data structure pretty simple. trying replicate same thing, such java inner class , static nested class . after reading several examples online, , trying different versions, far got: public class main { public static void main( string[] args ) { ... classouter outerobj = new classouter(); classouter.datainner value = outerobj.new classouter.datainner(); } } class classouter{ public static class datainner{ public int x; } ... protected void getno() { value.x=integer.parseint("493"); } } however, when try compile, gives me error: $ javac -cp "./" main.java main.java:15: error: '(' expected classouter.datainner value = outerobj.new classouter.datainner(); any clue missing here? classouter.datainner value = outerobj.new classouter.datainner(); this syntax applies inner classes (i.e. non static nested classes). if that's want, remove sta...

ios - Container views with segmented control in swift -

i have segmented control 3 segments. "cattle", "sheep" , "goats". in sheep , goats there segmented control "rfid" , "mobs" i have used 3 container views on parent viewcontroller, cattleview, sheepgoatmob view , sheepgoatrfid view have uitableviewcontrollers cattletableviewcontroller, sheepgoatmobtableviewcontroller , sheepgoatrfidtableviewcontroller. parent view contains if statement hide/show each view, works okay.. the problem having each child view needs able send info on pages soap web service uibarbuttonitem on parent view. first thought have "send" button in each child view because 3 views loaded memory when app starts, button doesn't know view function call. edit : how can accomplish setting button in each of 3 views uibarbuttonitem of parent viewcontroller , allowing correct function childviewcontrollers called? option 2: how access 3 childviewcontroller's function through uibarbuttonitem on parent...

ios - How to identify if the OAuth token has expired? -

my ios mobile app consumes services implemented oauth2.0 protocol. oauth access token comes along refresh token , expires_in field. saved refresh token , access token expiration time in app don't have idea on when use them. so usual , best practice of using expires_in ? how identify access token expired? is there common web service error format says access token expired? here's information on oauth 2.0 token refresh. expires in definition the oauth 2.0 standard, rfc 6749 , defines expires_in field number of seconds expiration: expires_in: recommended. lifetime in seconds of access token. example, value "3600" denotes access token expire in 1 hour time response generated. if omitted, authorization server should provide expiration time via other means or document default value. token refresh handling: method 1 upon receiving valid access_token , expires_in value, refresh_token , etc., clients can process storing expiration time , ch...

Show SVG path titles as tooltips using d3-tip -

i have svg element looks this: <svg xmlns="http://www.w3.org/2000/svg" viewbox="50 200 950 1100" style="fill:black" stroke="grey"> <g title="bihar" style="fill:aquamarine"> <path title="paschim champaran" d="m 582.47648,570. /*more*/ 582.47648,570.42447 z" /> <path title="purba champaran" d="m 594.0844,580.42604 /*more*/ l 594.0844,580.42604 z" /> </g> </svg> i view title of each path d3 tootip using d3 tip. tried below: <script> var tip = d3.tip().html(function(){return this.title;}); svg.call(tip); d3.select('svg').select('g').select('path').on('mouseover',tip.show).on('mouseout',tip.hide); </script> it doesn't work . how do it? you need define svg. example: var svg=d3.select('body').select('svg'); i using .select() "the way obtain selection multiple...

java - how to find a number in a range in array -

for example if enter inrange(1,6) must print {2,2,2,3,5} below array. not sure if logic right. there better way this? not sure of how construct return statement. want without using arraylist or array. public class agecount { static int[] a=new int[]{1,2,45,6,3,2,1,2,5,6,65,45,43,21,34,34}; public agecount(){ } public static int inrange(int b,int e) { int store[]=new int[a.length]; int count=0; (int = 0; < a.length; i++) { if(a[i]>b && a[i]<e) { return a[i]; } } return 0; } if method has print numbers of given range, doesn't have return : public static void inrange(int b,int e) { int count=0; system.out.print('{'); boolean first = true; (int = 0; < a.length; i++) { if(a[i]>=b && a[i]<=e) { if (!first) { system.out.print(','); ...

Python: How to store a REQUEST for input in a variable? -

i'm building text game , need store 2 things in single variable: a string, , request input . note don't mean store output of request - mean if variable called, both string , request itself printed, after user answers request. raw_input("do x or y?") therefore doesn't work me, because need store request before deploy it. some background approach: everything's stored in dictionary, keys user's current location , values possible choices: dict = {location1: (location2, location3), location2: (location1, location4)...} so, i'll print location1 , simultaneously print string describes location, , make request input . input triggers program print next appropriate location, , program keeps on going. i'm trying work out recursive function this. for each location, request input worded differently, why don't build request recursive function. sidenote: if has other suggestions/different approaches should use instead, please share too...

Path to store Inno Setup output files to (Setup-*.bin) -

how change names, extensions , locations of setup-*.bin (inno setup internal compression archive file) default archive location: {src} location want: {src}\data (data folder.) by setup-*.bin , assume refer output files resulting disk spanning . not know "inno setup internal compression archive file" is. default location inno setup output files not {src} (it wouldn't make sense) subfolder "output" under directory containing script." you can change using outputdir directive. quoting inno setup documentation : specifies "output" directory script, setup compiler place resulting setup.* files. default, creates directory named "output" under directory containing script this.

javascript - how to set a class and id to a div that don't affect each other by jquery? -

i made simple chat room. want comment have different parts use code set id , class div $('<div id="fullbox">'+inpx+'</div>').addclass('showmessage').appendto('#mainbox'); i use #fullbox have div has larger space , use .showmessage have smaller space hold text. therefor can use larger space add element later. style of id , class #fullbox{ width:1100px; margin:5px; background-color:#fff; } and class .showmessage{ width :1000 px; background-color:#03c; word-wrap:break-word; line-height :1.3 em; font-size :24 px; } my id has larger space , expect class smaller space hold text text follow id don't know how solve it. i use 2 different background color see both of them if can see both of them answer. link code : jsfiddle and want know how can have auto scrollbar automatic show new post. to fill space have set width:100% presented below. $(document).ready(function() { $('.btn').on(...