Posts

Showing posts from February, 2010

C# User control containing child -

i created user control inherits panel . goal have collection of collapsible panels. here how user control looks (no comment on ugly it's :p) i'm using main class control, 1 collection (using collectionbase ) , 3rd one, item. my problem when add item, need main control added panel. drawing looks fine, i'm not getting expected result. i'm not sure expose problem. let's in visual studio putting panel1 on form1, , panel2 + panel 3 in panel 1 the form1.designer.cs contain : form1.controls.add(panel1); panel1.controls.add(panel2); panel1.controls.add(panel3); this i'll willing do. tried create event onitemadded , subscribe in order add panel not working charm, plus trigger @ compilation, each time collection getting populated while needs done once only. i'm sorry bad english, if need clarify something, not hesitate tell me. i'm not sure part of code need, if want, ask ! thank you hints in advance ! hi terrybozzio , thank a

ios - What's the most efficient way to get a decoded CGImage from a JPEG backed CGImage? -

i surprised today jpeg backed cgimage backed calayer (i mean [[jpeg backed cgimage] backed calayer] ) slow 8mp photo felt no gpu there. i tried creating new bitmap backed cgimage drawing original cgimage cgbitmapcontext, solved speed problem somehow. brought 6xmb memory burst (from 3mb) , took 1s or drawing thing. is there way decoded image original cgimage? or other ways make jpeg backed cgimage faster, maybe tell use cache bitmap , never trash it? i switched cgdataprovidercopydata approach. little faster, still takes 0.8s on iphone 4s. start wonder what's mechanism behind calayer backed encoded source? gets slow when image shrunk , more part of image got shown. not slow 1fps when whole picture shown (actually can still 10fps).

python - TypeError when retrieving Google indexes for keywords -

we found code via google. supposed give google indexes keywords. problem works while gives error: ./g1.py size hassize traceback (most recent call last): file "./g1.py", line 22, in <module> n2 = int(gsearch(args[0]+" "+args[1])['cursor']['estimatedresultcount']) typeerror: 'nonetype' object unsubscriptable the code: #!/usr/bin/env python import math,sys import json import urllib def gsearch(searchfor): query = urllib.urlencode({'q': searchfor}) url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&%s' % query search_response = urllib.urlopen(url) search_results = search_response.read() results = json.loads(search_results) data = results['responsedata'] return data args = sys.argv[1:] m = 45000000000 if len(args) != 2: print "need 2 words arguments" exit n0 = int(gsearch(args[0])['cursor']['estimatedresultcount']) n1 = int(g

How to update the ratingbar in android -

trying update rating value obtained json rating bar i achieved updating value textvie ............ how update value json rating rating bar these classes have used mainactivity.java public class mainactivity extends activity { // declare variables jsonobject jsonobject; jsonarray jsonarray; listview listview; listviewadapter adapter; progressdialog mprogressdialog; arraylist<hashmap<string, string>> arraylist; static string name = "rank"; static string type = "country"; static string distance = "distance"; static string rating = "rating"; static string flag = "flag"; static string price= "price"; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // view listview_main.xml setcontentview(r.layout.listview_main); // locate listview in listview_main.xml list

decision tree - Features used in sci-kit learn implementation of DT -

i have implemented dt classifier cv in sci-kit learn. however, output number of features contributed classification. code have far: from collections import defaultdict import numpy np sklearn.cross_validation import cross_val_score sklearn.tree import decisiontreeclassifier scipy.sparse import csr_matrix lemma2feat = defaultdict(lambda: defaultdict(float)) # { lemma: {feat : weight}} lemma2cat = dict() features = set() open("input.csv","rb") infile: line in infile: lemma, feature, weight, tclass = line.split() lemma2feat[lemma][feature] = float(weight) lemma2cat[lemma] = int(tclass) features.add(feature) sorted_rows = sorted(lemma2feat.keys()) col2index = dict() colidx, col in enumerate(sorted(list(features))): col2index[col] = colidx dmat = np.zeros((len(sorted_rows), len(col2index.keys())), dtype = float) # popola la matrice vidx, vector in enumerate(sorted_rows): feature in lemma2feat[vector].keys():

javascript - Load Google Spreadsheet to visualize with leaflet -

my data source map based on mapbox.js hosted in spreadsheet on google drive. use geo google docs export locations geojson , leaflet.markercluster visualize them on map. i need load registers directly google drive changes reflected without exporting data. mapbox.js api has different methods fullfill none of them works me. question (a) of them preferred 1 , (b) how can make 1 work: markerlayer.loadurl() methode loads , shows geojson data can't figure out how directly access google drive file in geojson format without exporting first. i tried use jquery getjson method callback doesn't call defined function: $.getjson("https://spreadsheets.google.com/feeds/list/key/od6/public/basic?alt=json-in-script&callback=loadmarkers"); markerlayer.setgeojson() : published spreadsheet csv , used csv2geojson convert geojson similary loading csv markers example. using following code typeerror: t undefined error @ line 5 of mapbox.js. $.ajax({ url: 'htt

Which template do you edit to change doctype in Magento checkout? -

which template edit change doctype on magento checkout page? i trying implement design change using alternative package/theme mobiles using magento's html5, "iphone" template have been having problems doctypes on pages. the checkout 1 such page. try have haven't been able find template. it driving me insane. any appreciated. using magento 17.0.2 go app/design/frontend/default/yourtheme/template/page folder, edit 1-column.phtml, 2columns-left.phtml, 2columns-right.phtml , 3 columns.phtml

iphone - ios7 UINavigationBar backgroundImage is set upside down -

Image
i trying set uinavigationbar background image: i added in appdelegate: (please note it's 1 image) [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; [[uinavigationbar appearance] setbackgroundimage:[uiimage imagenamed:@"general-top_bar_with_status.png"] forbarmetrics:uibarmetricsdefault]; since don't need translucent, in viewcontroller in viewdidload added: self.navigationcontroller.navigationbar.translucent = no; this image: unfortunately get: as can see, image upsite down. what wrong? in storyboard, set place topbar - opaque navigation bar for ios 7 have use 320x64 size navigation bar image

git - Link to existing github repository -

i have created repository on github , commit changes repository using git. have project file structure (created using heroku) commited. steps required in order link existing github repo git ? in past i've used "github windows" ui create github repository, creates file structure on machine , update file structure changes recognised. but new setup little different in project exists , want link new github repoistory. you need add new remote, pointing github, , push it. steps: create repo on github. without readme, empty. in existing repo: git remote add remotename url . name remote github , example, or else want. copy url github page of repo created. push existing repo: git push remotename branchname . example if named remote github , want push master it, git push github master let me know if need else.

java - JavaFX 3D - How to set different cameras for Group with 3D object and SubScene with UI Controls? -

Image
due new features in javafx 8, became possible combine 3d objects 2d ui controls. i used documents manuals: javafx tutorial , exploring javafx 3d . so, made code: public class castanalytics extends application { final group root = new group(); final group axisgroup = new group(); final xform world = new xform(); final perspectivecamera camera = new perspectivecamera(true); final perspectivecamera subscenecamera = new perspectivecamera(false); final xform cameraxform = new xform(); final xform cameraxform2 = new xform(); final xform cameraxform3 = new xform(); final double cameradistance = 450; final xform moleculegroup = new xform(); private timeline timeline; boolean timelineplaying = false; double control_multiplier = 0.1; double shift_multiplier = 0.1; double alt_multiplier = 0.5; double mouseposx; double mouseposy; double mouseoldx; double mouseoldy; double mousedeltax; double mousedeltay;

android - can't getting data from cursor adapter -

i have listview (in activity , not in listactivity ) utilizes custom cursor adapter data local db , show them inside listview . lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> arg0, view view, int position, long id) { log.i(tag, "position = " + position); log.i(tag, "id : " + id)); } }); assume database columns following : id, name, surname, dob, height, gender, placeofbirth, maritalstatus. however, showing in listview (row.xml) name , surname. whenever user clicks on row in list, want retrieve rest of data too, example, id, or gender of row clicked. the issue that, not showing info db row in list, however, when user presses on list need retrieve of data list. how can here ? the below method not work, because not in listactivity, , activity. public void onlistitemclick(listview l, view v, int position, long id) { super.onlistitemclick(l, v, posi

java - The following classes could not be found: - ImageButton (Change to android.widget.ImageButton, Fix Build Path, Edit XML) -

the following classes not found: - imagebutton (change android.widget.imagebutton , fix build path , edit xml ) this happens when use android:src="@drawable/change_button" point selector xml file define button's state when button press or not press! *"this happens when use android:src="@drawable/change_button"* the image on surface of button defined either android:src attribute in xml element or setimageresource(int) method. so, try second method. if error persists, checkout *change_button.xml*

python - Urllib2 <urlopen error [Errno -5] No address associated with hostname> -

i have python program uses several apis, including 2 yahoo!. 1 having trouble with, however. gives me error <urlopen error [errno -5] no address associated hostname> here outputs various terminal commands try data " http://download.finance.yahoo.com/d/quotes.csv?s=goog&f=nsl1l2op&e=.csv ": my code: def stocks(): lcd.clear() lcd.message('raspi stocks\nusing yahoo!') time.sleep(2) val = 1 in stockslst: # host = urllib2.socket.gethostbyname('finance.yahoo.com') req = urllib2.request('http://download.finance.yahoo.com/d/quotes.csv?s=' + + '&f=nsl1l2op&e=.csv$ req.add_header('host:', 'finance.yahoo.com') mdata = urllib2.urlopen(req) csvdata = [row row in csv.reader(mdata)] sname = csvdata[0][0] last1 = float(csvdata[0][2]) last2 = float(csvdata[0][3]) if last1 > last2:

uinavigationcontroller - Asking for user confirmation before leaving a view in iOS -

i need show uialertview before user leaves view, either tapping 'back' navigation bar button or tapping 1 of tab items in tab bar have, in order ask him confirmation. two-button alert, 'cancel' 1 stay in view, , 'accept' 1 leave. need because have make user aware unsaved changes lost if leaving. i tried creating , showing alert view in viewwilldisappear: method: - (void)viewwilldisappear:(bool)animated { uialertview *alertview = [[uialertview alloc] initwithtitle:nslocalizedstring(@"exit", @"") message:nslocalizedstring(@"are sure want leave? changes discarded", @"") delegate:self cancelbuttontitle:nslocalizedstring(@"cancel", @"") otherbuttontitles:nslocalizedstring(@"accept", @""), ni

ios - How can I show all of objects in NSMutable Array on text field? -

i want show objects in mutable array on textfield, label, else except nslog - (ibaction)purchasepressed:(id)sender { nsmutablearray *additem = [[nsmutablearray alloc] init]; [additem addobject:@"almond"]; [additem addobject:@"choc"]; "number" label (i'm not sure of objects in mutablearray can showed on textfield or not?) can nslog. for (i = 0;i < [additem count] ; i++ ) { nslog(@"%@", additem); nsstring *test1=(@"%@", additem); number.text=test1; } every time set text of label replace previous text. try replacing whole loop like: number.text = [additem componentsjoinedbystring:@", "]; which create single string of strings in array , add label. similar in loop if want to.

How can attribute-level permissions be defined in Apache Shiro -

from docs read it's possible define attribute-level permissions (as resource , instance levels) attribute level - permission specifies attribute of instance or resource. user can edit address on ibm customer record. how can these permissions defined declaratively using <resource>:<action>:<instance> format in permissions in shiro defined? seem logical if it's possible <resource>:<action>:<instance>:<attributename> can't find docs anywhere discussing this. did check http://shiro.apache.org/permissions.html ? you can create strings own information. in our code use custom realms add permissions programmatically so: public class ourauthorizingream extends authorizingrealm { ... @override public authorizationinfo dogetauthorizationinfo(principalcollection principals) { ... code find permission infp simpleauthorizationinfo info = new simpleauthorizationinfo(); while (.. looping through permission

r - Residual errors from the klaR. Stepwise LDA -

i trying use klar package stepwise analysis on spectral data. have 400 (spectra readings) variables , 40 factors (plants). running following code subsequent error: gw<- greedy.wilks(plant ~ ., data = logged, niveau = 0.1) error in summary.manova(e2, test = "wilks") : residuals have rank 53 < 54 i thought getting error because varaible data highly correlated, hence tried log-transforming. ran same code time including qr = false . got same error. hve searched solutions , reasons error , point towards high correlations or differences in variable , factor numbers. keep variables, beacause using procedure feature selection, therefore deleting highly correlated data isn't option, unless have to. is there valid way around problem? data looks this: ` dput(str(logged)) 'data.frame': 1020 obs. of 402 variables: $ plant: factor w/ 5 levels "adpa","alal",..: 2 2 2 2 2 2 2 2 2 2 ... $ r400 : num 0.147 0.144 0.145 0.141

c# - Mono can't load ServiceStack.Interfaces.dll -

using mono on os x (mdk 3.2.3) , nuget installed according monomvc's instructions , i've tried follow the "your first webservice" tutorial in servicestack's documentation . tutorial assumes iis , visual studio, neither of exist in environment, , after several hours of searching solutions on internet i've done following steps don't mention: wrap web.config example in <configuration> tag. put source code hello classes in folder called app_code copied of .dll files nuget downloaded folder called bin with find . -iname '*.dll' -exec cp {} bin \; use xsp4 root folder of project host development server. copy system.core.dll lib/mono/4.5 project's bin folder. when try visit localhost:8080 , error message: system.web.compilation.compilationexception cs1684: reference type servicestack.servicehost.iresolver claims defined assembly servicestack.interfaces, version=3.9.60.0, culture=neutral, publickeytoken=null , n

html5 - Add vimeo style menu to video.js? -

i have simple demo page working video.js , haven't changed thing yet. have can hover on , see menu appear, way vimeo menu sharing etc. i trying work out if should done on html / css side of things, or if there funcationality in video.js add menus. quick example great if there 1 online somewhere can linked to. thanks in advance one way use video.js ready event modify dom. if inspect dom when ready event fires video.js instance, you'll notice video tag has been wrapped div , , id used has been transferred div. if have enabled controls, you'll notice video element has sibling elements in new wrapper div. these controls video.js adds. you can create additional controls, , add siblings video element (alongside ones video.js creates). so, quick example (using jquery, although done without it): var vimeomenu = '<ul id="vimeo"><li id="like"></li><li id="later"></li><li id="share&

java - How do I customise my TestSuite tests in Junit 4? -

in code below, exampletest class contains 5 tests. however, want run 2 of them exampletestsuite class using junit. public class exampletest extends testcase { private example example; public exampletest(string name) { super(name); } protected void setup() throws exception { super.setup(); example= new example(); } protected void teardown() throws exception { super.teardown(); example= null; } public void test1() { } public void test2() { } public void test3() { } public void test4() { } public void test5() { } } this code below done in junit 3, how do in junit version 4? public class exampletestsuite { public static test suite() { testsuite suite = new testsuite(exampletestsuite.class.getname()); suite.addtest(new exampletest("test1")); suite.addtest(new exampletest("test3")); return (test) suite;

css - Set form fields side-by-side using bootstrap in rails -

Image
i have rails application want form-fields side-by-side , not below. best can them side-by-side using form-inline label gets aligned left. labels should in top. want know how keep size of form fields half. code is: <div class="container"> <%= form_for '#' |f|%> <div class= "hero-unit"> <%=f.label "first name"%> <%=f.text_field '#', :class=>"span5" %> <%=f.label "last name" %> <%=f.text_field '#', :class=>"span5" %> </div> <% end %> </div> and results in: require is: please help. you need use bootstrap grid system in order achieve want. bootstrap has grid divided in 12 columns. inputs can, in same row, nested, stacked, offsetted, etc. use "row" class create horizontal columns, , predefined grid classes columns on span content. in case, you'll need row

ios - "Lazy Drawing" of UICollectionView cells -

this question isn't lazy loading of images, can no problem. have here issue each cell has complex drawing of gradients, etc, causes collectionview noticeably stutter each cell drawn (when scrolling more quickly). i'd somehow draw when scrolling or when user stops scrolling. tried doing drawing using nsoperationqueue (& cancelling when cell went off screen) worse ever. if has advice approach, i'd grateful. have tried approach building concurrent user interfaces on ios wwdc 2012 ? show similar example , explain how move drawing background thread.

batch file iterating sorted pairs slow -

i not using batch please forgive me if obvious. prefer not use make on 1 if have to. let's take if can fix instead: it goes through (only) 137 .c's in folder compares modification-date .o's , recompiles if newer. the inner for-loop name of newer file %%i variable, should not have quadratic run-time, the problem is way slow. takes 10 seconds if nothing needs recompiling, looping , sorting each pair. for %%f in (*.c) ( /f "delims=" %%i in ('dir /b /od %%~nf.o %%~nf.c ^| more +1') ( if %%i == %%~ni.c ( rem recompile file ) else ( rem skip ) ) ) but start 137 dir /b rounds each each of 137 c-files. , start new cmd context pipe. i suppose it's not best way compare file times. sort complete directory, should faster. first sort c , o files date , create variable ( cfile_<filename> ) each c-file. , each o-file clear variable. after files remaining cfile_ variables use

jquery - Bootstrap Scrollspy doesn't work -

why scrollspy doesn't work? http://jsfiddle.net/nnrew/ <div id="nav"> <ul id="menu"> <li><a href="#test">test</a></li> <li><a href="#test2">test2</a></li> </ul> </div> you should give css html element via class not id. make simpler thing. think css includes more needed thing. in addition to, have add bootstrap.min.js , bootstrap-combined.min.css. <div class="container"> <div class="row"> <div id="nav" class="span3"> <ul class="nav nav-list affix"> <li><a href="#test">test</a> </li> <li><a href="#test2">test2</a> </li> </ul> </div> <div class="span9 cont

c# - Filling the data variables in arrays of objects -

class customer { public string name; public sting nic; public int age; public void add_customer() { // code here assign values data types } } class main_menu { customer[] cust = new customer[100]; // other data members public void new_customer() { // console.writeline pritings cust[0].add_customer(); // ------>> here in line error arrising says unhandled exception of type 'system.nullreferenceexception' occurred in assignment 2.exe additional information: object reference not set instance of object. } } now want fill data variables in arrays of objects 1 one in customers instances kindly me because beginner cust[0] null trying access 1 of properties or methods before assigning value cause exception. you main misunderstanding - initializing cust didn't initialized 1 of objects in ( cust[i] null every i). you need validate before using it: class main_menu { customer[] cu

java - MediaPlayer plays double sounds on change orientation -

i have big problem app. problem when orientation changes landscape , change portrait music twice tracks plays @ same time. when start app on portrait have no problem it. package com.phone.sensor; import android.app.activity; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensormanager; import android.media.mediaplayer; import android.os.bundle; import android.view.menu; import android.widget.textview; public class sensoractivity extends activity implements sensoreventlistener{ public boolean musstatus = false; public boolean musdeclare = true; public mediaplayer mp = null; sensor accelerometer; sensormanager sm; textview acceleration; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); if(savedinstancestate == null){ if(mp != null){ mp.stop(); mp.res

Dll incompatibilites in c# -

i have c# class library contains number of dlls in assembly have updated. classes executed .exe file. recompiling calling exe tricky (not done me). following. could not load file or assembly 'xxx.xxx.xxx.xxx, version=0.3.1768.0, culture=neutral, publickeytoken=xxxxxxxx' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) does mean references used when compiling .exe different newer dlls have used in assembly classes inherit? note have kept original dlls used build .exe file. i'm curious message , i'm assuming because dlls pulled in references in references newer in directories used executable.

Creating a Lightbox Route in Ember.js -

my authentication system uses lightboxes, when user clicks "sign in" or "sign up", lightbox pops them input credentials. page on remains rendered behind lightbox, , when they're done signing in, lightbox disappears , view returns way was. can work when deviate conventional ember route flow using lot of jquery, i'd prefer integrate more tightly rest of ember app. the problem is, conventional ember route flow expects views , templates handled in particular way. specifically, route such /sign-in render sign-in template within application template, erasing whatever there before. since want preserve view there before, approach doesn't work. is there way tell ember view not erase current view, instead render independent view such lightbox? you can use named outlets , render template outlet, in aplication template has outlet called modal, , 2 actions in applicationroute, openmodal , closemodal. open 1 receives template name , uses route meth

ruby - How to refactor this code to remove output variable? -

def peel array output = [] while ! array.empty? output << array.shift mutate! array end output.flatten end i have not included mutate! method, because interested in removing output variable. mutate! call important because cannot iterate on array using each because array changing. edit: getting array output, want. method works correctly, think there way collect array.shift values without using temp variable. edit #2: ok, here mutate! method , test case: def mutate! array array.reverse! end = (1..5).to_a peel( ).should == [ 1, 5, 2, 4, 3 ] it doesn't matter if peel modifies array. guess should called peel! . yes, mutate! must called after each element removed. all reversing makes me dizzy. def peel(array) indices = array.size.times.map |i| = -i if i.odd? = i/2 end array.values_at(*indices) # indices [0, -1, 1, -2, 2] in example end = (1..5).to_a p peel(a) #=>[1, 5, 2, 4, 3]

delphi - VCL.Bitmap To FMX.Bitmap -

i found code on web, fmx.bitmap not have scanline. possible copy or draw vcl.tbitmap fmx.bitmap somehow? {$ifdef mswindows} type tbitmap = fmx.types.tbitmap; tvclbitmap = vcl.graphics.tbitmap; procedure takescreenshot(dest: fmx.types.tbitmap); var dc: hdc; size: tpointf; vclbitmap: tvclbitmap; y: integer; begin vclbitmap := nil; //size := fmx.platform.ifmxscreenservice.getscreensize; dc := getdc(0); try vclbitmap := tvclbitmap.create; vclbitmap.pixelformat := pf32bit; vclbitmap.setsize(trunc(size.x), trunc(size.y)); bitblt(vclbitmap.canvas.handle, 0, 0, vclbitmap.width, vclbitmap.height, dc, 0, 0, srccopy); dest.setsize(vclbitmap.width, vclbitmap.height); { format of fmx bitmap , 32 bit vcl bitmap same, copy scanlines. - not true- fmx bitmap not have scanline? } y := dest.height - 1 downto 0 move(vclbitmap.scanline[y]^, dest.scanline[y]^, dest.width * 4); {dest.canvas.drawbitmap(); not possible assign or draw}

ios - ScrollView not working in iOS7 with AutoLayout -

Image
today i've spend few hours still have no answer on simple (i think should so) question: how make scrollable in ios7 auto layout feature on. added scrollview view (i'm using storyboard). added multiline label scrollview. tried found in internet no luck. text not scrolling. it's killing me, guys :(((. me please maybe simple code snippet. thank you! if add constraints between scrollview , label, scrollview's content size adjust automatically , text scroll:

animation - jquery animate image stop -

how can let animation stop @ last image , let stand on last image? maybe can me stop animation. var myimages = [ "http://placekitten.com/200/200", "http://placekitten.com/150/150", "http://placekitten.com/180/180", "http://placekitten.com/170/170", "http://placekitten.com/140/150", "http://placekitten.com/160/160" ]; var counter = 1; // start @ number 2 since html tag has first function switchimage() { $('#myimage').attr('src', myimages[counter]); counter += 1; if (counter == myimages.length) { counter = 0; } } $(document).ready(function() { setinterval(switchimage, 5000); }); setinterval() returns interval id, can pass clearinterval() . var refreshintervalid; var myimages = [ "http://placekitten.com/200/200", "http://placekitten.com/150/150", "http://placekitten.com/180/180", "http://pla

tomcat7 - Block all other url's in HAPROXY -

i have couple of rules defined in haproxy acl want_server_oa path_dir serveroa acl serveroa_avail nbsrv(serveroa) ge 1 use_backend serveroa if want_server_oa serveroa_avail acl is_root hdr_dom(host) -i mydomain.com use_backend domainroot if is_root the first 3 rules setup route traffic subdomain mydomain.com/serveroa/ and next 2 rules route traffic mydomain.com/ this works expected. however, if type in mydomain.com/anypath/ it gives me tomcat 404. suspect second set of rules match , forward traffic tomcat returns 404. based on documentation, did try defining acls blocking other paths didn't quite work (configuration wasn't accepted when starting haproxy). block unless meth_get or meth_post want_server_oa block unless meth_get or meth_post is_root any appreciated. you must explicitly define items allow accessible under root "mydomain.com/" , subfolders block others. (shouldn't lot, right?) acl want_server_oa path_beg /ser

Having huge problems in assembly language Format -

i trying learn assembly language have spent dozen of hours .asm code run on intel core i5 win 7 laptop nasm. problem books of assembly code have .section,.data in it.and when compile it give error,no matter hello world rogram. program run (nasm) org 100h mov dx,string mov ah,9 int 21h mov ah,4ch int 21h string db 'hello, world!',0dh,0ah,'$' program format dont run %include "io.mac" .stack 100h .data number_prompt db "please type number (<11 digits): ",0 out_msg db "the sum of individual digits is: ",0 .udata number resb 11 .code .startup putstr number_prompt ; request input number getstr number,11 ; read input number string nwln mov ebx,number ; ebx = address of number sub dx,dx ; dx = 0 -- dl keeps sum repeat_add: mov al,[ebx] ; move digit al cmp al,0 ; if null character je done

c - Dividing a file into equal parts of 128 bytes each -

int main() { file *fe, *fs; unsigned char buffer[128]; int bytesreader; int i; char cad[100]; fe = fopen("pg2000.txt", "rb"); fseek(fe, 0l, seek_end); int x = ftell(fe); printf("%d",x); int x = ftell(fe); int result=x/128; for(i=0;i<result;i++) { bytesreader = fread(buffer, 1, 128, fe) sprintf(cad, "a%d", i); strcat(cad,".txt"); printf("%s\n", cad); fs = fopen(cad, "wb"); fwrite(buffer, 1, bytesreader, fs); fclose(fs); } fclose(fe); return 0; } i want split file equal parts of 128 bytes each, when file large access violation, don't understand... fe = fopen("pg2000.txt", "rb"); int x = ftell(fe); int result=x/128; x here zero. if fopen() suceeds. need check for. also, whozcraig points out, fclose() fs should inside loop. and this for(i=0;i=re

java - How to hide Android LinearLayout in onCreate? -

i've got android switch when turned on, expands linearlayout below it. use animation. when start screen button turned off, linearlayout shown. when turn switch on, , off again, indeed hides linearlayout, said, whenever screen starts, linearlayout shown default. know how can hide linearlayout default when screen starts? the code have follows: public class myclass extends activity implements oncheckedchangelistener { switch myswitch; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.my_layout); myswitch = (switch) findviewbyid(r.id.my_switch); myswitch.setoncheckedchangelistener(this); } @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { if (ischecked){ linearlayout view = (linearlayout) findviewbyid(r.id.view_to_expand); animation anim = expand(view, true); view.startan

Getting expected unqualified-id error with C++ when trying to complie -

i'm working on assignment class , keep getting "expected unqualified-id" "{" after defining bool types in function. can't figure out why i'm getting error , making hard assignment done without being able run program. can tell me why i'm getting error? here code //page 825 problem 12 #include <iostream> #include <string> using namespace std; //function prototype bool testpassword(char []); const int passlength = 21; char password[passlength]; int main() { //ask user enter password matching following criteria cout << "please enter password @ 6 characters long. \n" << "password must contain @ least 1 uppercase , 1 lowercase letter. \n" << "password must contain @ least 1 digit. \n" << "please enter password \n"; cin.getline (password, passlength); if (testpassword(password)) cout << "password entered of correct format , has been accepted."; else

linux - Ubuntu 13.04: Find files ending in -

can please tell me how i'm misusing find? i want find files in directory end in .config. $:~/esrc$ find . -type f ./t.config ./util/ebin/config.beam ./util/ebin/gen_spec.beam ./util/etc/util.config ./util/etc/v.config ./util/src/config.erl ./util/src/gen_spec.erl ./util/src/v.config ./util/u.config my first thought use find . -type f -name *.config unfortunately that's finding file in root directory. $:~/esrc$ find . -type f -name *.config ./t.config the same command work find *.erl files though... $:~/esrc$ find . -type f -name *.erl ./util/src/config.erl ./util/src/gen_spec.erl any clue why works *.erl not *.config? thanks. quote wild-card, i.e. find . -type f -name '*.config'

php - Pagination with Slim Framework and Laravel's Eloquent ORM -

i'm using slim framework router, twig template engine , eloquent orm handle database. i created bootstrap these libraries. <?php require_once 'vendor/autoload.php'; /** * laravel eloquent orm */ use illuminate\database\capsule\manager capsule; use illuminate\events\dispatcher; use illuminate\container\container; $database_capsule = new capsule; $database_capsule->addconnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'database', 'username' => 'username', 'password' => 'password', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ]); $database_capsule->seteventdispatcher(new dispatcher(new container)); $database_capsule->setasglobal(); $database_capsule->booteloquent(); /** * twig template engine */ twig_

c - My Do-While loop doesn't seem to loop? -

please help, cant seem do-while loop loop when ask user input continue using scanf , printf. wipe_buffer? can't seem right on , need finish loop , should functional. new coding , website please not harsh. please , thanks. #include <stdio.h> #include <stdlib.h> void wipe_buffer(void); int main(int argc, char* argv[]) { char play1; char play2; char cont; do{ printf("player 1 pick rock, paper, or scissors\n"); scanf(" %c", &play1); wipe_buffer(); printf("player 2 pick rock, paper, or scissors\n"); scanf(" %c", &play2); wipe_buffer(); switch(play1) { case 'r': if(play2 == 'p' || play2 == 'p') { printf("paper covers rock\n"); printf("player 2 wins\n"); } if(play2 == 's' || play2 ==

javascript - Scope for "this" keyword in nested function? -

hi have code looks this: var myclass = { globalvar : { total : 100 }, myfunction : { gettotal : function() { return this.globalvar.total; } }, }; // uncaught typeerror: cannot read property 'total' of undefined alert(myclass.myfunction.gettotal() ); the keyword this returns undefined , why that? because use var myclass instead of function myclass() ? thanks [edit] here's jsfiddle http://jsfiddle.net/darcfiddle/cg7fk/ this turns out myfunction it's you're saying myfunction.globalvar.total doesn't exist. you could make re-usable if wanted. function food(cost) { this.gettotal = function () { return cost + (cost * 0.05); // add 5% }; } var sandwich = new food(2.50); alert( sandwich.gettotal() ); // 2.625 http://jsfiddle.net/thetenfold/hvhxr/ there many ways make "class" (so speak) . not way, it's decent way.

Custom keypad layout in Android -

i have edittext in app user can enter decimal volume in. at moment use: edittext edittextvolume = (edittext)findviewbyid(r.id.edit_vol); edittextvolume.setinputtype(inputtype.type_class_number|inputtype.type_number_flag_decimal); to numerical keypad. there anyway can have same keypad button * or x can allow user input example 4x200 . i want 1 multiplication character (so no divide or other mathematical operators) is possible? not possible without implementing own custom keypad. however, if project requirements not strict, may use inputtype.type_class_phone . allow putting * symbol, make available several other symbols (e.g., # , + , . , , ) used in phone numbers.

javascript - Alternative to arguments.callee -

i have eventlistener listens entire document , records keystrokes, want remove listener when conditions met. the following snippet of code: document.addeventlistener('keyup', function(e) { var letter_entered = string.fromcharcode(e.keycode).tolowercase(); player.makeguess(letter_entered); if(player.win_status === true || player.lose_status === true) { document.removeeventlistener('keyup', arguments.callee, false); } }); this works, according mozilla developer docs method has been deprecated. i'm aware can name function, is there alternative allow me continue using unnamed function ? use following process: create variable assign anonymous function variable invoke variable reference the anonymous function references using variable name use such: var foo = function(e) { "use strict"; console.log(e); document.removeeventlistener('keyup', foo, false); } document.addeventl