Posts

Showing posts from September, 2010

php - download service, controlling file access -

i have wordpress site people buy access downloads through woocommerce plugin. there several thousand downloads each order , have found woocommerce inefficient when handling large amounts of downloads. the download files product1_date.pdf product2_date.pdf etc... i can't change this i need php solution which admin can upload files directory via ftp users buy product can download them in download area users cannot access files products haven't purchased guessing filename 1 , 2 can handle, how prevent 3? there way can set file permissions read specific user has purchased? or possible make directory writable (so can uploaded) files readable apache , serve files user other way? first, must stop hotlinks! after, create downloader file contain of downloader function. this's parameters file mime-type, file name, file url etc... users can download downloader file. function first control users access, after accept user want or not accept. return

qt - How to detect that an item in a QStandardItemModel is dropped onto another? -

how receive notification qstandarditem dragged , dropped onto qstandarditem, becoming child of latter? i thought re-implementing qstandarditemmodel.moverows , not getting called after drop :( below example of i'm trying do. test, run program , drop 1 item in tree view onto another. if worked, should see confirmation in console moverows has been called. from pyqt5.qtgui import * pyqt5.qtwidgets import * pyqt5.qtcore import * class model(qstandarditemmodel): def moverows( self, source_parent, source_row, count, destination_parent, destination_child): print( 'moving {} row(s) row {} of parent {} row {} of parent {}' .format( count, source_row, source_parent, destination_child, destination_parent) ) super().moverows( source_parent, source_row, count, destination_parent, destination_child) return true def _create_item(text):

java - Google Glass SimpleWeatherApp getCity function return null -

i'm trying re-adapt simple weather app ( http://code.tutsplus.com/tutorials/create-a-weather-app-on-android--cms-21587 ) google glass, returns json object on android , works, in google glass when want use getcity function, have null pointer exception error. my getcity function same 1 in simpleweatherapp public string getcity(){ return prefs.getstring("city", "jerusalem, il"); } theres 3 java files, 2 class , 1 activity. citypreference , return city , city. remotefetch json object main activity build view google glass , show information need. i can share whole project if want more informations. here's part of mainactivity content private view buildview() { cardbuilder card = new cardbuilder(this, cardbuilder.layout.text); card.settext(r.string.open_weather_maps_app_id); //updateweatherdata(new citypreference(getactivity()).getcity()); updateweatherdata(new citypreference().getcity()); retur

android - Display pdf on WebView -

this question has answer here: how can display pdf document webview? 8 answers how display .pdf file inside android webview? try snipped: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); webview webview=new webview(mainactivity.this); webview.getsettings().setjavascriptenabled(true); webview.getsettings().setpluginstate(pluginstate.on); webview.setwebviewclient(new callback()); string pdfurl = "http://dl.dropboxusercontent.com/u/37098169/course%20brochures/and101.pdf"; webview.loadurl("http://docs.google.com/gview?embedded=true&url=" + pdfurl); setcontentview(webview); } private class callback extends webviewclient { @override public boolean shouldoverrideurlloading( webview view, string url) { return(false); } }

stream - Streaming engines best practice in C -

lang: c / env: linux i developing streaming engine, able start, stop , pause stream, seeking operation that's giving me lot of headache, asked question here before , fixed issues inside code answers. using lseek() function, passing open streaming file descriptor first argument, plus using udp transmitting, following code: transport_fd = open(tsfile, o_rdonly); int offset = 1024; off_t offsetindicator; if ((offsetindicator=lseek(transport_fd, offset, seek_cur))<0) printf("error seeking\n"); whenever try seek while streaming, streaming stops , pictures hangs. is there should pay attention to?, i.e: attempting sleep() or nanosleep() after seeking file in order changes take effect. i couldn't find examples, papers or realted articles best practices in such engines. edit: after testing, seems file continued stream receiving devices on network didn't catch stream connection anymore, , calculating time took finish after subtract seeking time, s

c++ - Generate text from MSI made using Wix -

this might sound dummy question, want process parameters given msi file, generated using wix. have developed program visual c++ in vs2010 eg msiexec /i setup.exe ip="192.168.2.1" port="9999" i want access parameters ip , port , write in text file as: { "ip":"192.168.2.1", "port":"9999" } is possible in wix? if isn't there way this. i believe there way this, although haven't done myself. if pass parameter msiexec following: msiexec /i setup.exe custompropip="192.168.1.1" custompropport="9999" then property should set in list of properties msi package can parse. create custom action handle these values , can write file disk. <binary id="setupca" sourcefile="setupca.ca.dll" /> <customaction id="writefiletodisk" execute="immediate" binarykey="setupca" dllentry="writefiletodisk" /> make sure have custo

jquery - Javascript show/hide menu on scroll with a twist -

here demo of menu fadein: fiddle demo i seeking advice on tricky show hide problem have. menu fades in @ point using following: $(window).scroll(function () { var d = $('#menu'); if (d.offset().top > 810) { d.fadein(); } else { d.stop().hide(); } }); what need 1 of links within menu not hidden , show @ top of page , remain once menu appears other links. the menu displays following: <div id="menu"> <div class="top-bar"> <div class="container"> <div> <a href="index.php" class="top-bar-brand">mywebsite</a> </div> <nav> <ul class="navbar-right"> <li><a href="">buy now</a></li> <li><a href="">link2</a></li>

python - IDLE crashes for certain buttons on Mac -

i running os x 10.9.5, , idle w/ python 3.4.1. when press buttons (¨/^) or (´/`), idle crashes , program closes. this causes me lose changes files, time. fellow students using mac experience same problem. anyone know how can fix this? i pretty sure version of tcl/tk using having problem non-us national keyboard (which country?) un-shifted, key produce non-ascii diacritic chars, ord(´)==180 , ord(¨)==168 , composed character. the download page, @ bottom, directs osx users mac-tck/tk page. page says install activetcl 8.5.16.0 activestate. older tcl/tk 8.5.9 apple has problem composition chars has since been fixed in meanwhile, start idle in console window python3 -m idlelib (i think python3 correct name osx) , should see error messages should verify above. may solve problem of idle stopping.

ios - How to adjust super view 's height base on subview's size in XIB? -

Image
in xcode 6 ,i create xib custom view (named: viewa,got red background color) ,and viewa's xib got file size 600*600, in viewa ,i put subview labelb (got green background color )in ,and labelb's numberoflines = 0 ,so labelb'height variable , want viewa 's height changed based on labelb's height (e.g viewa.bottom = labelb.bottom + 10), , have pin labelb's top,bottom,trailing,leading viewa, still doesn't !work ,the viewa's height 600 ,no matter label's height . how can achieve goal in auto layout? thanks using auto layout, here's need do: make sure aren't adding fixed width and/or height constraints of subviews (depending on dimension(s) want dynamically size). idea let intrinsic content size of each subview determine subview's height. uilabel s come 4 automatic implicit constraints (with less required priority) attempt keep label's frame @ exact size required fit text inside. make sure edges of each label connected r

android - How to insert object in a spinner -

i want know how can put spinner in activity filled values of object. i used spinners with: sp_usage.setonitemselectedlistener(new adapterview.onitemselectedlistener() { public void onitemselected(adapterview<?> parent, view view, int pos, long id) { object item = parent.getitematposition(pos); } public void onnothingselected(adapterview<?> parent) { } }); the case receive array of object server items id , name. want know how can know item selected, need resend id server. note: ids received haven't sequences, 1,23,47... i uses object: public class usages { @key public string idd; @key public string msgerror; @key public string usage; public string getidd() { return idd; } public void setidd(string idd) { this.idd = idd; } public string getmsgerror() { return msgerror; } public void setmsgerror(string ms

c# - How to make header style colors of a PivotItems with MVVM -

i want current header blue, , others red. problem headers in code not pivotitem.header, of type binded itemssource. know have write property in viewmodel , bind foreground property of textbox, header of pivotitem cannot figure out how? here xaml: <pivot foreground="#ff888888" style="{staticresource pivotstyle1}" grid.row="1" itemtemplate="{binding viewdatatemplate}" itemssource="{binding viewdatasource}"> <pivot.headertemplate> <datatemplate> <grid> <textblock text="{binding id}" margin="0, 16, 0, 0" foreground="?????????" fontsize="32" fontfamily="segoe wp" fontweight="light"/> </grid> </datatemplate> </pivot.headertemplate> <pivot.itemcontainerstyle> <style targettype="pivotitem">

What can I do if I'm stuck RDP to my Azure VM? -

we set vm on azure used normal vm therefore lots of data our on vm, morning vm stopped working - guess there's wrong inside (possible harddisk full or windows service issue) how can fix please... we had same issue today, beware there issues azure storage in north , west europe. in our case problem attached disks on vm's using azure storage. you can check azure status here: http://azure.microsoft.com/en-us/status/

sql - powerpivot inner join -

i have 1 table: person name country code andrew 1 philip 2 john 1 daniel 2 and lookup table: country code country name 1 usa 2 uk i added them powerpivot, created relationship between country code fields, created pivot table. expect following: person name country code andrew usa philip uk john usa daniel uk but is: person name country code andrew usa andrew uk philip usa philip uk john usa john uk daniel usa daniel uk couple of options: add column main table uses formula pull in country name lookup table e.g. =related(lookuptable[country name]) if drag in measure references main table desired result e.g. =countrows('maintable') hide results column if had to.

Objective C/Android Java calling Xamarin code -

we have objective c , andoid java applications , create component using c# , xamarin interact. there way these technologies can communicate each other (objective c <-> xamarin , android java <-> xamarin). not sure how searching here may possible create static library in objective c/java can called xamarin. from there understand can start objective c/java app xamarin main method , afterwards can call other static library methods. ideally call objective c/java app xamarin. according miguel in this post possible there examples anywhere. hope explanation makes sense. thanks from wording of question, not possible. xamarin offer ability create 'bindings' between c# , objective c/java static libraries , has section on developer documentation on doing ( objective c bindings or java wrappers ). the key part static libraries , not general application functionality i.e. user interactions. you need weigh benefit between migrating disparate projects

.net - c# how to get files name into a specific folder which have a specific patter -

i have folder contains these files: erb3pcustsexport-303_20080318_223505_000.xml erb3pcustsexport-303_20080319_063109_000_empty.xml erb3pcustsimport-303_20080319_123456.xml erb3pdelcustsexport-303_20080319_062410_000.xml erb3presosexport-303_20080318_223505_000_empty.xml erb3presosexport-303_20080319_062409_000.xml i care files have custsexport word in names. my question: how these files? what have tried: i got folder name app settings section in app.config this: string folderpath = configurationmanager.appsettings["xmlfolder"]; then got file names this: foreach (string file in directory.enumeratefiles(folderpath, "*.xml")) { } my problem: in way, got files. however, interested in files have custsexport in names. could me please? note: i working on .net 4.5 many thanks try this: foreach (string file in directory.enumeratefiles(folderpath, "*custsexport*.xml")) { } or can use regex: regex reg = new rege

How to define multipurpose (i32/f32) register in an LLVM backend? -

i'd define register multipurpose float , integer register on llvm back-end. know how that? thanks! i believe see how implemented in llvm backend architecture familiar with. example, arm has 32 d-registers (d0..d31) can hold either double float or vector values. in case registerclass definition quite straightforward: // scalar double precision floating point / generic 64-bit vector register class. def dpr : registerclass<"arm", [f64, v8i8, v4i16, v2i32, v1i64, v2f32], 64, (sequence "d%u", 0, 31)> { // allocate non-vfp2 registers d16-d31 first. let altorders = [(rotl dpr, 16)]; let altorderselect = [{ return 1; }]; }

objective c - Accessing Hardware using Swift language -

i in design phase of app access bluetooth device (ble 4.0) , trying people know objective c. hear there’s new language "swift" apple more easy learn , program. swift have capability access hw sensors on phone? swift front end interface accessing hw logic has done using objective-c? please me understand me choose way go. lot. -prashanth swift replacement objective-c, can it

html - Get item from ng-repeat list using Angular -

i'm making project list made search result. build <div class="col-lg-6"> <ul ng-repeat=" wiks in wiki"> <li ng-mouseenter="abstract = wiks.abstract" ng-mouseleave="abstract = ''"> <a href="#/view2">{{wiks.title}}</a> </li> <p>{{abstract}}</p> </ul> </div> the wiks object has more title , abstract in it. reduce amount of calls server i'd save object in variable in controller next view. .controller('view1ctrl',['$scope','wikifactory' , function($scope, wikifactory) { $scope.title = "wiki search site"; $scope.search = ""; $scope.wiki= ""; $scope.getwiki= function getwiki() { wikifactory.getwiki($scope.search) .success(function (wiki) { $scope.wiki = wiki; })} }]) .controller('wikicontroller&#

javascript - Display the Name of the File in File Upload Button -

here fiddle this css: label input[type="file"] { display: block; margin-top: -20px; opacity: 0; } here have text instead of file upload button (as given opacity:0) how can display file name chosen note : want display file name near upload text one way set value of tag current value of file input adding onchange event: document.getelementbyid('spanfilename').innerhtml = this.value as can see in full example: upload file: <input type="file" onchange=" document.getelementbyid('spanfilename').innerhtml = this.value; imagechangesupplier(this,57);" style="display:block;margin-top: -20px;opacity: 0;" > <br /> <br /> file selected: <span id='spanfilename'></span> 1 thing need take note of using method produces name of file , adds 'c:/fakepath/' prefix. can replace text give file name.

Call overloaded function from specific toolbox in MATLAB -

i have matlab-toolboxes installed. in matlab version 1 of toolbox-functions collides another. in case hessian. want use hessian function of symbolic-toolbox. when in c/c++ functions multiple defined function cos , still want use “standard” cos-function can write: std::cos(x); is there similar in matlab? in similar way describing c/c++, can use specific toolbox function adding name of toolbox first : toolboxname\function2call() first use which command make sure of function toolbox loaded specific call syntax. since not have toolbox mentioning i'll use classic fopen function example. the first fopen function called without other parameter built in function used return handle file. indeed, which command confirms that: >> fopen built-in (c:\tlab13a\toolbox\matlab\iofun\fopen) now let's want use fopen function open serial port, need prefix call fopen name of toolbox/object, so: serial\fopen . let's first make sure way of calling point r

c - matrix library: inline vs define -

i'm creating matrix library bunch of function 1 (it's long one): void matx_multiply(int x, float mat1[], float mat2[], float result[]) { int row,col,k; (row=0; row<x; row++) { for(col=0; col<x; col++){ result[row + col*x]=0.0f; (k=0; k<x; k++) { result[row + col*x]+=mat1[row + k*x]*mat2[k + col*x]; } } } } firstly, wonder if it's better change inline function if use ~5 times in program (often in loop), x being known @ compile time. i think it's better inline it, compiler can decide @ compile time whether want expanded in code or not (depending on optimization parameter). in addition, compiler might optimize loop if knows x (for example, if x=2, may decide unroll loop) more importantly, want add set of functions: #define mat2_multiply(m1,m2,res) matx_multiply(2,m1,m2,res) #define mat3_multiply(m1,m2,res) matx_multiply(3,m1,m2,res) ... or static inli

html - How do I add a parameter (class) to an URL -

this assignment i've got school: create new class selector in css-file named 'current' element in nav. background color should #db2b2b , text color must white. next add parameter class="current" correct link in index.html. this code of both css-file , html-file: css .current { background-color: #db2b2b; color: white; } html <nav> <a href="index.html">home</a> </nav> the problem i'm dealing don't know add parameter , how. might have noticed, goal show on tab giving different color , text. you can replace code bellow <nav> <a class="current" href="index.html" >home</a> </nav> and css below a.current { background-color: #db2b2b; color: white; }

java - NoSuchElementException in iframe in frameset -

i using ie9 here html want test, window opens after 'click' add button >doctype html public "-//w3c//dtd html 4.01 frameset//en" "http://www.w3.org/tr/html4/frameset.dtd" ><html lang="pl" dir="ltr"> > <head> > <title>sometitle</title> > <somecode> > <frameset title="sometitle2" rows="100%,*" onunload="_checkunload(event)"> > <frame title="sometitle2" src="/somelink&loc=pl" frameborder="0" noresize="" longdesc="#"> > <!--rce quirks mode ie--> > <!--doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd" --> > <html xmlns="http://www.w3.org/1999/xhtml"> > +<head> > <body class="somebody&quo

How can i add duplicate items to an entity which is mapped(OneToMany) to another entity class while using spring mvc and Hibernate -

i have entity "user" onetomany mapped entity "item". list of items added until items not duplicate. how can add duplicate items user. in user entity @onetomany(mappedby="user") private list<item> item; //getters , setters in item entity @manytoone(cascade = cascadetype.all,fetch = fetchtype.eager) @jointable( name="useritem", joincolumns= @joincolumn(name="item_id"), inversejoincolumns = @joincolumn(name="user_id") ) private user user; //getters , setters my function in service class add item user public void additemtouser(integer userid,integer itemid){ session session = sessionfactory.getcurrentsession(); item item2 = (item)session.get(item.class,itemid); // session.save(item2); user user2 = (user)session.get(user.class,userid); user2.getitem().add(item2); session.save(user2); } how can add duplicate items user. newbie in spring , hibernate

c++ - Undeclared Identifier with all the right includes -

everytime try build program error: error c2065: 'depositofresco' : undeclared identifier this happens every instance create of depositofresco , depositonormal , deposito . depositonormal , depositofresco subclasses of deposito (virtual class). have right includes don't know what's causing this. error occurs in class 'armazem' instantiate several of these insert in vectors , such. here's code: armazem::armazem(int nf, int nn, int npf, int npn, int distmaxi, int distmini) : depositos(), distancia(), graphstlpath <deposito*, int>() { distmax = distmaxi; distmin = distmini; (int = 0; < nf; i++) { depositofresco* df = new depositofresco(random(1, 20), (float)random(1000, 10000), npf); depositos[i] = df; } (int j = nf; j < nf + nn; j++) { depositonormal* dn = new depositonormal(random(1, 20), (float)random(1000, 10000), npn); depositos[j] = dn; } preenchermatriz(); } also, armazem subclass template class called graph

Python Mechanize select value from <select> box -

i'm trying use mechanize fill , submit form, i'm not able fill select boxes, throws errors. how set value select boxes before submitting it? select form, , set value want using item assignemnt browser[...] = [...] . b = mechanize.browser() b.open(url) b.select_form(nr=0) b['select_name_attribute'] = ['option_value'] # <----- b.submit()

Unable to Sign In to Visual Studio 2013 -

i installed visual studio ultimate 2013, , when tried sign in microsoft account, following error: sp324099: not complete operation. furthermore, ie starts up. tried find solutions online, nothing worked (there flushing dns; tried didn't work). is familiar error or can suggest me way around this? i had same problem vs2015 (but, strangely, not vs2013). advice @petrovich1999 did not me, updating ie did. turns out still running ie8 on office workstation (i never use ie), , upgrading ie11 allowed me sign visual studio.

ios - appending rows to tableView from within a block -

i'm trying add/append rows single section of tableview within block. problem when add index paths (insertrowsatindexpaths) code crashes (the number of rows contained in existing section after update (12) must equal number of rows contained in section before update (1) yadayadayada) now traced fact [weakself.tableview numberofrowsinsection:0] not updated after appended data data source (also using weakself) anyone knows i'm missing here? __weak typeof(self) weakself = self; _tipsearchcontroller.searchresultblock = ^(nsarray *tips, bool firstbatch) { weakself.nolocationsaftersearchfilters = no; if (firstbatch==yes) { [weakself.tips removeallobjects]; // empty datasource if required [weakself.tableview reloaddata]; } nsuinteger currenttipcount=weakself.tips.count; [weakself.tips addobjectsfromarray:tips]; // adding data datasource. nsmutablearray *indexpaths = [nsmutablearray array]; (nsuinteger = 0; < tips.count; ++i) {

android - Nullpointer Exception while parsing json inner arraylist -

i using robospice springandroid parse json data. though managed json objects couldn’t retrieve inner arraylist of json objects within main json object. this structure of result json parsed: { -model[n]: -0: { name:"abcd" innerlist[3]: { -0: { innerobject: { id:"10" .... } ..... } } } } i getting null pointer exception when i'm accessing data members in pojo of innerobject. @jsonignoreproperties(ignoreunknown = true) public class model{ @jsonproperty("name") private string name; @jsonproperty("innerlist") private arraylist<classinnerlist> inner; //getters , setters } the pojo innerlist: @jsonignoreproperties(ignoreunknown = true) public class classinnerlist { @jsonproperty("innerobject") classinnerobject innerobject; //ge

php - WooCommerce related products showing the same on each product -

i working on wordpress site using woocommerce quite lot of products in, problem have related product section doesn't seem working in supposed show products related category or tags, problem these showing same on products , seems showing products added. there has been no customisation , clean install of woocommerce. i can't seem find resolution problem around, input appreciated. many thanks

javascript - Socket.IO Without Port Number -

do have use port number run socket.io or possible access socket.io in client side without port number? https://mydomain.com/chat2.html not https://mydomain.com:3000/chat2.html i read somewhere use nginx not sure how implement it, in nodejs! or can use .htaccess mirroring domain? for http , if no port number specified, browser defaults port 80. for https , if no port number specified, browser defaults port 443. so, if want use https url without port number, server needs listening on port 443 because default port number browser use when no port number specified in https url.

VBA Excel: Getting result for multiple cells -

i trying result of different cells based on preset if statement receiving result in multiple message boxes, , result cells being calculated based on first statement check up. how can receive results in single msgbox and allow function check every single cell in range? dim rcell range each rcell in vou_summary.range("i5:i16") if 0 < rcell <= 2.5 msgbox rcell.cells.offset(0, -3).value & " critical", vbokonly, "notice!" elseif 2.5 < rcell <= 4 msgbox rcell.cells.offset(0, -3).value & " requires pr placement", vbokonly, "notice!" elseif rcell >= 7 msgbox rcell.cells.offset(0, -3).value & " oversupplied", vbokonly, "notice!" else end if next you can create string variable first. don't throw msgbox save results variable. past end if statement show msgbox , pass string variable content. better, can use string builder make work 1000 ti

xcode - IOS 8 / 7 unique user identifier -

as of ios8 , ios7 there way retrieve unique id each user of app? need identify every user of app , register on database in order have statistics how can it? you can use uuid.its important save uuid in nsuserdefault once generated because uuid different each generation. + (nsstring*)getappuuid { nsuserdefaults *userdefaults = [nsuserdefaults standarduserdefaults]; nsstring *uuid = [userdefaults objectforkey:nslocalizedstring(@"devicetoken",nil)]; if(!uuid) { cfuuidref uuidref = cfuuidcreate(null); cfstringref uuidstringref = cfuuidcreatestring(null, uuidref); cfrelease(uuidref); uuid = (__bridge nsstring *)uuidstringref ; [userdefaults setobject:uuid forkey:nslocalizedstring(@"devicetoken",nil)]; [userdefaults synchronize]; } return uuid; } to generate uuid,you can use below method ios 6 [[uidevice currentdevice]identifierforvendor]

c++ - CMake does not properly find CUDA library -

i'm trying build program requires cuda. cmake script supply: cmake -d cuda_toolkit_root_dir=/usr/local/cuda .. cuda found , cmake runs normally: staudt ~/workspace/clutbb/cluster/build $ cmake -d cuda_toolkit_root_dir=/usr/local/cuda .. -- found cuda: /usr/local/cuda (found version "6.5") -- found intel tbb -- boost version: 1.56.0 -- found following boost libraries: -- iostreams -- program_options -- looking include file pthread.h -- looking include file pthread.h - found -- looking pthread_create -- looking pthread_create - not found -- looking pthread_create in pthreads -- looking pthread_create in pthreads - not found -- looking pthread_create in pthread -- looking pthread_create in pthread - found -- found threads: true -- not find sdl (missing: sdl_library sdl_include_dir) -- configuring done -- generating done -- build files have been written to: /home/i11/staudt/wo

ui-grid (3.0.0 unstable) cellFilter with dates issue -

ui-grid (3.0.0-rc.16) doesn't work when using filtering dates. filtering on other fields works well. here comes punker: http://plnkr.co/edit/b9nsk0 try start entering 2014 date. bug or missed something? // main.js var app = angular.module('myapp', ['ui.grid', 'ui.grid.i18n']); app.controller('myctrl', function($scope) { $scope.mydata = [{ eventname: "event1", eventdateraw: new date(1416396274368), eventdateformatted: new date(1416396274368) }, { eventname: "event2", eventdateraw: new date(1416352423803), eventdateformatted: new date(1416396274368) }]; $scope.gridoptions = { data: 'mydata', columndefs: [{ name: 'eventname', width: "20%" }, { name: 'eventdateraw', width: "40%" }, { name: 'eventdateformatted', width: "40%", cellfilter: 'date: "yyyy-mm-dd hh:mm:ss.sss"'

php Delete arrays that does not have value -

this question has answer here: reindexing array after filtering in php? 1 answer very simple question, i have array in php : array ( [0] => example [3] => example [5] => example } the order of array : 0 - 3 - 5 but must : array ( [0] => example [1] => example [2] => example } how can ? if want "reset" keys, use array_values() : $reindexedarray = array_values($array);

python - Unable to upgrade redis-py package on ubuntu -

got successful message while installing still unable import package ! (testme)ubuntu@msg:~$ sudo pip install redis==2.10.3 downloading/unpacking redis==2.10.3 downloading redis-2.10.3.tar.gz (86kb): 86kb downloaded running setup.py egg_info package redis warning: no previously-included files found matching '__pycache__' warning: no previously-included files matching '*.pyc' found under directory 'tests' installing collected packages: redis found existing installation: redis 2.9.1 uninstalling redis: uninstalled redis running setup.py install redis warning: no previously-included files found matching '__pycache__' warning: no previously-included files matching '*.pyc' found under directory 'tests' installed redis cleaning up... 1. (testme)ubuntu@msg:~$ pip freeze | grep redis (testme)ubuntu@msg:~$ 2. (testme)ubuntu@msg:~$ python python 2.7.3 (default, feb 27 2014, 19:58:35) [gcc 4.6.3] o

mysql - Fulltext search in inner join table -

i've query: select r.*, rtype.type type from app_resource r inner join app_resource_type rtype on rtype.id = r.resource_type_id match( name , type ) against('abcdef' in boolean mode) this query results: #1210 - incorrect arguments match what wrong? both columns have full-text index!

flash - how to make life movie clip using actionscript 2.0 -

i using actionscript 2.0 project. have movie clip moving along x-axis. problem is, if movie clip reaches given boundary, should automatically deduct 1 life. codes doesn't work. here's code timeline: var life:number = 5; lives = 3; boundary = 280; var speed:number = 1; var boundary:number = 280; this.onenterframe = function():void { if (clip._x > boundary) { clip._x -= speed; } else { clip._x = boundary; delete this.onenterframe; } } if(lives == 0){ gotoandstop(132); } here's code moving mc: onclipevent (load) { speed = 1; boundary = 280; } onclipevent (enterframe) { if (this._x > boundary) { this._x -= speed; } else { this._x = boundary; this._visible = false; life -= 1; lifebox.text = life.tostring(); } } first, don't need have code timeline , code movie clip. on other hand, if want movie

php - $_SERVER["PHP_SELF"] not working -

<?php $fname = $_post["fname"]; $lname = $_post["lname"]; echo "hello, ".$fname." ".$lname.".<br />"; ?> <html> <head> <title>personal info</title> </head> <body> <form method="post" action=""> first name:<input type="text" size="12" maxlength="12" name="fname"><br /> last name:<input type="text" size="12" maxlength="36" name="lname"><br /> <input type="submit"> </form> </body> </html> why doesn't code work? using wampserver. have tried alternative ""<form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?>">"" , put php code inside yet getting error webpage not found. if leave action=&qu

matlab - Using variable-precision arithmetic together with functions -

i want compute function 4 decimal digit arithmetic in matlab. when run vpa(myfunc(), 4) matlab returns same result when run myfunc() while results different on paper. question how can use vpa() without editing function? edit in following example function sum() , see results same ( vpa() affected last result) >> x = exp([-10:0.01:1]); >> sum(x) ans = 273.1851 >> vpa(sum(vpa(x, 4)), 4) ans = 273.2 as @daniel said, decided write sum() function vpa() within it, result still same! wrong? >> s = 0; x = -10:0.01:1, s = vpa( vpa(s,4) + vpa(exp(x),4) , 4); end >> s s = 273.2 to use vpa inside function, either have input vpa myfunc(vpa(4)) or use vpa inside function. code question same as: x=myfunc() vpa(x,4) first myfunc called, result converted vpa. i suggest run code in debugger , check data type of each number. if type vpa, vpa used.

firemonkey - Delphi EMS FireDAC: How do I access TEndpointRequest Params through their Index instead of the Name? -

i working on delphi ems resource client firedac application. for example, if passing 2 params client server. in server side, can access value of params through names ('item1', 'item2'). instead of accessing params through name, need access through index. existing server implementation: procedure tresource.getitem(const acontext: tendpointcontext; const arequest: tendpointrequest; const aresponse: tendpointresponse); var litem1, litem2: string; begin litem1 := arequest.params.values['item1']; litem2 := arequest.params.values['item2']; end; using dataset can access params using list index (just example), for := 0 count-1 begin fdquery.params[i].value; end; how can arequest.params? i waiting solutions. thanks in advance.

pdf - XSLFO page-break if current page is not empty -

i using xslfo generate pdfs time now, came across question, how call <fo:block break-after="page"/> without generating empty page? is, check if current page empty , in case, not call <fo:block break-after="page"/> ? anyone having solution this? thanks in advance well, using apache fop. xsl fo: <fo:page-sequence master-reference="first"> <fo:flow flow-name="xsl-region-body"> <fo:block>test</fo:block> <fo:block break-after="page"/> <fo:block break-after="page"/> <fo:block break-after="page"/> <fo:block break-after="page"/> <fo:block break-after="page"/> <fo:block>test</fo:block> </fo:flow> </fo:page-sequence> would render 2 pages in compliant xsl fo rendering engine. using renderx xep = 2 pages. using fop 6 pages (which wrong

php - My generated salts are both exactly the same -

so, i'm 'randomly' generating 2 salts use later encryption , hashing. these generated during application's install process , copied global configurations file via: file_put_contents() now, when these generated, can view them in 'globalparams.php' file. stored values of array, array not utilised @ in installation process. the code generation follows: // let's generate encryption salts: $options = [ 'cost' => 12, 'salt' => mcrypt_create_iv(32, mcrypt_dev_urandom),]; $salt = password_hash(mt_rand(), password_bcrypt, $options); $salt = password_hash($salt, password_bcrypt, $options); $salt2 = password_hash(mt_rand(), password_bcrypt, $options); $salt2 = password_hash($salt2, password_bcrypt, $options); after this, placed config file so: // let's open our template globalparams.php , replace strings.. $editfile = file_get_contents('newglobalparams.php'); $editfile = str

strange {"OK":{}} response on ElasticSearch curl -X GET 'http://localhost:9200' -

on 1 on nodes in elasticsearch cluster following strange response: command: curl -x 'http://localhost:9200' response: {"ok":{}} not sure this? run before? update: this when call (i replaced ip's xxx): curl -xget localhost:9200/_nodes/jvm?human\&pretty { "cluster_name" : "elasticsearch", "nodes" : { "dtuv63d4rbq9jxw_o03-eg" : { "name" : "elasticsearch1", "transport_address" : "inet[xxx/xxx:9300]", "host" : "elasticsearch1", "ip" : "xxx", "version" : "1.3.2", "build" : "dee175d", "http_address" : "inet[/xxx:9200]", "jvm" : { "pid" : 1471, "version" : "1.7.0_65", "vm_name" : "openjdk 64-bit server vm", "vm_version&

Rotating PDF 90 degrees using iTextSharp in C# -

i trying use pdf stamping , need rotate 90 degrees lay on correctly? know how this? can't seem find online. the rotate90degrees example uses pdfreader instance of document changes /rotate value in every page dictionary. if there no such entry, /rotate entry value 90 added: final pdfreader reader = new pdfreader(source); final int pagescount = reader.getnumberofpages(); (int n = 1; n <= pagescount; n++) { final pdfdictionary page = reader.getpagen(n); final pdfnumber rotate = page.getasnumber(pdfname.rotate); final int rotation = rotate == null ? 90 : (rotate.intvalue() + 90) % 360; page.put(pdfname.rotate, new pdfnumber(rotation)); } once done, use pdfstamper persist change: pdfstamper stamper = new pdfstamper(reader, new fileoutputstream(dest)); stamper.close(); reader.close(); this itext java. itextsharp, porting java c# easy terminology identical. change lower cases upper cases this: pdfdictionary page = reader.getpag

angular routing - AngularJS: Adding new routes dynamically -

as use, $routeprovider in config method, of knowledge $route provider. so, tried adding new routes $route in controller: after configuring , bootstrapping application, somewhere in controller, tried this: app.controller('myctrl',function($scope,$route) { $route.routes['/newroute'] = { template : 'hey, dynamically added route' }; }); but doesn't seem work. why? any ideas? you can configure routes via ngapp config function only, can't add routes dynamically in runtime. $route service.

alert - Including multiple messages in a Logstash output email -

does know way include multiple messages in same email logstash? currently configuration using: if [loglevel] == "error" , [type] == "application" { email { => "logstash@example.com" subject => "application error on %{host}" => "foo@example.com" via => "smtp" body => "%{message}" replyto => "bar@example.com" } } and sending emails, i'd able send, say, previous 20 messages same logfile, there more information in emails. possible use query body of email? if that's not possible has been able emails send link page or location in logstash server more details can found? i'm using logstash version 1.4.2 , have checked documentation @ http://logstash.net/docs/1.4.2/outputs/email can't see might allow me i'm trying do. i've tried searching examples of want on google, can't find people including m

sql - Filter records in Mysql -

i have mysql table follows buyer seller qty price b 100 4.2 b 200 4.3 c 50 4.2 w q 10 4.5 b 150 4.4 b 100 4.55 b 50 4.6 b c 10 4.3 q 40 4 f m 20 4.25 l b 30 4.50 table contains trading information of stock. here can see there connection between , b. of time buys stock b , @ each trade increase price slightly. in same way b buys same amount later higher price. need filter out such connection select statement. how can select statement. i need filter out following results. show continuous relationship between , b. sample table, actual table contains more 10,000 history trades of clients given column names buyer seller qty price b 100 4.2 b 200 4.3 c 50 4.2 b 150 4.4 b 100 4.55 b 50 4.6 a , b hypothetical values need show similar relationships 10,000 records.

c - Strange behavior of printf and i++ -

this question has answer here: increment , decrement of variable in printf [duplicate] 1 answer i forget of i++ , ++i return value. test wrote fallowing code: int i; = 6; printf ("i = %d, i++ = %d\n",i, i++); printf ("i = %d, ++i = %d\n",i, ++i); the resulting (unexpected , strange) output is: i = 7, i++ = 6 = 8, ++i = 8 but when break down printf s 4 separate commands, expected result: printf ("i = %d, ",i); printf ("i++ = %d\n",i++); printf ("i = %d, ",i); printf ("++i = %d\n",++i); gives: i = 6, i++ = 6 = 7, ++i = 8 why happens? you have both unspecified , undefined behaviour: unspecified behaviour : don't know order of evaluation of parameters in printf call. (the c standard not specify this: it's compiler , it's free choose way best matches machine architecture

regex - RegExp to return decimal number with optional 2-4 decimal dights -

i have develop regexp matches number following: *.0000 -> *.00 *.1234 -> *.1234 *.1200 -> *.12 *.1230 -> *.123 i think looking this: \.\d{2}(0[1-9]|[1-9]{1,2})? starts dot , 2 digits \.\d{2} then optional 0 followed digit 0[1-9] or 1 or 2 non-zero digits [1-9]{1,2} matches examples correctly. if want digits in front (your question states decimal number) add \d* in front of \. ... if need more specific you'll have clarify question.

openstreetmap - How does routing services for OSM determine the distance between two points -

i going design android application , needing distances of pathways inside our university(pathways between buildings) i read osm(openstreetmap) , tried it. map editable means can contribute map(like wikipedia map version). it has many routing services give routes , directions between 2 point(start , end). there routing service named graphhopper , easy use. can drag , drop start , end pt , gives distance(km) between 2 pts. what want know how did come distance? is distance reliable , accurate? any appreciated because want use distances android app , need know if these distances have basis. the distance 'accurate' in sense correctly processes existing information openstreetmap , correctly adds road segments final route. can try local area , compare own knowledge. there mapping errors, road incorrectly mapped. , there roads missing , router uses detour making path unnecessarily longer. there different modes cars or bikes or fastest , shortest different

java - Should I use a key/value database to store my API logs? -

i lot of logs api. analyse logs interesting information how many users api in month or type of activities do. all of analysis depend on period. so timestamp important me. in fact, use indexes on timestamp. problem timestamp continue. my question database more appropriate use case? i heard key/value databases, interesting use timestamp key? thanks. this two-year-old article ibm talks more sql implementation, possibly keep in mind when nosql implementation: "why current timestamp produces poor primary keys" - https://www.ibm.com/developerworks/community/blogs/sqltips4db2luw/entry/current_timestamp?lang=en of course, app different, i'm not sure of granularity of time-stamping, possible have 2 items logfiled @ same timestamp. you might better off creating other form of unique key algorithm key-value store, adding sort of serialization per timestamp. first item @ timestamp ".1", second ".2", etc. you'd have sort of timesta

android - OpenCV4Android Samples: Missing .so files -

i imported opencv samples android in eclipse. have right path ndkroot. i'm under ubuntu removed ".cmd" in build command. problem have errors in cpp files. here cdt global build console says: 19:04:34 **** build of configuration default project opencv tutorial 2 - mixed processing **** /home/crash-id/development/sdk/android-ndk-r10c/ndk-build android ndk: warning:jni/android.mk:mixed_sample: non-system libraries in linker flags: -lopencv_java android ndk: result in incorrect builds. try using local_static_libraries android ndk: or local_shared_libraries instead list library dependencies of android ndk: current module [armeabi-v7a] install : libmixed_sample.so => libs/armeabi-v7a/libmixed_sample.so 19:04:34 build finished (took 299ms) 19:04:37 **** build of configuration default project opencv sample - face-detection **** /home/crash-id/development/sdk/android-ndk-r10c/ndk-build android ndk: warning:jni/android.mk:detection_