Posts

Showing posts from September, 2010

javascript - Create pop-up thank you message on form submit -

i added e-mail sign-up form landing page , works fine (using firebase back-end btw). however, i'd either redirect "thankyou.html " page or have pop-up thank message appear upon submit. how can make work? know pretty easy, i'm novice. here's code i'm using. included script in html: `<script> var signupform = document.getelementbyid('signup-form'); var signupsuccess = document.getelementbyid('signup-success'); var signuperror = document.getelementbyid('signup-error'); var signupbtn = document.getelementbyid('signup-button'); var onsignupcomplete = function(error) { signupbtn.disabled = false; if (error) { signuperror.innerhtml = 'sorry. not signup.'; } else { signupsuccess.innerhtml = 'thanks signing up!'; // hide form signupform.style.display = 'none'; } }; function signup(formobj) { // store emails firebase var myfirebaseref = new firebase("https:...

javascript - jquery datatable gives error when rendering -

i'm trying fill jquery datatable data via ajax: html <table id="table-productmaterials"> <thead> <tr> <th>id</th> <th>name</th> <th>quantity</th> <th>status</th> </tr> </thead> </table> javascript $(document).ready(function () { var options = { "processing": true, "ajax": { "url": "productmaterials.ashx?action=get", "type": "post", "data": { "productid": $('#product_id').val() }, "columns": [ { "data": "id" }, { "data": "materialname" }, { "data": "quantity" }, { ...

PHP username (number) generator -

i need , php script making usernames in numbers not lower 1000. there numbers. every time new user fill in registration form, script looks @ highest username number + 1. there new number. who can me? you can have variable like: usercount and assign every new user id: ++usercount p.s. haven't used php in looong while, might've said crap.

excel - Can You Embed an AND Statement Within an OR Statement? -

Image
alright, have idea, not sure if there way accomplish this. starting equation: =if(or(arrayformula(sum(countif(b7:o7,{"i","a","x","r","k","e","al","ffsl","adm*"})))=10),"80 hours","error") i embed , statement within same if statement, if @ possible. instance, equation above checks possible 8 hours shifts. if there 10 of them employee schedule work 80 hours. next need check combination of 4 ten hour shifts , 5 8 hour shifts. need continue checking other possible combinations employee 80 hours. i know equation below not work, trying similar to. =if(or(arrayformula(sum(countif(b7:o7,{"i","a","x","r","k","e","al","ffsl","adm*"})))=10,(arrayformula(sum(countif(b7:o7,{"r-10","i-10","x-10","a-10"})))=4,and(arrayformula(sum(countif(b7:o7,{"i...

Java - repetitive hmacSHA1 hashing - how to convert to PHP? -

how convert following java php? byte[] bytearray1 = key1.getbytes("utf8"); byte[] bytearray2 = key2.getbytes("utf8"); byte[] bytearray3 = key3.getbytes("utf8"); byte[] bytearray4 = key4.getbytes("utf8"); mac mac = mac.getinstance("hmacsha1"); secretkeyspec derivedkey = new secretkeyspec(bytearray1, "hmacsha1"); mac.init(derivedkey); derivedkey = new secretkeyspec(mac.dofinal(bytearray2), "hmacsha1"); } mac.init(derivedkey); derivedkey = new secretkeyspec(mac.dofinal(bytearray3), "hmacsha1"); mac.init(derivedkey); derivedkey = new secretkeyspec(mac.dofinal(bytearray4), "hmacsha1"); from research i've done, looks if we'd remove last 2 lines , neatly convert php follows: hash_hmac("sha1", $key2, $key1, true); however, how convert type of reiterative hashing php? note: i've tried following unsuccessfully: $derivedkey = hash_hmac("sha1", $key2, $key1, tr...

Converting Pointers in C to C# -

i need convert c uses pointers c#. essentiay given buffer of unformated data , need treat if if formatted. read froma file may not come emmbedded c application running different hardware. in example need treat array of long. i c take create pointe long , cast address of buffer. but in c# not alowed take address of managed object , wont let me cast byte[] long[] so how in c# void testfunction(void) { char buffer[256]; printbufferaslongpointer(buffer); printbufferaslongarray(buffer); } void printbufferaslongpointer(char *buffer) { long *ptr = (long*)buffer; for(int count = 0; count < 64; count++) { printf(" %x", *ptr++); } } void printbufferaslongarray(char *buffer) { for(int index = 0; index < 64; index++) { printf(" %x", buffer[index]); } } you can still use pointers in c# if you're careful (and enable 'unsafe code' in project options): private static unsafe void p...

ios - Why does UITableView Header (and only header) shift down 60 pts -

i had issue drove me crazy , turned out bizarre solution thought i'd post in hopes helps else i had table view manually showing refresh control , offsetting tableview. reason, seeing instances of first section header shoved down 60 pts (and tableview well, not until scrolled around). tried offsets , insets , frames , bounds of table view, no luck. turns out if try set refreshcontrol.attributedtitle this. removed line , worked. don't set attributedtitle of tableview's refreshcontrol , should stop seeing vertical shift

java - Scanner is skipping nextLine() after using next(), nextInt() or other nextFoo()? -

i using scanner methods nextint() , nextline() reading input. basically, looks this: system.out.println("enter numerical value"); int option; option = input.nextint();//read numerical value input system.out.println("enter 1st string"); string string1 = input.nextline();//read 1st string (this skipped) system.out.println("enter 2nd string"); string string2 = input.nextline();//read 2nd string (this appears right after reading numerical value) the problem after entering numerical value, first input.nextline() skipped , second input.nextline() executed, output looks this: enter numerical value 3 //this input enter 1st string //the program supposed stop here , wait input, skipped enter 2nd string //and line executed , waits input i tested application , looks problem lies in using input.nextint() . if delete it, both string1 = input.nextline() , string2 = input.nextline() executed want them be. that's because scanner...

css - In HTML, 5 inline images with "width:20%" each don't add up to 100% device width on IPad -

when create 5 or more inline placed images , set width each 1 total amount 100%, total width little less 100%. the strange thing if place 1, 2, 3 or 4 images in exact same manner, total width 100%. also, problem happens on ipad (both default safari , chrome browsers), doesn't happen on android mobile (chrome or default) , desktop (chrome) far tested. here link screenshot of i'm talking about. note 5 upper images set width 20% each, , bottom 4 images set width 25% each. http://s11.postimg.org/5fnut3agi/image.jpg here complete html file. know it's not proper html should like, i'm beginner, don't judge :) <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="jquery-2.1.3.min.js"></script> <script type='application/javascript' src='fastclick.js'></script...

delphi - Reading TValue from TRttiProperty fails (Property Type: set of Byte) -

i defined type set of byte, interface , class implements interface. interface has property of type ttestsetofbyte + getter , setter. nothing special @ all. type ttestsetofbyte = set of byte; itestinterface = interface ['{bcf0cec2-f999-4e8a-a732-416f343c1629}'] function getpropsetofbyte: ttestsetofbyte; procedure setpropsetofbyte(const value: ttestsetofbyte); property propsetofbyte: ttestsetofbyte read getpropsetofbyte write setpropsetofbyte; end; ttestclass3 = class(tinterfacedobject, itestinterface) private fsetofbyte: ttestsetofbyte; function getpropsetofbyte: ttestsetofbyte; procedure setpropsetofbyte(const value: ttestsetofbyte); public constructor create; property propsetofbyte: ttestsetofbyte read getpropsetofbyte write setpropsetofbyte; end; the problem when try read value of propsetofbyte property delphi throws eaccessviolation , not understand why. properties of other types(int, string) work fine. here test...

java - Running different methods within an object depending on the 'type' of object -

i'm trying manage power-ups in game. lets have 7 'platforms' in game , want randomly spawn power-up max of 1 per platform (this vertically scrolling 'infinite' type game). so, have 5 different power-ups , (where powerup valid class) - '7' being passed constructor here number of sprites in individual objects (ie, batches of sprites) - 7 can place 1 on each platform , turn them on , off required (i have 'drawable' boolean array allows me individual sprites in batch). powerup powerup1 = new powerup(7); powerup powerup2 = new powerup(7); powerup powerup3 = new powerup(7); powerup powerup4 = new powerup(7); powerup powerup5 = new powerup(7); i add them list of objects drawn: powerupslist.add(powerup1); //etc... i can so: (for int = 0; < powerupslist.size();i++){ if (powerupslist.get(i).hasbeencollected(); powerupslist.get(i).runpowerup(); //carry out specific code powerup if has been activated } the issue have i...

php - Ajax behaving differently on Firefox -

i trying check progress of file download. this, repeatedly polling php file(progress_sess.php) echoing session value being changed in file handling download (export.php). there 1 ajax request export.php , multiple ajax requests progress_sess.php. way able display phase file download script in. working out in chromium. clear requests, can see image here: - chromium requests . in firefox error thrown: - json.parse: unexpected end of data @ line 1 column 1 of json data you can see request here: - firefox requests when echo xhr.responsetext in firefox, gives this: - "" this possibly because in chromium can see in image, requests application/json, specified in progress_sess.php header, whereas in firefox first request inexplicable reason text/plain?! not understand why firefox getting text/plain response header. you can see progress_sess.php: - <?php session_id($_cookie['phpmyadmin']); session_start(); header("content-type: applicatio...

c++ - avoiding template definition in header file -

this question has answer here: why can templates implemented in header file? 13 answers i have following class defined in header a.h : class { private: template<int i> void method(); }; is there way me keep implementation of method in own a.cpp file , usual method implementations ? i'm asking because puting implementation in a.h make interface hard read, since it's private function. it ever instanciated limited values of "i" if matters you can following (as it's used practice): a.hpp class { private: template<int i> void method(); }; #include "a.tcc" a.tcc template<int i> void a::method() { // } note it's important name implementation file different extension .cpp actually, because confuse of standard build system environments (unless have complete manual selection of tra...

scala - Cannot compile Spark Streaming example: getting updateStateByKey is not a member of org.apache.spark.streaming.dstream.DStream error -

i want understand spark streaming better copied statefulnetworkwordcount.scala example in own directory, , pasted as-is , created simple sbt config file, , tried compile doesnt seem work. why complaining api? idea? original example compile fine, want change it, without having compile whole spark directory set default. thanks! matt $ more build.sbt name := "simple project" version := "1.0" scalaversion := "2.10.4" librarydependencies += "org.apache.spark" %% "spark-core" % "1.2.1" librarydependencies += "org.apache.spark" % "spark-streaming_2.10" % "1.2.1" urbanlegends-2:streamingtest mlieber$ the error: urbanlegends-2:streamingtest mlieber$sbt package [info] set current project simple project (in build file:/users/mlieber/app/spark2/spark/examples/lieber/streamingtest/) [info] compiling 2 scala sources /users/mlieber/app/spark2/spark/examples/lieber/streamingtest/target/scala-2.10...

python - urllib2.Request Keeps Downloading Cached File From Proxy -

i've got python 2.7 script downloads zip file public ftp site through our corporate proxy. proxy set in windows server's system variables. downloading file works, except discovered it's continually downloading same version of file though file begin updated on ftp site. appears grabbing cached version proxy, not current version on web. here's code file: request = urllib2.request(download_url) response = urllib2.urlopen(request).read() how can force script current file through proxy, instead of cached one? you try url ?foo=bar appended.

python - Making a copy of a list -

i'm trying make "target", copy of "grid." don't see why code not work. grid = [[randint(0, 1), randint(0, 1), randint(0, 1)], [randint(0, 1), randint(0, 1), randint(0, 1)], [randint(0, 1), randint(0, 1), randint(0, 1)]] target = [[0, 0, 0]] * 3 x in range(3): y in range(3): target[x][y] = grid[x][y] print target print grid here's result: [[0, 1, 0], [0, 1, 0], [0, 1, 0]] [[1, 0, 0], [0, 1, 1], [0, 1, 0]] this part: target = [[0, 0, 0]] * 3 creates list same list repeated 3 times. changes 1 item reflects in (they same object). want create list 3 times: target = [[0, 0, 0] _ in range(3)] you should use star operator on list (or list multiplication) immutable objects (if @ all), not have problem since can't change states. don't forget can use ( x[:] used create shallow copy of list named x , list(x) ): grid = [x[:] x in target] or more copy.deepcopy : from copy import deepcopy grid ...

How to check this condition with enums - C++ -

class direction class direction { public: enum value { up, right, down, left, stay }; }; class point #include "direction.h" class point { int x , y; public: point() { x=0; y=0; }; point(int x1 , int y1) : x(x1) , y(y1) {}; void setx(int newx) { x = newx; }; void sety(int newy) { y = newy; }; int getx() { return x; } int gety() { return y; } void move(direction d) { if(d==up); }; the problem if(d==up) don't understand how can check condition receive error checking this. any ideas? appreciated. up declared inside class direction , outside scope should write direction::up refer it: if (...something... == direction::up) ... your direction class creates value enumeration type, doesn't have data members yet, it's not clear in d might want compare direction::up . add data member inserting line before final }; ...

powershell trim - remove all characters after a string -

what command remove after string (\test.something). have information in text file, after string there 1000 lines of text don't want. how can remove after , including string. this have - not working. thank much. $file = get-item "c:\temp\test.txt" (get-content $file) | foreach {$_.trimend("\test.something\")} | set-content $file why remove after? keep (i'm going use 2 lines readability can combine single command): $text = ( get-content test.txt | out-string ).trim() #note v3 can use get-content test.txt -raw $text.substring(0,$text.indexof('\test.something\')) | set-content file2.txt also, may not need trim using trimend added in case want add later. )

etag - Wininet not caching compressed content -

i have compressed resource when viewed in ie, loads cache expected. when application loads same url, wininet ignores cache , downloads content server. dynamic content compression disabled on iis, application behaves same ie (the http includes if-none-match header.) what can app behave same ie? _httpclient = new httpclient(new webrequesthandler { cachepolicy = new httprequestcachepolicy(httprequestcachelevel.default), automaticdecompression = decompressionmethods.deflate | decompressionmethods.gzip }); using (task<httpresponsemessage> tget = _httpclient.getasync(uri, httpcompletionoption.responseheadersread, _cancel)) { tget.wait(); response = tget.result; } the http headers application's get: get https://beautykiosktest.coinstar.com/conductor/configuration/files/promos.xml?kioskid=eng20130027 http/1.1 accept: */* accept-language: en-us user-agent: configurationservice/2.3.0.0 host: beautykiosktest.coinstar.com accept-encoding: gzip, deflate htt...

c++ - CUDA: Can allocate matrix once use in multi kernel? -

i have question is: if allocate 1 matrix 2d , memcpy gpu , have 2 kernel using same matrix, possible using don't memcpy matrix again kernel 2? , if auto memcpy matrix again kernel 2, take time auto memcpy again ? you don't need transfer data host device twice, if want use in 2 kernels. once transfer it, in gpu memory , stay there until program terminates (or explicitly deallocate using e.g. cudafree ). just pass pointer region/matrix both kernels. if first kernel modifies data , second kernel runs later (after first kernel finishes), second kernel see modified data.

How can i use Telerik Asp.net ajax RadEditor in MVC5 Razor Project -

i have mvc5 project , want use telerik asp.net ajax radeditor . have doubled checked control aspx projects. but.i got 1 project in there used 1 mvc project , in there call 1 .aspx partial page radeditor displaying nice not working document management functionality download project here . , replace radeditor code. can use in mvc5? if yes give me solution if possible. awaiting response. i don't think can, , documentation says well: http://www.telerik.com/help/aspnet-ajax/mvc-integration-with-telerik-ui-for-aspnet-ajax.html perhaps webforms page in project, or iframe points webforms page editor serve need. the problem mvc not offer lifecycle webforms controls need, , document manager functionality uses lot of server code. asp.net mvc plaform different.

javascript - Making my Jpeg Downloadable -

this question has answer here: force browser save file after clicking link [duplicate] 2 answers i trying file, in image folder, become downloadable. have linked in site as <a href="images/resume.jpg" download> resume</a> i have edited this, still not working in internet explorer, therefore can have option available internet explorer well. it's simple jpeg. when clicked, opens page , picture appears. want downloaded moment it's clicked. not open in page right clicked saved. can java script download attribute isn't supported in internet explorer. current knowledge - hmtl5/css/ javascript. it should this: <a href="images/resume.jpg" download="resume.doc">resume</a> you missing location. unless name of file trying download "resume" , in same location page being displayed. f...

python - Pygame Updating Levels Without Overlap -

in library pygame, trying program game. in game, if collide goal rectangle, move onto new level. works when collide goal rectangle, draws new level on top of old level. want clear screen, , draw level. how this? here code: import os, random, pygame, eztext time import * speed = 1 gravitynum = 1 gravity = true keydown = true rightnum = 0 running = true pygame.init() white = (255, 255, 255) screen = pygame.display.set_mode((880, 400)) class player(object): def __init__(self): self.rect = pygame.rect(16, 368, 16, 16) self.level = 1 def move(self, dx, dy): if dx != 0: self.move2(dx, 0) if dy != 0: self.move2(0, dy) def move2(self, dx, dy): self.rect.x += dx self.rect.y += dy wall in walls: if self.rect.colliderect(wall.rect): if dx > 0: self.rect.right = wall.rect.left if dx < 0: self.rect.left = wall.re...

ios - Swift: Properly initialize and access my classes in an array -

this swift playground; want collect 'task' class instances in array each task's properties can used in tableview. i'm searching documentation don't see discussion of how initialize , access classes in array. the last line of code gives error reads anyobject not have member named deadline . it's same whether use swift array of anyobjects, or empty nsmutablearray. tried various ways of casting integer, insists on error. going wrong way store , access data? i'm javascript-brained, similarity of syntax leads me delusions. import uikit let todays_date = nsdate() // let cal = nscalendar.currentcalendar() let day_number = cal.ordinalityofunit(.calendarunitday, inunit: .calendarunityear, fordate: todays_date) var tasks = [] nsmutablearray class task { var title: string var interval: int var dateactivated: int var deadline: int var flag_count: int = 0 var isactivated: bool = false init(title: string, dateactivated: int, ...

Flask Bug on Python 3.4? Development server can't run if app contains relative imports -

by design, python 3 cannot run module contains relative imports script. attempting yields following error: $ python mypackage/run.py [...traceback...] systemerror: parent module '' not loaded, cannot perform relative import the solution invoke module python -m mypackage.run instead of more familiar python mypackage/run.py . in flask, latter how 1 runs development server. however, flask development server spawns child process reloads code (and subsequently reloads code when files changed on disk). the result this: $ python -m mypackage.run * running on http://127.0.0.1:5000/ * restarting reloader [...traceback...] systemerror: parent module '' not loaded, cannot perform relative import so server starts properly, child process reloads code improperly. this due way reloader works. tends mess python path if you're doing in unexpected ways, such calling inner module directly run app. move run.py out of project completely. useful in devel...

php - How find Row Number of Value within Array? -

i've saved data array, , want 'name' of supplied 'code'. how array row of code? also, efficient process? id | code | name | __________________________ 1 | knty | kentucky | 2 | purd | purdue | 3 | texs | texas | // move data array $search = "select * table"; $query = mysqli_query($conn, $search); while($row = mysqli_fetch_assoc($query)) { $array[] = $row; } // code want name $code = "knty"; // mystery step need $name = $array[$id]['name']; i edit hint of comment of itachi . can use code key of $array : $search = "select * table"; $query = mysqli_query($conn, $search); $array = array(); while($row = mysqli_fetch_assoc($query)) { $array[$row['code']] = $row['name']; } // code want name $code = "knty"; $name = $array[$code];

Yii2.0 pagination issue second page not working -

how do pagination? have search form , search button passes in date range. first page working successfully, when click on second page, shows everything. how pass date range pagination? edit: below reportsearch.php (model) $dataprovider = new activedataprovider([ 'query' => $query, 'pagination' => [ 'pagesize' => 5, //'params' => array('search' => 'true', 'from_dt'=>$stockmovement_summary_from_sales_date, 'to_dt'=> $stockmovement_summary_to_sales_date), ], ]); $dataprovider->setsort([ 'defaultorder' => [ 'd_item.desc_e_tx' => sort_asc, ], 'attributes' => [ 'd_item.desc_e_tx' ] ]); return $dataprovider; } below controller: $searchmodel = new reportsearch(); $dataprovider = $searchmodel->searchstockmovementsumm...

c++ - Get TextField->text() from slot Blackberry 10 -

i'm complete beginner in blackberry 10 development. i'm developing app should take user input text box , search if there occurrence of word in text file. i'm using triggered() signal of actionitem invoke search. however, when try fetch user input within slot returns empty string ''. mistake i'm making. thank in advance. here code: main.qml textfield { objectname: "anagram" hinttext: "enter anagram search" verticalalignment: verticalalignment.center horizontalalignment: horizontalalignment.center input { submitkey: submitkey.done } } application.cpp actionitem *main = root->findchild<actionitem*>("search"); bool res1 = qobject::connect(main, signal(triggered()), this, slot(onsearch())); void applicationui::onsearch() { qdebug() << "slot activated"; qmldocument *qml = qmldocument::create("asset:///main.qml...

java - Swing - Repainting of a Photo on JPanel -

hi guys, kindly ask me . properly need refresh jpanel different photo gotten files. 1st time during adding of jpanel photo on frame - photo showed correctly ! ok but when try change current photo dynamically 1 , refresh jpanel - see same (old) photo. , not matter place following "refreshing" part of code used: picturepanel.repaint(); picturepanel.validate(); you can find below code: // create own jpanel public class imagepanel extends jpanel { private image image; public image getimage() { return image; } public void setimage(image image) { this.image = image; } @override public void paintcomponent(graphics g) { super.paintcomponent(g); if (image != null) { g.drawimage(image, 0, 0, getwidth(), getheight(), null); } else system.out.println("the picture missing!"); } } get photo file , add own jpanel ( imagepanel ) p...

java - Difference between add(E e) and offer(E e) of ArrayDqueue Class -

hi used add , offer add element in last pace. both returning boolean , both not throw exception apart npe. public class arraydequedemo { public static void main(string[] args) { // create arraydeque elements. arraydeque<integer> deque = new arraydeque<>(); deque.add(10); deque.offer(30); } } both add element in last place returning boolean. java implementation //for add , offer both public void addlast(e e) { if (e == null) throw new nullpointerexception(); elements[tail] = e; if ( (tail = (tail + 1) & (elements.length - 1)) == head) doublecapacity(); } the 2 methods equivalent. the reason both exist the java.util.queue interface specifies both. the reason java.util.queue specifies both implementation of java.util.queue allowed implement capacity restrictions, , 2 methods specified behave differently in case adding element violate restriction; specifically, add(...) specified throw i...

Matlab, combinations of all cells -

this question has answer here: generate matrix containing combinations of elements taken n vectors 4 answers i need combine data of n (random) arrays different lengths. ex: a=[1 3 2 7 8], b=[2 5 3 9] , c=[5 6] , maybe have d, e, f etc.... need combination of elements like: m={[1 2 5], [1 2 6], [1 5 5], [1 5 6], [1 3 5], [1 3 6] ....}. solution 3 arrays: [a,b,c] = meshgrid(a, b, c); m = [a(:), b(:), c(:)]; solution n arrays iterating on short dimension n : a=[1 3 2 7 8]; b=[2 5 3 9]; c=[5 6]; d=[1 3 5]; arrays = { a, b, c, d }; m = a'; = 2:length(arrays) a1 = m; a2 = arrays{i}'; [i1, i2] = meshgrid(1:length(a1), 1:length(a2)); m = [a1(i1(:), :) a2(i2(:))]; end

java command inside batch file is not getting executed when batch file is called from main method -

i calling batch file main method in following way: public static void main(string args[]){ runtime rt=runtime.getruntime(); try { process pr=rt.exec("d:\\test1.bat"); pr.waitfor(); } catch (exception e) { e.printstacktrace(); } } the content of batch file follows: xcopy d:\a1 d:\a2 call c:\java\jdk1.6.0_27\bin\java.exe -version >log1.txt 2>&1 upon execution files folder a1 getting copied folder a2, log1.txt not getting generated. if double click batch file, files getting copied , log1.txt getting generated version of java. it log1.txt generated in current working directory of java application, not necessary same directory .bat file. you mention you're using eclipse, sets working directory default, unless you've changed it, top level of project directory containing application entry point (static void main). eclipse not automatically refresh filesystem when externa...

php - How to use dbforge[of codeigniter] to add foreign key -

i using codeigniter , trying convert following query dbforge style query, how can it? create table filter ( filterid int primary key auto_increment, filtername varchar(50) not null, categoryid int not null, isactive tinyint not null, sequence int not null, foreign key(categoryid) references category(id)); use $this->db->query(); instead. this works me.... $sql="create table filter ( filterid int primary key auto_increment, filtername varchar(50) not null, categoryid int not null, isactive tinyint not null, sequence int not null, foreign key(categoryid) references category(id))"; $this->db->query($sql);

.net - Why I need to use Public Structure _PROCESSOR_INFO_UNION? -

for need use public structure "_processor_info_union"? without "dwnumberofprocessors" returns 15 instead of real number of processors, when used it's returns 4 imports system.runtime.interopservices public class form1 <dllimport("kernel32.dll")> _ public shared sub getsysteminfo(<marshalas(unmanagedtype.struct)> byref lpsysteminfo system_info) end sub <structlayout(layoutkind.sequential)> _ public structure system_info friend uprocessorinfo _processor_info_union public dwpagesize uinteger public lpminimumapplicationaddress intptr public lpmaximumapplicationaddress intptr public dwactiveprocessormask intptr public dwnumberofprocessors uinteger public dwprocessortype uinteger public dwallocationgranularity uinteger public dwprocessorlevel ushort public dwprocessorrevision ushort end structure <structlayout(layoutkind.explicit)> _ public structure _processor_info_union ...

hadoop - HBase map/reduce dependency issue -

overview i developed rest api service based on resteasy framework. in service, store data hbase database. then, execute map/reduce process trigged condition(e.g. insert 1 record). requires in map class, import third part libraries. not want package libraries war file. tablemapreduceutil.inittablemapperjob(hbaseinitializer.table_data, // input hbase table name scan, // scan instance control cf , attribute selection lucenemapper.class, // mapper null, // mapper output key null, // mapper output value job); fileoutputformat.setoutputpath(job, new path("hdfs://master:9000/qin/lucenefile")); job.submit(); problem if package libraries in war file deploy jetty container, work w...

pandas - How to calculate group by cumulative sum for multiple columns in python -

i have data set like, data=pd.dataframe({'id':pd.series([1,1,1,2,2,3,3,3]),'var1':pd.series([1,2,3,4,5,6,7,8]),'var2':pd.series([11,12,13,14,15,16,17,18]), 'var3':pd.series([21,22,23,24,25,26,27,28])}) here need calculate groupwise cumulative sum columns(var1,var2,var3) based on id. how can write python code crate output per requirement? thanks in advance. if have understood right, can use dataframe.groupby calculate cumulative sum across columns grouped 'id' -column. like: import pandas pd data=pd.dataframe({'id':[1,1,1,2,2,3,3,3],'var1':[1,2,3,4,5,6,7,8],'var2':[11,12,13,14,15,16,17,18], 'var3':[21,22,23,24,25,26,27,28]}) data.groupby('id').apply(lambda x: x.drop('id', axis=1).cumsum(axis=1).sum())

Changing Design of master template in Lotus Domino -

this question specific service account in lotus domino. trying access user's calendar using user credential via rest das services. have created 1 user in domino , want use user access other user's calendar item.is there way can achieve same. have tried delegation of access,but problem manually have go each mailbox , same.is there way can automate process or changing master template once reflect users mail box.any link/doc me. you need grant user running code access mail files. in domino administrator can change acl of multiple databases @ same time.

Python tkinter: input not equal to answer? -

i have code using tkinter , python , when answer correctly, says answer wrong: self.whatword = stringvar() self.missingwordprompt = entry(root, textvariable=self.whatword) self.missingwordprompt.pack() #self.missingwordprompt.bind('<return>', self.checkword()) self.submitbutton = button(root, text='check answer', command=self.checkword) self.submitbutton.pack() '''self.answerlabel = label(root, textvariable=self.missingword) self.answerlabel.pack()''' self.answer = self.missingword.get() print(self.answer) def checkword(self): self.my_input = self.missingwordprompt.get() print(self.my_input) if str(self.answer).lower() == str(self.my_input).lower(): print('correct') else: print('wrong answer') in console this: missing word: football football wrong answer football wrong answer you must operate stringvar instance e.g.: ...

How to delete all elements in one command for a tk treectrl -

i want delete elements in tk treectrl , find commands pathname item delete , not sure how can done single command got answer pathname item delete http://tktreectrl.sourceforge.net/treectrl.html#91

jsp - Calling Java Method from Servlet 2.5 -

i got little code snippet 1 of jsp files: <c:when test="${not empty param['filepath'] && not empty param['revision']}"> <c:out value="${sessionscope.filehelper.getcontentsforpath(param.filepath,param.revision)}" escapexml="false"/> </c:when> unfortunately have migrate servlet 2.5 , using 3.0 . the problem is, el (expression language) not support calling methods in prior versions. asked me how accomplish same thing 2.5 compatible code. the filehelper gets added sessionscope in different jsp file like: <jsp:usebean id="filehelper" class="de.mypackage.util.filehelper" scope="session" /> what tried was: <%@ page import="de.mypackage.util.filehelper"%> <c:when test="${not empty param['filepath'] && not empty param['revision']}"> <c:out value="<%=(filehelper)session.getattribute("fileh...

android - How to detect exact time of Network/Internet unavailability..? -

just want detect exact & sharp time of internet/network disconnected or connection no longer available.. suppose app connected server after time lost connection server(say @ 02:30:15 pm) @ same time wana detect time(02:30:15 pm) or alert particular movement lost connectivity.. even if have wi-fi or data connectivity available lost connection..? see this link,it give example of brodacast receiver connect/disconnct event of wifi connection. implement same broadcastreceiver in project , listen connect , disconnect event, , @ same time system time system.currenttimemillis() method. have connect , disconnect time. hope helpfull you.

css - what does reference pixel mean? -

what "reference pixel" mean , difference between , "hardware pixel"? "css pixel" or different thing? how reference pixel enhance web page views on smart phones? what reference pixel mean the reference pixel visual angle of 1 pixel on device pixel density of 96dpi , distance reader of arm's length. nominal arm's length of 28 inches, visual angle therefore 0.0213 degrees. reading @ arm's length, 1px corresponds 0.26 mm (1/96 inch). what difference between , hardware pixel the difference between hardware pixels , css reference pixels reported browser. is css pixel or css pixel different thing yes, css/reference/viewport pixels have same mean how reference pixel enhances web pages views on smart phones this link question: http://alistapart.com/article/a-pixel-identity-crisis/ http://www.siolon.com/blog/understanding-hardware-and-css-pixels/

php - Yii2 db getStats (db queries number) -

there useful method getstats in db-component yii $sql_stats = yii::app()->db->getstats(); echo $sql_stats[0] //the number of sql statements executed echo $sql_stats[1] //total time spent official documentation link is there method in yii2 information? here equivalent yii 2: $profiling = yii::getlogger()->getdbprofiling(); $profiling[0] contains total count of db queries, $profiling[1] - total execution time. note if want information all queries @ end of request should execute code in right place, example in afteraction() : public function afteraction($action, $result) { $result = parent::afteraction($action, $result); $profiling = yii::getlogger()->getdbprofiling(); ... return $result; } otherwise information according moment of execution command. official documentation: getdbprofiling() afteraction()

vba - Excel workbook only shows after running code is finished -

i have program in excel workbook opens powerpoint-file, updates links within file , closes after that. works fine. here problem: when links updated excel file source data opened. after powerpoint closed file stays open. want closed because repeat process many files , can't end hundreds of open excel files. i tried following: wbks=application.workbooks.count = wbks 1 step -1 if workbooks(i).name<>thisworkbook.name workbooks(i).close savechanges:=false end if next now comes weird part. whenever run code, wbks returns 1 , excel file pops after code finished. if go through code in debug mode works. workbook pops enter debug mode. i tried applicatio.wait in hope file show after second. file showed after code finished. i tried do while loop wait until file open. excel crashes because never leave loop. edit: tried doevents suggested. not work either. this workaround, try using brute force after x times macro has run. store x somewhere in...

web services - Java: auto-generated test client for a WS -

is there way auto-generate in java test client web service? have ws operation foo(string a, string b) , need generate web client (a jsp page) simple form , "send" button call operation foo , show response. i'd auto-generate test client if operation changes foo(string a, string b, string c) don't need edit manually client page add new "c" field, happens automatically compiling it. possible this? otherwise, weblogic 10.3.6 provide feature this? i think can use glassfish webservice tester http/https url. automatically detects changes on deployment. not sure weblogic.

Display the data from kendo-grid to html using angularjs -

i working on this . displays data using kendo - grid. however, need when click on particular row in table, content fetched in object , using object can display fields below table. how can achieve that? also, believe need modify code if using objects display fields. appreciated. first name: {{firstname}}<br> last name: {{lastname}}<br> country: {{country}}<br> city: {{city}}<br> it seems need listen row selection (change event), , selected row, bind angular variable inside scope describe in update the key here change event triggered upon selection/deselection grid configs ... change: function(e) { var selection = this.select(), selecteditem ; if(selection && this.dataitem(selection)) { $scope.selecteditem = this.dataitem(selection).tojson(); } else { $scope.selecteditem = {}; } $scope.$apply(); } ... grid configs

c++ - Why isn't anything being written to my file? -

i'm making program opencv , want record x,y coordinates of 2 objects i'm tracking. i've retrieved data fine , using display coordinates on-screen, i've been struggling write log file. i have function pass relevant data to, , sure program reaching function because file being created. can please tell me why "test.txt" empty? thank in advance. here code: void savedata(int leftx, int lefty, int rightx, int righty, int distance){ logfile.open("test.txt"); //timer time_t start = time(0); //set initial time point //counter int counter = 0; //string coordinates //string coordinates string coords = "left x: " + inttostring(leftx) + " lefty: " + inttostring(lefty) + " right x: " + inttostring(rightx) + " right y: " + inttostring(righty) + " distance between: " + inttostring(distance) + "\n"; //if 1 minute has passed if (start - time(0) == 60...

usb - Bidirectional communication between keyboard and android device (AOA) -

i want create android application can communicate keyboard (hid). firstly, try communicate keyboard via usb host seems keyboard doesn't appear on usbmanager.getdevicelist(). i have read aoa. problem don't understand how can set protocol. have understood android device should communicate accessory don't understand if standard keyboard accessory or if have modify keyboard. in second case, how can ? want plug keyboard usb directly on android device. i have tried example of application using accessory musbmanager.getaccessorylist() return null. how can know model , manufacturer set on usb accessory filter ? thank help. i have worked on external keyboard integration android device. noticed keyboard not recognize device, lenevo , logitech keyboard can detectable. if looking code see link.

java - How can I perform the action of a button without clicking the button? -

this question has answer here: programmatically clicking gui button in java swing 6 answers i want perform action done when button pressed without clicking button. asking simply, can perform 2 action listeners when single button clicked? you can solve problem calling method when button clicked. see example: although button isn't pressed, can perform same action. public class buttontest extends javax.swing.jframe { private javax.swing.jbutton jbutton1; private javax.swing.jlabel jlabel1; /** * creates new form buttontest */ public buttontest() { initcomponents(); changelabeltext(); } private void changelabeltext() { if(jlabel1.gettext().equals("1")) jlabel1.settext("2"); else jlabel1.settext("1"); } private void initco...

javascript - How to add CSS to the Dynamically generated ID? -

my query . when inspect element need add css id dynamically generated .can overwrite dynamically generated id ? (or) how can add css id generated dynamically . can 1 me out ? thanks in advance. try css: input[id^="jqxwidget"]{ background:red; } input[id^="jqxwidget"]{background:red;} <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input autocomplete="off" type="textarea" id="jqxwidget09677819" class="jqx-widget jqx-input jqx-rc-all jqx-widget-content" style="width: 115.4px; height: 21px; margin: 4px;">

oracle - Searching first condition first and only if not available then second condition -

i writing sql query query should first search first value, , if value missing query should search second value. i have 2 tables. 1 of these tables contains modification date (this not filled , can null ) , creation date filled. now want query first looks in table modification date , if null looks @ table creation date. example of query: select * all_articles to_char(modification_date, 'yyyymmdd') = to_char(sysdate, 'yyyymmdd')-1 -- if empty record to_char(creation_date, 'yyyymmdd') = to_char(sysdate, 'yyyymmdd')-1 can me query? almost major rdbms' available have in built functions handle such situation. oracle db has nvl function works follows: nvl(modified_dt, create_dt); the above return modified_dt column data default. however, if isn't available, return create_dt. see here details: http://www.w3schools.com/sql/sql_isnull.asp

ios - Track remote push notifications when app in background -

i use urban airship handle remote push notifications ios app. works expected, , notifications both in foreground , in background. track incoming remote push notifications (even if not executed). if remote push arrives, invoke code record kind of notification was. seem able handle when user taps notification, , not when received. possible? i have set background mode "remote notifications", implemented both didreceiveremotenotification in appdelegate , both receivedbackgroundnotification urban airship. have set backgroundpushnotificationsenabled yes. any ideas if possible? here example of push notification: { "_" = "q-pr3meylaees8csdiudl0-a"; aps = { alert = "a simple message"; badge = 53; }; id = ea591946c21d437f8fc1c851e1c1e728; pid = 6a26766232e14d971dc1417a0c217bfc; type = c1; }

python - How to add text to matplotlib legend and maintain equal space with legend and plot borders? -

i trying add text matplotlib legend can done separately adding annotation need them in single box how have done: import numpy np import matplotlib.pyplot plt = np.array([1, 2, 3, 4, 5, 6,]) b = ** 2 c = ** 3 fig = plt.figure(1, figsize=(5, 5)) fig.clf() plot = plt.subplot(111) plot.plot(a, b, linestyle = '-', marker='^', label='quadratic') plot.plot(a, c, linestyle = '-', marker='^', label='cubic') plot.legend(title = 'lorem ipsum \n' + str(a[1]) + ' dolor sit amet,\nte dolores assentior \ninciderint iu', loc = 'center', bbox_to_anchor = (1.25, 0.5)) plot.set_ylabel('y') plot.set_xlabel('x') plt.savefig('test.pdf', bbox_inches='tight') and @ same time need spacing between plot , legend border same, legend width increases legend should placed further without changing loc argument, shown in figure s should constant: +------------------------------------------------------+ | ...