Posts

Showing posts from September, 2010

VBscript searching value in 2d array -

i have 2d array parced xml. example of xml: <string-array name="array1"> <field name="city" type="string">moscow</field> <field name="id" type="number">10</field> (p.s. id unique within array) <field name="version" type="number">2</field> ....... </string-array> parcing it: for i=0 nodek.length-1 array1(0,i)=nodek(i).getattribute("name") array1(1,i)=nodek(i).text next so 2d array looks like: array1(0,0)="city" array1(1,0)="moscow" array1(0,1)="id" array1(1,1)=10 array1(0,2)="version" array1(1,2)=2 the task pick value id use (in sysid variable) further. following code not work properly for i=lbound(array1,1) ubound (array1,1) j=lbound(array1,2) ubound(array1,2) if j=0 if array(i,0)="id" sysid=array(i,1) msgbo...

android - What's actually meaning of SQLite cache status output by dumpsys -

i'm confused below output generated dumpsys: databases pgsz dbsz lookaside(b) cache dbname 1 3176 117 7663/1635/21 webviewcache.db 2822/16/5 (pooled # 1) webviewcache.db why list 3 items in cache column , meanings? that's appreciate comments. thanks in advance. that's clear now, though late. checked source codes , got below lines in sqlitedebug.java: /** statement cache stats: hits/misses/cachesize */ public string cache; anyway, kindly attentions.

android - layout resize on keyboard open in fullscreen mode only -

Image
i'd been trying maintain consistency in layout whether keyboard open or not. these issue generated in fullscreen mode (hiding top notification bar) only. works charm w/o fullscreen . tried: added android:softwindowmode="adjustresize" , android:softwindowmode="adjustpan" inside <activity> of manifest file. added android:isscrollablecontainer="false" inside top layout blue background having first , next , prev , last symbol. desired layout: top layout blue background should never hide whether keyboard open or not. these issue resolved actionbar requires alot of turn work don't intent to. . is there way other actionbar resolve issue? any appreciated on these. try create fixed header layout blue ground layout, , below blue layout create layout other fields inside scrollview ...so when keyboard appeared not hide header blue layout...

vba - Disable Autosave in Microsoft Access -

i newbie access , want know something. i created form , doesn't work way want to. when enter data form fields data saved automatically. want disable auto save feature , make user click save button save record because want run code when new recode added or existing record changed. a quick solution appreciated. use unbound form , create vba code save data table on on_lick event of custom save button

c++ - Pointer class variable returns NULL from muncion -

i'm developing dll (in visual studio 2013) read tiff (satellite images), using gdal library, , having issue variable data - empty (returns null). in dll have funcion defined in "rasterfuncs.h" this: namespace rasterfuncs { // class exported rasterfuncs.dll class myrasterfuncs { public: // open raster file static rasterfuncs_api int open(char* rname, gdaldataset *podataset); }; } and in dll cpp have following: namespace rasterfuncs { int myrasterfuncs::open(char* rname, gdaldataset *podataset) { podataset = (gdaldataset *) gdalopen(rname, ga_readonly); if (podataset != null) { cout << "rasterxsize 1:" << podataset->getrasterxsize() << endl; cout << "rasterysize 1:" << podataset->getrasterysize() << endl; cout << "rastercount 1:" << podataset->getrastercount() << endl...

php - replace both http and http: from url -

tried this, $url = preg_replace('!(http|http:|ftp|scp)(s)?:\/\/[a-za-z0-9.=?&-_/]+!', "<a style=text-decoration:underline;color:blue href=\"\\0\" target='_blank' >\\0</a>",$feed->feed_text)): i want replace both http , http: url. tried above 1 replacing http , not http: .but if tried 1 of in regex working.if use both in expression not replacing http: please see embeded script using, 1. <iframe frameborder="0" scrolling="no" id="chat_embed" src="http://twitch.tv/chat/embed?channel=athenelive&popout_chat=true" height="500" width="350"></iframe> ->having http:(need remove) 2. <iframe width="560" height="315" src="//www.youtube.com/embed/jxhojzlrxag" frameborder="0" allowfullscreen></iframe> ->if use http: alone in regex youtube embedded script not taken youtube url. both compatible purpo...

Tranfer excel sheet data to access table from excel vba giving error -

i'm trying tranfer excel sheet data access table. below code throws error variable not defind , pointing acimport . transferspreadsheet method works excel? alternate way there tranfer sheet data access excel. private sub cal_wem_click() dim appaccess object dim apath, adbase, adsource, atable, exepath string dim fileparam string apath = activeworkbook.path adbase = "linear.accdb" adsource = apath & "\" & adbase set appaccess = createobject("access.application") appaccess.visible = true appaccess.opencurrentdatabase adsource appaccess.docmd.transferspreadsheet transfertype:=acimport, _ tablename:="yorno", _ filename:=apath, hasfieldnames:=true, _ range:="wem!d:e", spreadsheettype:=5 appaccess.docmd.openform "input_form_wem" application.displayalerts = false thisworkbook.saved = true application.quit exit sub end sub worked out dec...

multithreading - How to run multiple instance of same program in java -

i doing final year project on speed calculation using webcam. in project want calculate speed of object taking 3 sequential images whenever motion detected. given here: raser abwehr speedcam 2012 , in 3 line red blue , green made , whenever vehicle cross it, takes 1 snap. for have idea suppose camera resolution 640*480 hence can divide x-axis in 3 parts of 210px each therefore can have 3 rectangular screens of size (210*480) . now, want whenever vehicle enters in screen1 click picture start second screen detector , when vehicle enters second screen takes second picture , @ last detect in third , click picture. hence have 3 picture , can calculate speed process given here calculating speed using webcam presently, using javacv image processing library. running multiple instance of single java program detect motion in different screen. please suggest me how can do. can thread useful here? (more comment doesn't fit) i'd suggest starting try making work tak...

c++ - No appropriate default constructor -

this learning project please give additional advice comes mind. i trying learn data structures re-implementing stl containers/algorithms , i've started linked lists. if try make list of class lacking default constructor compiler error of "no appropriate default constructor": #include "list.h" #include <list> class testa { private: int mint; public: testa(int i) : mint(i) {} }; int _tmain(int argc, _tchar* argv[]) { std::list<testa> ws; // fine ws.push_back(1); // fine mtl::list<testa> wm; // 'testa' has no appropriate default constructor wm.push_back(1); return 0; } the problem i'm using dummy node in list store link beginning , end of list. use .end() function work , give decrement-able iterator 1 past end of list. when declare empty list 1 of functions wants default constructor templated type can make dummy node! if no default constructor exists, gives error message. on positive sid...

ios - Fill view with buttons at random positions -

i want fill area ( uiview ) buttons( uibutton ) not intersect each others. my idea: create initial button @ random position in view; fill view other buttons initial button (count < 20) not intersect ~10 pixels each other. what have done far: i created method: -(void)generatebuttonsforview:(uiview *)view buttoncount:(int)count { //get size of main view float viewwidth = view.frame.size.width; float viewheight = view.frame.size.height; //set button @ random position uibutton *initialbutton = [[uibutton alloc] initwithframe:cgrectmake(arc4random() % (int)viewwidth, arc4random() % (int)viewheight, buttonwidth, buttonheight)]; [initialbutton setbackgroundimage:[uiimage imagenamed:@"button"] forstate:uicontrolstatenormal]; [view addsubview:initialbutton]; // set count 20 - max number o...

c++ - Unpack 4 bytes out of int in GLSL -

i have following vertex shader: #version 330 core struct bone { int parent; float scale; mat4 matrix; }; uniform mat4 mvp; uniform bone[67] bones; layout(location = 0) in vec3 position; layout(location = 1) in int boneindex; layout(location = 2) in vec4 weight; layout(location = 3) in vec3 normal; layout(location = 4) in vec2 uvcords; out vec2 uv; void main() { gl_position = mvp * vec4(position, 1.0f); uv = uvcords; } which fill (c++): glvertexattribpointer(0, 3, gl_float, gl_false, sizeof(vertex), (void*)0); //float position[3] glvertexattribpointer(1, 1, gl_int, gl_false, sizeof(vertex), (void*)12); //char boneindex[4] glvertexattribpointer(2, 4, gl_float, gl_false, sizeof(vertex), (void*)16); //float weights[4] glvertexattribpointer(3, 3, gl_float, gl_false, sizeof(vertex), (void*)32); //float normals[3] glvertexattribpointer(4, 2, gl_float, gl_false, sizeof(vertex), (void*)44); //float texturecords[2] the buffer object contains actual data ...

android - Can't make a reference to google-play-service lib. How can i fix it? -

i beginner in android app development, , learning how build app using google map api v2. something this: http://wptrafficanalyzer.in/blog/showing-current-location-in-google-maps-using-api-v2-with-supportmapfragment/ however, can't make reference google-play-service lib in eclipse the following steps: right click-> properties-> andriod-> library-> add google play service lib workspace it seem work (have green tick) before press ok button but when redo step 1 check , green tick become red cross how can fix it? try restarting eclipse , again , if still not work check library linking in same partition of hard drive project. have in same drive work eclipse

Using json response in PHP -

i trying use 1 object many provided in json request. trying obtain country name data given. $location = file_get_contents('http://freegeoip.net/json/'.$_server['remote_addr']); echo $location; the above code gives me following string: {"ip":"x.xx.xx.x","country_code":"fr","country_name":"france","region_code":"a2","region_name":"bretagne","city":"brest","zipcode":"","latitude":xxxx,"longitude":xxxx,"metro_code":"","area_code":""} any appreciated! $a = json_decode($location); echo $a->country_name; you might want have on this. http://www.php.net/manual/en/function.json-decode.php

ios - Suspend Particles in CAEmitterLayer -

i have following code adds particles uiview named parentview @ center of other uiview : caemitterlayer *emitterlayer = [caemitterlayer layer]; emitterlayer.emitterposition = cgpointmake(view.center.x, view.center.y - view.frame.size.height / 3); emitterlayer.emitterzposition = 10; emitterlayer.emittersize = cgsizemake(view.bounds.size.width, 0); emitterlayer.emittershape = kcaemitterlayersphere; caemittercell *emittercell = [caemittercell emittercell]; emittercell.scale = 0.1; emittercell.scalerange = 0.2; emittercell.emissionrange = 45; emittercell.lifetime = 0.75; emittercell.birthrate = 60; emittercell.velocity = 200; emittercell.velocityrange = 50; emittercell.yacceleration = 250; emittercell.contents = (id)[[uiimage imagenamed:@"particle.png"] cgimage]; emitterlayer.emittercells = [nsarray arraywithobject:emittercell]; [parentview.layer addsublayer:emitterlayer]; everything works want pause or suspend animation, particles "freeze". can done? ...

python - Most pythonic way to find the maximum elements out of list of np.array? -

i have list of np.array , mya = [a0,...,an] (all of have same shape , dtype). ai has shape ai = array[xi0,xi1,..,xim] . want get [max((a[i] in mya)) in range(m)] . example, let x=np.array([3,4,5]) , y=np.array([2,50,-1]) , z=np.array([30,0,3]) mya = [x,y,z] , want [30,50,5] (or np.array equivalent). giving m m=len(mya[0]) , code above work, seems way tedious. suggested ways achieve this? in numpy, numpy.amax(myarray) give maximum of myarray . if maximum of each list/array of first dimmension, can set axis want. in case, should be: x=np.array([3,4,5]) y=np.array([2,50,-1]) z=np.array([30,0,3]) mya = [x,y,z] maximum = np.amax(mya, axis=0) # maximum store list [maximumofx, maximumofy, maximumofz] -> [30,50,5] see docs

c++ error LNK2019: unresolved external symbol .obj -

first of all, know there on hundred similar posts out there same error, , entire reason because error given useless can be.. i've searched through on 20 solutions through google , still can't figure out error in code, therefore i'm making question. here error: error 2 error lnk1120: 1 unresolved externals c:\users\kevin cruijssen\documents\visual studio 2013\projects\clientoscpp-trunk\ cpp-and-so-client\clientoscpp\debug\clientoscpp.exe clientoscpp error 1 error lnk2019: unresolved external symbol "private: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall commandsynchandler::filejustrenamed(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?filejustrenamed@commandsynchandler@@aae?av?$basic_string@du?$char_traits@d@std@@v?$allocator@d@2@@std@@v23@@z) referenced in function "private: void __thiscall commandsynchan...

c - Programming using Structs -

i having trouble program created project.i keep receiving crash report when try print out grade , name, not sure wrong code. advice needs looked @ again appreciated. still trying pick things go. #include <stdio.h> #include <string.h> #define sl 30 // gets exam score double getscore() { double x, temp; printf("enter exam score:"); scanf("%lf", &x); if (0.0 > x || x > 100.0) { printf("\ninvaild score. please enter vaild score:"); scanf("%lf", &temp); x = temp; } return x; } // averages exam scores double getavg(double a, double b, double c) { double avg, sum; sum = + b + c; avg = (sum / 3); return avg; } // claculates grade char calcgrade(double avg) { char grade; char a, b, c, d, f; if(avg > 89.5) {grade == a; } else if (avg > 79.5) {grade == b; } else if (avg > 69.5) {grade == c; } else if(avg > 59.5) {grade == d; } else {grade == f; } return grade; } // calculates gpa double getgpa(char gr...

h:button not passing f:param from a JSF component -

i have jsf 2 page <h:button> . want pass 2 <f:param> outcome page. value of <f:param> pone comes page bean. value of <f:param> ptwo comes input field on page. ptwo's value not stored on page bean. ptwo's input field value set javascript when user clicks on image map within same page. the problem request passes null param ptwo. if set value of ptwo static value, value="12345", 12345 passed. so, why <f:param> not pass value of input field source page? thanks! <input type="text" id="ptwo"/> <h:button value="go" outcome="destpage"> <f:param name="pone" value=#{mybean.pone}"/> <f:param name="ptwo" value=#{ptwo}"/> </h:button> you cannot reference value of input field in el expression this. not if use h:inputtext . furthermore, jsf calculates link button including parameters when page rendered on s...

php - Laravel validator for nested array -

am using laravel validator class basic validation on array. my array : $employee['name']='name'; $employee['address']='address'; $employee['department']['name']='deptname'; $employee['department']['address']='deptaddress'; i have validation rules below: $rules = array( 'name'=> 'required', 'address' => 'required' ) and custom messages below : $messages = array( 'name.required' => 'employee name required', 'address.required' => 'address required' ) i use validator::make($employee, $rules, $messages); how write rule , messages $employee[department]['name'] , $employee[department]['address'] using same rules , messages variables? use dot notation nested array: department.name department.address

java - Spring Data JPA, hibernate: update all query and SET value by selecting from another table -

is following sql possible in jpa query? tried actual sql hibernate runs doesn't seem right. this sql want write jpa query; update movie m set average_rating = coalesce((select avg(stars) rating r r.movie_id = m.id), 0); this jpa query; @query("update movie m set m.averagerating = coalesce((select avg(r.stars) rating r r.movie = m), 0)") and hibernate says; hibernate: insert ht_movie select movie0_.id id movie movie0_ hibernate: update movie set average_rating=coalesce((select avg(rating1_.stars) rating rating1_ rating1_.movie_id=id), 0) ( id ) in ( select id ht_movie ) so there seems additional being added hibernate. @query("update movie m set m.averagerating = coalesce((select avg(r.stars) rating r r.movie =...

java - JavaFX getting buttons from controller to another class -

i have uicontroller class , buttonmethods class. buttonmethods class contains code button actions. need able use buttons controller class in buttonmethods class. example, have these defined in controller class buttonmethods button = new buttonmethods(); @fxml button buttonlockdown; @fxml button buttonrelease; and example, buttonlockdown has actionevent when clicked @fxml private void actionlockdown(actionevent event) { button.lockdown(); ideally, want buttonmethods this: public void lockdown() { buttonlockdown.setdisable(true); onlockdown = true; buttonrelease.setdisable(false); i can't put code action event various reasons, , putting button objects parameters messy i'm trying do. how can fxml objects button class? try send uicontroller parameter: private uicontroller thiscontroller; @override public void initialize(url url, resourcebundle rb) { thiscontroller = this; } @fxml private void actionlockdown(actionevent event) { ...

eclipse - android can't even run "Hello World" -

i want run "hello world" in android, eclipse console show: failed install hello.apk on device 'emulator-5554! (null) launch canceled! my eclipse logcat show: executing /system/bin/e2fsck failed: no such file or directory * , many more i have read many tutorial on website , follow steps: install jdk1.7.0_51 (64-bit) install android sdk 22.6.2 ( http://dl.google.com/android/installer_r22.6.2-windows.exe ) use sdk manager download api level 19 download eclipse kepler 4.3.2 (64-bit) install adt plug-in url( https://dl-ssl.google.com/android/eclipse/ ) make avd i have download adt-bundle said single download, adt bundle includes need begin developing apps. not work both 32bit , 64bit. is because of version of sdk,jdk,adt-plugin, , other not match or what? can give me set of version of sdk, jdk, adt-plugin... work, , link download it? use jdk v1.6.45 instead. can find v1.6.45 here . jdk v7 not supported android yet. also, if use android sdk...

javascript - Trying to call a method within a function -

i test not defined when calling stop() method http://jsfiddle.net/n4mkw/1766/ <span id="rotator"></span> var rotate = { quoteindex: -1, duration: 500, delay: 3000, play: true, quotes: [], init: function (quotes) { this.quotes = quotes; this.shownextquote(); }, shownextquote: function () { this.quoteindex = (this.quoteindex + 1) % this.quotes.length; if (this.play) { $("#rotator").html(this.quotes[this.quoteindex]) .fadein(this.duration) .delay(this.delay) .fadeout(this.duration, this.shownextquote.bind(this)); } }, stop: function () { this.play = false; } }; var test = rotate.init(["example1", "example2", "example3"]); test.stop(); your functions aren't returning instance of rotate object previous answer specified. however, way can fix returning instanc...

java - Java8 unsigned arithmetic -

java 8 reported have library support unsigned integers. however, there seem no articles explaining how use , how possible. some functions integer.compareunsigned easy enough find , seem 1 expect. however, fail write simple loop loops on powers of 2 within range of unsigned long. int = 0; for(long l=1; (long.compareunsigned(l, long.max_value*2) < 0) && i<100; l+=l) { system.out.println(l); i++; } produces output 1 2 4 8 ... 1152921504606846976 2305843009213693952 4611686018427387904 -9223372036854775808 0 0 0 ... 0 am missing or external libraries still required simple task? if you're referring to (long.compareunsigned(l, long.max_value*2) < 0) l reaches -9223372036854775808 unsigned 9223372036854775808 and long.max_value*2 is 18446744073709551614 so l smaller long.max_value*2 in unsigned world. assuming you're asking 0's 0 0 0 ... 0 the problem (if see way) that, long (other numerical primitives),...

How to assign value to the output of eval function in python -

i tried assign value output of eval function below: d = {"a": 10} st1 = 'd' st2 = '["a"]' eval(st1 + st2) = 15 i got error: file "<stdin>", line 1 syntaxerror: can't assign function call i tried this: x = eval(st1 + st2) x = 15 but doesn't change d dictionary. tried eval whole assignment this: eval(st1 + st2 + ' = 15') but got error: traceback (most recent call last): file "<stdin>", line 1, in <module> file "<string>", line 1 d["a"] = 15 ^ syntaxerror: invalid syntax i have tried use ast.literal_eval() function , results same. so, idea how it?? edit 1: for clarification @lennartregebro requested for, should have dictionaries specific key , value pairs. have text file user , of these values defined there , should change basic dictionaries values these user defined ones. have parser parses text file , each change, gives me tuple c...

Sum of row Depending on data in sql server -

i have table store customerid, amount , vouchartype transaction table store multiple entry single customer. vouchartype 'd' debit , 'c' credit , amount have positive value. want sum of individual customer debit value should subtract credit value. please me here 1 solution. other 'c' considered positive. might need reverse sign depending on need. select customerid, sum(case when vouchartype = 'c' -amount else amount end) amount yourtable group customerid

javascript - node.js + sequelize + query execution -

in node app using sequelize orm. in have execute 3 queries , after exxecuted have combine results json format. my queries: try { sequelize.query("select id_0, name_0, id_1, name_1 xxxx group id_0, name_0, id_1, name_1").success(function (result) { finalresult = result; }) } catch (err) { } try { sequelize.query("select yyyyyyyyyy(json datatype) value xxxxx limit 1").success(function (valueresults) { valueresults = valueresults[0].value; valueresults = json.parse(valueresults); (var prop in valueresults) { keyresult.push(prop); } }) } catch (err) { } try { sequelize.query("select country_name, level0, level1, level2, level3, level4 levels").success(function (result) { //console.log("ccccccc=" +util.inspect(levelsresult)); = result; levelsresult = result; }) } catch (err) { } i have combine 3 outputs single , have format json. when tried pri...

android - Styling Linear Layout with multi edit text -

Image
i trying make linearlayout several edittext inputting fields this: i checked several answers here make custom drawable edittext how can make whole linear layout? you can't single linearlayout . need minimum 2 linearlayout s horizontal orientation, , 1 linearlayout vertial orientation, contains two. and can set borders edittext s shape drawable s. see examples here: how draw rounded rectangle in android ui?

Connect my android app to MySQL using ODBC and ASP -

i'm trying connect android app existing mysql database being used in asp website. couldn't find way that. any appreciated. thanks! generate json data need, asp code, , read json on android.

javascript - ng-pattern wrong or not doesn't allow tooltip to be triggered -

i'm using ng-pattern="/^[0-9]{9}$/" in input field render follow: <input type="text" id="company_taxid" ng-model="company.taxid" required="required" class="input ng-scope ng-valid-maxlength ng-valid-minlength ng-dirty ng-valid-required ng-invalid ng-invalid-pattern" style="width:485px;" ng-minlength="9" maxlength="9" ng-maxlength="9" ng-pattern="/^[0-9]{9}$/" placeholder="ej: 458965879" tooltip="ej: 458965879" wv-def="ej: 458965879" tooltip-trigger="focus" tooltip-placement="right" wv-cur="" wv-err="este valor debería ser un número válido." wv-req="este campo es requerido" wv-min="este valor debería tener exactamente 9 caracteres" wv-max="este valor debería tener exactamen...

Convert string to int array in powershell -

i'm trying convert string looks this 2,3,4,5,6,20..30 to array of integers. here code have: [string]$a = "2,3,4,5,6,7" [array]$b = $a.split(",") [array]$c = foreach($number in $b) {([int]::parse($number))} which works, not range of 20..30. how part working? you can use invoke-expression cmdlet interpret 10..30 bit, if [int]::parse() method call fails. here complete, working sample. [string]$a = "2,3,4,5,6,7,10..30"; [array]$b = $a.split(","); [array]$c = foreach($number in $b) { try { [int]::parse($number) } catch { invoke-expression -command $number; } } $c;

sockets - Windows machine can not be TCP server but can be TCP client, -

i have windows8.1 machine. write basic tcp server , client python program , try connect using 2 computers , b. when computer treated tcp server, b can not connect it. when client can connect b server. tried use them echo server , client in computer server , client can connected. sure used correct ip address , in same lan. have kind of problem before, pls help.

Get shortcut key failed with "Alt + num" in PretranslateMsg in MFC? -

i want preprocess keyboard message in pretranslatemsg in mfc. write following code. if( pmsg->message == wm_keyup ) { if( getkeystate(vk_control) || getkeystate(vk_shift) || getkeystate(vk_menu) ) { cstring cskey = translatekeytostring( getkeystate(vk_control) & 0x8000 ,getkeystate(vk_shift) & 0x8000, getkeystate(vk_menu)&0x8000, pmsg->wparam ); doworkforacceleratorkey(cskey); return true; } } with above code. can successfull shotcut in "cskey" "ctrl+alt+1" , "ctrl+1" can't "alt+1", when press alt+1, cskey strange single character. happens "alt+1", , how solve problem? thank you. you don't wm_keyup message 1 . alt key, entered characters used in different way. instead of wm_keyup, receive wm_syskeyup. wm_keyup receive should have nvirtkey code of vk_menu. this messages captured spy++ ...

java - How can I effectively use floats in equals()? -

i have following immutable hsl class use represent colour , aide in calculations on rgba colours little more finesse. public class hsl { protected final float hue; protected final float saturation; protected final float lightness; public hsl(float hue, float saturation, float lightness) { this.hue = hue; this.saturation = saturation; this.lightness = lightness; } // [snip] removed calculation helper functions @override public string tostring() { return "hsl(" + hue + ", " + saturation + ", " + lightness + ")"; } @override public int hashcode() { return 37 * float.floattointbits(hue) + 37 * float.floattointbits(saturation) + 37 * float.floattointbits(lightness); } @override public boolean equals(object o) { if (o == null || !(o instanceof hsl)) { return false; } hsl hsl = (hsl)o; // we're worried 4 decimal places of accuracy. that's mo...

Looping over the parameters of a defined function in C++ -

i rather beginner in c++ , don't know how solve following issue. have working code find root of function using brent method. issue interested in how loop on different values of parameters of function, assuming same specification. here simpler example. call function call defined function afunction. #include <stdio.h> #include <math.h> double x1,x2,res,r; // simple function double afunction(double x) { return ((x)+2); } // second function call first 1 double addf( double x1, double x2, double *res ) { double result=afunction(x1)+afunction(x2); return (result); } int main() { x1=1.0; x2=2.0; r=afunction(x1,x2,&res); } what interested in loop on parameter(s) of defined function, considering fact have afunction depending on x. is, consider function defined below: // simple function double afunction(double x) { return ((x)+a); } i want repeatedly call afunction different values of can stored in vector. if mean loopin...

How to list next 24 months' start dates with python? -

please tell me how can list next 24 months' start dates python, such as: 01may2014 01june2014 . . . 01aug2015 and on i tried: import datetime this_month_start = datetime.datetime.now().replace(day=1) in xrange(24): print (this_month_start + i*datetime.timedelta(40)).replace(day=1) but skips months. just increment month value; used datetime.date() types here that's more enough: current = datetime.date.today().replace(day=1) in xrange(24): new_month = current.month % 12 + 1 new_year = current.year + current.month // 12 current = current.replace(month=new_month, year=new_year) print current the new month calculation picks next month based on last calculated month, , year incremented every time previous month reached december. by manipulating current object, simplify calculations; can i offset well, calculation gets little more complicated. it'll work datetime.datetime() too.

shutil - Python error: path is not recognized as an internal or external command, operable program or batch file -

import sys import os import shutil def main(argv): if len(argv) < 3: print("to few arguments") return 1 dir = os.path.dirname(__file__) latencymonitordir = argv[1] feedmanagerdir = argv[2] if not os.path.exists(dir + r"\data"): os.makedirs(dir + r"\data") if not os.path.exists(dir + r"\data\result"): os.makedirs(dir + r"\data\result") scriptcommand = "\"" + dir + "\\script.py\" " + latencymonitordir os.system(scriptcommand) if not os.path.isfile("\"" + dir + "\\data\\boostedfeedmanager.exe\""): shutil.copy(feedmanagerdir + r"\boostedfeedmanager.exe", dir + "\data") scriptcommand = "\"" + dir + "\\data\\boostedfeedmanager.exe\" " + "\"" + dir + "\\data\\configinstruments.json\"" print("debug") ...

escaping - Escape comment character (#) in git commit message -

this question has answer here: start git commit message hashmark (#) 8 answers i have set mcedit editor git commit messages. default ignores lines starting # character. odd may seem, need able have commit message looking this: #foo-123: implement bar foo committing work in progress the #foo-123: ... key + title of issue in our tracker. tracker can automatically pick these commit messages , add them issue. unfortunately, first line gets treated comment , gets ignored. i don't want have committing command line adding -m it's inconvenient/ugly when have multiple lines. how work around this? you can try , define different character comments in commit message: git config core.commentchar <another char> as mention in " start git commit message hashmark ( # ) ", setting available since git 1.8.2 (february 2013). in case: ...

pointers - Errors in C gradebook -

i attempting code gradebook in c. however, inexperience in handling pointers, getting strange values when printing values console. code listed below: # include <stdio.h> # include <stdlib.h> # include <string.h> int main(int agrc,char * argv[]) { // create null pointers char * students = 0; char * grades = 0; int * namelen = 0; // variable track class size int classsize = 0; printf("please enter class size: "); scanf("%d",&classsize); printf("class size = %d\n",classsize); // allocate memory null pointers students = malloc(classsize * sizeof(char)+classsize); grades = malloc(classsize * sizeof(int)); namelen = malloc(classsize * sizeof(int)); int = 0; char * tmp; int pos = 0; for(;i<classsize;i++) { printf("please enter student %d's name: ",i+1); // read name dummy variable scanf("%s",tmp); // store length of name *(namelen + i) = strlen(tmp); // read in name of ...

c# - How do I create a box for the user to enter their post code? -

i creating windows application in visual studio using c#. i want create textbox user type post code. programme needs able verrify valid entry has been entered. i new programming , have tried searching google got more confused. this method have used validate british postcode... (note: validate using 3rd party api now) private bool ispostcode(string text) { var nospace = text.replace(" ", string.empty); if (nospace.length < 6) { return false; } char[] chars = text.tochararray(); if (chars[0] < 'a' || chars[0] > 'z') { return false; } if (chars[1] < 'a' || chars[1] > 'z') { return false; } if (chars[2] < '0' || chars[2] > '9') { return false; } ...

How do you select a rectangular block of numbers in the Joe editor? -

i'm using joe editor ( http://joe-editor.sourceforge.net/index.html ) , want know how select rectangular block of numbers. know how select text ^kb , ^kk when column of numbers, selects entire row. image of i'm talking please see http://joe-editor.sourceforge.net/elaborate.gif , @ bottom of image in 'size' column. my goal perform joe commands on column of numbers such sum, cnt, avg, dev ( http://joe-editor.sourceforge.net/list.html ). to select rectangle block: switch 'rectangle mode' ^tx. mark top left corner of block ot ^kb. use arrow keys navigate lower right corner of block. mark lower right corner ^kk. selected block can used math functions. to sum selected rectangle block: enter math mode esc m. type =sum . result displayed in bottom left corner.

output - Saving the current seed in a Fortran random number sequence -

i using intrinsic function rand() generate random numbers. initialized sequence defined seed, want able output current seed rand() using @ point in loop. by doing this, should able "continue" sequence of random numbers in new program. from have seen online, there no way random number generator associated rand() , srand() functions. true? can suggest different method (perhaps, random_number() ?). rand , srand not standard fortran functions. expect compiler documentation can tell how best use them. fortran standard defines subroutine random_seed 3 optional arguments (named save , put , get ). put , get setting , getting random seed. save can used return size of integer array used hold seed prng. generator can called standard routine random_number .

php - Laravel : Method [show] does not exist -

when trying access url 'users/login' got error, here code : view users/login.blade.php : <head>sign in : </head> <body> {{ html::ul($errors->all()) }} <?php echo form::open(array('url' => 'users')); echo '<div class="form-group">'; echo form::label('username', 'user name'); echo form::text('ausername', null, array('class' => 'form-control')); echo '</div>'; echo '<div class="form-group">'; echo form::label('password', 'password'); echo form::password('apassword', null, array('class' => 'form-control')); echo '</div>'; echo form::submit('sign in', array('class' => 'btn btn-primary')); echo form::close(); ?> </body> controller usercontroller.php <?php class usercontroller extends basecontroller { publ...

VB6 and VB.NET interoperability using com.visible -

please see code below: imports system.runtime.interopservices public class testclass <comvisible(true)> _ public function hello() string return "hello ian" end function public function goodbye() string return "goodbye ian" end function end class i have created type library using regasm , have added reference tlb in vb6 project. code vb6 below: private sub form_load() dim tc testclass set tc = new testlibrary.testclass msgbox (tc.hello) msgbox (tc.goodbye) end sub i not understand why message prints value of: tc.goodbye not visible. i believe because default value true. there way set default value false.

Java OOP-Accessing the last element in an array of objects -

i practicing object orientation here entering in basketball player names , how many points scored , rebounds grabbed. how go through each element in array of objects find last player amount of points? this code have far enter information. need in second forloop examine each element , display last element fits criteria? class basketballobj { public static void main (string[]args) { basketball bbarray[]; string thename; int thepoints; int therebounds; int index; int noofelements = 0; bbarray = new basketball[3]; for(index = 0; index < bbarray.length; index++) { system.out.println("enter name "); thename = easyin.getstring(); system.out.println("enter points scored "); thepoints = easyin.getint(); system.out.println("enter rebounds grabbed "); therebounds = easyin.get...

git - Can I combine my local Github repository with WAMP localhost folder? -

i have c:\users\my\documents\github local github repository, , c:\wamp\www work on projects locally wampserver. what appropriate setup work them both? should tell git use 'www' local repository? combine localhost github?? you use --work-tree or --git-dir argument of git in order to: be in github folder, mention working tree www cd c:\users\my\documents\github git --work-tree=c:\wamp\www status or in www folder , mention git repo in github one cd c:\wamp\www status git --git-dir=c:\users\my\documents\github\.git the other approach have git repo in both, , pulling github www . cd c:\wamp\www status git add remote origin c:\users\my\documents\github git pull origin master

javascript - Add contents to an empty frame -

i have empty frame in page, src set '' (empty). have string this: <html> <head> <base src="http://www.example.com"> <title>blah</title> </head> <body> <p>fancy web page</p> </body> </html> i populate iframe string, exact content of matches string. what's best way this? going insane trying it. you need set id on iframe , set innerhtml of iframe's document body , head head/body string values. here's working fiddle: http://jsfiddle.net/theoutlander/dw3r7/1/ <iframe id=testframe></iframe> var strhead = '<base src="http://www.example.com"><title>blah</title>' var strbody = '<p>fancy web page</p>'; testframe.document.head.innerhtml = strhead; testframe.document.body.innerhtml = strbody;

php - Issue with Countifs in PHPExcel when generating a PDF -

i have problem phpexcel , can’t seem find solution fix it. wrote script based on basic examples provided in phpexcel documentation create pdf file out of xlsx file code looks this: $inputfile = “test.xlsx”; $objreader = phpexcel_iofactory::createreaderforfile($inputfile); $objreader->setreaddataonly(true); $objphpexcel = $objreader->load($inputfile); […] $objwriter = new phpexcel_writer_pdf($objphpexcel); $objwriter->setsheetindex(0); $objwriter->setprecalculateformulas(true); $objwriter->save("test.pdf"); the pdf writer library using dompdf. problem code above return me error when try create pdf specific file working on. fatal error: uncaught exception 'phpexcel_calculation_exception' message 'sheet!c5 -> formula error: wrong number of arguments countifs() function: 4 given, 2 expected' in d:\xampp\htdocs\doc\phpxls\classes\phpexcel\cell.php:300 stack trace: #0 d:\xampp\htdocs\doc\phpxls\classes\phpexcel\writer\html.php(1174): p...