Posts

Showing posts from August, 2010

c - mmap and struct (incompatible type error struct to void *) -

i'm getting error: error: incompatible types when assigning type ‘struct sharedmem’ type ‘void *’ when trying mmap struct sharedmemory. here's i'm trying do: //struct each card typedef struct card{ char c[3]; //card char s; //suit } card; //struct player information typedef struct player{ int num; char* nickname; char* fifo_p; struct card* hand; } player; //struct sharedmemory typedef struct sharedmem{ unsigned int nplayers; unsigned int dealer; struct player *players; unsigned int roundnumber; unsigned int turn; struct card *tablecards; } sharedmem; then have function does: int createsharedmemory(char* shmname,int nplayers){ int shmfd; char shmname[100]={'\0'}; char *ps; ps=&shmname[0]; strcat(ps,"/"); strcat(ps,shmname); // name = /shmname shmfd = shm_open(shmname,o_rdwr,0755); if (shmfd<0){ if (errno==2){ //file or directory not exist (shared

Add item numbers to items in Magento Invoice PDF -

i trying should simple, stuck. i trying add serial numbers (1,2,3 etc) items in magento's invoice pdf under column called serial number. any clues on how this? thanks! this 2 files responsible displaying invoice pdf content app\code\core\mage\sales\model\order\pdf\items\invoice\default.php app\code\core\mage\sales\model\order\pdf\invoice.php overwrite 2 files or put in local folder now add serial number header in file app\code\core\mage\sales\model\order\pdf\invoice.php can fin _drawheader function add before products column $lines[0][] = array( 'text' => mage::helper('sales')->__('serial number'), 'feed' => 35 ); now go app\code\core\mage\sales\model\order\pdf\items\invoice\default.php file can find draw() function from $this->getitem(); can find item count , put loop here displaying serial numbers like for($j=1; $j<=count($this->getitem());$j++) { $lines[$j][] = array(

Java Android: How to give media player a string value to a resource -

i have function run audio public void playsound(string filename){ mediaplr = mediaplayer.create(context, r.raw.s1); mediaplr.start(); } the problem r.raw.s1 , want replace s1 filename , doesn't take string. can do??? thanks help if file stored in res/raw/ directory, can retrieve identifier through following code: public void playsound(string filename){ int sound_id = context.getresources().getidentifier(filename, "raw", context.getpackagename()); if(sound_id != 0) { mediaplr = mediaplayer.create(context, sound_id); mediaplr.start(); } } i prefer start variable names small letters, rather capital. helps distinguish static class. you can create map store id further reuse instead of retrieving identifier each time.

c# - how to store mysql connection data safely? -

this question has answer here: asp.net connectionstring in secure way 7 answers i'd begin new project , 1 of first problems i've figured out security of mysql connection data. i want know if it's possible configure software choose database server; reason it's necessary store connection informations (user, password, databasename) in kind of file (xml, bin, ...) thats not safe , viewed due lack of encryption. is there easy way protect these sensitive informations or have write own encryption mechanism ? in case have write own one, there guideline right? no, don't need write own encryption it, .net have encryption. simply use rijndael (aes) - encryption. import namespace: using system.security.cryptography; then use class: rijndael class and take @ thread: how generate rijndael key , iv using passphrase? use encryption properl

php - Add a Title and fields in a table got from mysql -

i have function returns table generated values in database. function returns table in format: total ss fai user rate 99 12 87 example.of@mail.com 78 21 21 0 xxx.zzzzz@domain.com 12 35 35 0 unknown address 16 60 60 0 002154251 3 here's function use: function table($tab) { echo '<br /><table border ="3">'; echo '<tr>'; foreach($tab[0] $cle=>$val) { echo "<th>".$cle."</th>"; } echo '</tr>'; foreach($tab $cle1=>$line) { echo '<tr>'; foreach($line $cle2=>$val) { echo '<td>'.$val.'</td>'; } echo '</tr>'; } echo '</table><br />'; } i add column "type" , written in won't d

ruby - Why do I get "Undefined method ::new" in simple classes? -

i writing atm-system-like socket/server solution. appreciate if tell me i'm missing. reason, following error running stub test suite: # running tests: .e finished tests in 0.002411s, 829.4384 tests/s, 414.7192 assertions/s. 1) error: test_0001_connects_to_a_host_with_a_socket(atmclient::connection): nomethoderror: undefined method `new' #<spoofserver:0x9dce2dc @clients=[], @server=#<tcpserver:fd 5>> /media/wildfyre/files/programming/kth/progp/atm/spec/client/spoofserver.rb:12:in `start' /media/wildfyre/files/programming/kth/progp/atm/spec/client/client_spec.rb:12:in `block (3 levels) in <top (required)>' 2 tests, 1 assertions, 0 failures, 1 errors, 0 skips my minispec file is: require_relative '../spec_helper.rb' require_relative '../../lib/atmclient.rb' require_relative 'spoofserver.rb' describe atmclient "can created no arguments" atmclient.new.must_be_instance_of atmclient end des

jquery - Javascript onchange select list -

please can help? i have below select list: <td>call lead type: </td> <td> <select name="callleadtype" id="callleadtype"> <option value=""></option> <option value="lsg service warm transfer claims">lsg service warm transfer claims</option> <option value="ivr direct call">ivr direct call</option> <option value="transfer ee agent">transfer ee agent</option> <option value="dropped line">dropped line</option> <option value="test call ee">test call ee</option> </select> </td> when user selects "transfer ee agent" need 4 new input boxes appear not appear when of other options selected? so assume it's onchange code needs? i'm not sure how thanks in advance help padders you require javascript code display other

windows phone 8 - how to load html with javascript in wp8 web browser control? -

i have web browser control in windows phone 8. want load html in web browser control my html string is string htmlstring= " <html> <head> <title>kayako chat</title> </head> <body><!-- begin fusion tag code - not edit! --> <div> <div id=\"proactivechatcontainer6bahdzbxzq\"> </div> <table border=\"0\" cellspacing=\"2\" cellpadding=\"2\"> <tr><td align=\"center\" id=\"swifttagcontainer6bahdzbxzq\"> <div style=\"display: inline;\" id=\"swifttagdatacontainer6bahdzbxzq\"> </div> </td></tr> </table> </div> <script type=\"text/javascript\"> var swiftscriptelem6bahdzbxzq=document.createelement(\"script\"); swiftscriptelem6bahdzbxzq.type=\"text/javascript\"; var swiftrandom = math.fl

c++ - Can I provide readonly access to an OpenCV matrix? -

i have class combines number of opencv's cv::mat matrices. is there way can provide both const accessors allowing clients read not write underlying data, , non-const accessors allowing clients read , write data. i'm thinking of doing this: class myclass { cv::mat a; public: cv::mat a() { return a; } const cv::mat& a() const { return a; } }; but protect underlying data being modified through const accessor? or protect cv::mat's header data? if forced provide access cv::mat object itself, out of luck. data access through data pointer possible on const cv::mat . thus, code: const cv::mat test = cv::mat::ones(3, 3, cv_8uc1); test.data[3] = 4; will compile , execute. however, if need provide access data, provide wrapper functions cv::mat::begin() , cv::mat::end() , allow read-only access on const cv::mat : class myclass { cv::mat a; public: cv::matiterator_<uchar> begin() {return a.begin<uchar>();} cv::ma

python - How to reuse / clone an sqlalchemy query -

it seems me going through whole process of creating expression tree , creating query again wasted time when using sqlalchemy. apart occasional dynamic query, same during whole life of application (apart parameters of course). is there way save query once it's created , reuse later on different parameters? or maybe there's internal mechanism similar? it seems me going through whole process of creating expression tree , creating query again wasted time when using sqlalchemy. do have estimates on how time wasted, compared rest of application? profiling here extremely important before making program more complex. note, reddit serves on 1 billion page views day, use sqlalchemy core query database, , last time looked @ code make no attempt optimize process - build expression trees on fly , compile each time. have had users have determined specific system benefits optimiztions in these areas, however. i've written background on profiling here: how can pr

string - PHP how to display the 5 most reccurent words in a list -

i have list in visited websites stored (a thousand), , need display top 5 visited websites : $websites= "site#1.com site#2.com site#1.com site#1.com site#3.com ... " this deliberately verbose understand what's going on: <?php $websites = "site#1.com site#2.com site#1.com site#1.com site#3.com"; //presuming they'll seperated single space... $sites = explode(' ', $websites); $sitecount = array(); foreach ($sites $site) { if (!isset($sitecount[$site])) { $sitecount[$site] = 1; } else { $sitecount[$site]++; } } arsort($sitecount); $finalarray = array_slice($sitecount, 0, 5); var_dump($sitecount); which outputs: array(3) { ["site#1.com"]=&gt; int(3) ["site#3.com"]=&gt; int(1) ["site#2.com"]=&gt; int(1) }

android - How can I get the username or email address from oauth? -

i'm using oauth in android application log in it. extract username or email address after successfull logging in? there way it? if yes - how? i found this: extracting gmail username oauth access token don't know how use it well digg internet till end , come this: private string usernamereader() { string jsonoutput = ""; try { jsonoutput = makesecuredreq(constants.api_request, getconsumer(this.prefs)); jsonobject jsonresponse = new jsonobject(jsonoutput); jsonobject m = (jsonobject) jsonresponse.get("feed"); jsonobject email = (jsonobject) m.get("id"); jsonoutput=email.getstring("$t"); } catch (exception e) { log.e("errroro", "error executing request", e); // console.settext("error retrieving contacts : " + jsonoutput); } return jsonoutput; } private string m

Kendo Datasource Transport custom function not getting called -

im experiencing rather annoying bug (?) in kendo ui datasource. my update method on transport not getting called when pass custom function, work if give url. this works: ... transport: { update: { url: "/my/action" } } ... this not ... transport: { update: function(options) { var params = json.stringify({ pageid: pageid, pageitem: options.data }); alert("update"); $.ajax({ url: "/my/action", data:params, success:function(result) { options.success($.isarray(result) ? result : [result]); } }); } } ... the function not getting invoked, ajax request made current page url, , model data being posted, rather odd. sounds bug me. the reason have need this, because kendo can't figure out update action returns single element, , not array - so, since dont want bend api satisfy kendo, though i'd other way around. hav

jquery - How to wrap apex:columns in a div to use in slideToggle() -

i trying have jquery slidetoggle() function bound row of data in apex:pageblocktable. i displaying information in table , want if clicks on row, more information related contact displayed in slider , rest of rows move down. when clicks again, slider moves , normal. if not wrong, think need bind row elements (apex:columns) in 1 div , information in slider in other. somehow not working. here code: <apex:page controller="xingshowsearchresult"> <head> <style type="text/css"> #rowinfo,#rows{ padding:5px; text-align:center; background-color:#e5eecc; border:solid 1px #c3c3c3; } #rowinfo { width:50px; display:none; } </style> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script> <script> $j = jquery.noconflict(); $j(document).ready(function(){ $j("#rows").click(function(){ $j("#rowinfo").slidetoggle("slow&quo

.net - Handling excel times imported from excel using Microsoft.ACE.OLEDB C# -

i importing excel file using c# , jetoledb (microsoft.ace.oledb excel 2010 , beyond) , , using following code: var filename = @"c:\myexcel.xlsx"; var connectionstring = string.format("provider=microsoft.ace.oledb.12.0;data source={0}; extended properties=excel 12.0;", filename); var adapter = new oledbdataadapter("select * [sheet1$]", connectionstring); var ds = new dataset(); adapter.fill(ds, "anynamehere"); system.data.datatable data = ds.tables["anynamehere"]; the problem when trying import datetime values, these values returned excel times, example "03/01/2013" returned 41334. how transform these values .net datetime, , how check if date time values or normal doubles

ios - Delay between animation cycle on a UIImageView -

i have uiimageview called imgview, have array of images, like, imagearray objects: [uiimage imagenamed:@"test4.png"], [uiimage imagenamed:@"test5.png"], [uiimage imagenamed:@"test6.png"], [uiimage imagenamed:@"test7.png"], nil]; then have added array images in imgview animation, like imgview.animationimages = imagearray; imgview.animationrepeatcount = 0; imgview.animationduration = 2.0f; [imgview startanimating]; here every thing works fine. have delay 5sec after 1 cycle of animation finishes. how can this, have used [self performselector:@select... but not working, please give me idea. try this: -(void) viewwillappear:(bool)animated { [super viewwillappear:yes]; [self animationmethod]; //where start animation } -(void) animationmethod { nsmutablearray *imagearray = [[nsmutablearray alloc] initwithobjects:[uiimage image

What Are Twitter API Get trends limits? -

i working on application making multiple requests daily of current trending topics every location @ time.. before continue working know if there limit in making requests twitter in terms of quantity of queries can make, , if there is, there way of doing that? thanks lot twitter has well-definied api rate limiting policy. can read here: https://dev.twitter.com/docs/rate-limiting/1.1 you can around these limits implementing token sharing hack - see question 1 specific approach: using twitter access tokens interchangeably (ie. use 1 user's token user)?

c# - Public variable invoking incorrect result -

public partial class thanglishtotamilgui : form { public string anz; public thanglishtotamilgui() { initializecomponent(); } public void btnconverttobraille_click(object sender, eventargs e) { anz = richtextboxtamil.text.tostring(); gui.tamiltobraillegui c1 = new gui.tamiltobraillegui(); c1.visible = true; } } i need pass richtextbox (richtextboxtamil) content variable call anz. i retrriving anz variable in other form form load event: private void tamiltobraillegui_load(object sender, eventargs e) { thanglishtotamilgui tt = new thanglishtotamilgui(); string apper = tt.anz; richtextboxtamil.text = apper; } my problem: getting null values result. since if assigned values invoked correctly. public partial class thanglishtotamilgui : form { public string anz = "hai"; public thanglishtotamilgui() { initializecomponent(); } .

javascript - displaying image hover graph in rickshaw, jquery or d3.js -

do know whether images can displayed on mouse hover event on rickshaw or d3 graph. if please state example. in advance. appreciated. looks there sample here https://github.com/shutterstock/rickshaw/blob/master/examples/hover.html edit render event want: graph.render(); var legend = document.queryselector('#legend'); var hover = rickshaw.class.create(rickshaw.graph.hoverdetail, { render: function(args) { legend.innerhtml = args.formattedxvalue; args.detail.sort(function(a, b) { return a.order - b.order }).foreach( function(d) {

Vagrant file structure and web root -

i've read docs , few things still confuse me, related sync folders , database data. i want use following folder structure on host machine root |- workfolder ||- project1 |||- project1databaseandfiles |||- project1webroot ||- project2 |||- project2databaseandfiles |||- project2webroot ||- project3 |||- project3databaseandfiles |||- project3webroot and create vm's each vm host webroot points appropriate projectx/projectxwebroot folder. i've read, can specify 1 remote sync dir. ( http://docs.vagrantup.com/v2/synced-folders/ ). if create new vm want specify project name too, thereby selecting correct host folder. is i'm describing possible using vagrant? if wanted developer use environment, i'd them have instant access database structure/setup etc without having import sql files. possible? i'm hoping i'm not understanding vagrants purpose, seems use of shared vm's me. pointers or articles might welcome. from i've r

ios - NSLog disable from certain classes and DEBUG -

hello guys have found code used create different nslog (without data , timestamps) displays class log made , line number. have read possible disable logging classes no_log there not explained how use exactly, quite new obj-c , appreciate explanation on how disable logging classes , how activate , deactivate debugging. thanks #define makestring(__va_args__) #__va_args__ #define tostring(...) makestring(__va_args__) static inline void pxreportv(bool dolog, char const *file, int line, nsstring *prefix, nsstring *fmt, va_list arglist) { if (dolog) { nsstring *filenamewithextension = [[nsstring stringwithformat:@"%s", file] lastpathcomponent]; #ifdef no_log nsstring *filename = [filenamewithextension stringbydeletingpathextension]; char *f = tostring(no_log); nsarray *comps = [[[nsstring alloc] initwithformat:@"%s", f] componentsseparatedbystring:@","]; (nsstring *except in comps) { if ([except isequaltostring:filenam

sql - phpmyadmin mysql error 1064 when creating table -

what wrong? ran ddl against mysql , , giving error #1064 - have error in sql syntax; check manual corresponds mysql server version right syntax use near 'varchar2(250) not null, bio varchar2(250) not null, id number(10) not' @ line 2 here's ddl: create table dw.books( bio varchar2( 250 ) not null , id number( 10 ) not null , revenue varchar2( 20 ) , primary key ( id ) ); you confusing oracle , mysql. mysql doesn't provide either varchar2 not number . please see this page data types differences in oracle , mysql. create table dw.books( bio varchar(250) not null , id int(10) not null , revenue varchar(20) , primary key (id) );

dojo - How to capture dojox.layout.FloatingPane resize event? -

when floatingpane change size, launch function. think there resizehandle not know how do. use dojo 1.8+. thanks indeed, have define event handler resize handler of floating pane. for example: require(["dojo/on"], function() { var floatingpaneobj = ...; ... floatingpaneobj.startup(); on(floatingpaneobj._resizehandle, "resize", function(e) { // event handler }); }); i made working jsfiddle demonstrate it. http://jsfiddle.net/8azsz/2/

sqlalchemy - How to change OpenStack Ceilometer MySQL reporting password -

have asked question on ask openstack, few views , no responses. i'm trying use sqlalchemy (basically mysql) driver , have found password driver attempts use set ''. password driver used reporting api, not collection. i assume default set somewhere, can't find it. have looked through config , setup files, , tried find cfg object created, , traced through debugger. the reason know it's password problem because when mysql password set other '', driver encounters mysql authentication error. when set database password (in mysql root user) empty, driver can authenticate. my localrc has mysql_password set 'password', driver can't authenticate when mysql uses password. anyone know set password driver? i found it, file ceilometer/storage/__init__.py contains struct called storage_opts . adding similar entry array cause use db of choice: cfg.stropt('database_connection', default='mysql://root:password@local

c++ - Best approach to interface (abstract classes) design? -

i've searched on topic couldn't find relevant answer... suppose have abstract class declared : class abstract{ virtual interface* createhandle() = 0; virtual ~abstract() = 0; }; basically, abstract class provides unique function returns implementation of class interface (also abstract class). i'm wondering how can error handled such design. if createhandle() encounters error , cannot return pointer implementation of interface, what's best way handle , notify ? the first thing came mind return null pointer, , check in calling code if returned pointer null. work, find quite poorly designed, because interface (namely abstract) never implies createhandle() can return null pointer, or will return null pointer signal error (and find quite bad fact of leaving comment saying "should return null if error"). then, thought of carrying information in interface pointer. is, adding 2 public non-virtual function class set/get sort of error code.

C++ Python import class; call methods -

i using python 2.7. not clear me how embed python inside c++ found here: http://docs.python.org/2.7/extending/embedding.html . i have simple python example here in file named test.py: class math: #def __init__(self): def add(self, num1, num2): return num1 + num2 def subtract(self, num1, num2): return num1 - num2 from python, this: >>> test import math >>> m = math() >>> = m.add(1, 2) >>> s = m.subtract(1, 2) i have beginning of c++ code this: pyobject *pname, *pmodule; py_initialize(); pname = pystring_fromstring("test"); pmodule = pyimport_import(pname); that seems work fine. but, seems equivalent of doing in python: import test how import python class math? thanks here's quick n' dirty example in c equivalent of... >>> import mymath >>> m = mymath.math() >>> print '1 + 2 = %d' % m.add(1, 2) note i've renamed module test mymath

php - Phpunit: Testing files outside the testsuite -

i'm having problem when running phpunit on tests directory. default class inheritence this: controllertest > projecttestcase > zend_test_phpunit_controllertestcase . both projecttestcare zend_test_phpunit_controllertestcase located outside tests directory. this phpunit.xml looks like: <phpunit bootstrap="./bootstrap.php" colors="true" stoponfailure="true"> <testsuite name="application test suite"> <directory suffix="controllertest.php">./application/controllers</directory> </testsuite> <filter> <whitelist> <directory>../../library/zend</directory> <directory>../../library/doctrine</directory> </whitelist> </filter> the problem finds projecttestcase , aborts because contains no errors. it doesn't match testsuite directory and doesn't match suffix pattern. anyone has encountered problem or ha

JQuery AJAX call throws Access-Control-Allow-Origin Error -

i'm working on project after using $.ajax make request, receive access-control-allow-origin error. however, request sent server , response expected xml string. because of error, success function never fires, can't read xml response, can see in logs. error function doesn't reference response string, nor complete function. is there way @ response regardless of whether or not ajax request fails? unfortunately don't have access server modify origin restriction, own box. on response of server have set: access-control-allow-origin: * be carefull because '*' server able respond without checking crossdomain restriction. if want can put domain make request. if use php: <?php header('access-control-allow-origin: *'); ?>

sql server - How can I split a comma-delimited value into multiple rows? -

i have table1 query string pulls following remote table whereby mykeys comma-delimited list: table1: mykeys varchar, mycount int, mycomment varchar i need update local 2008r2 table based on: table2: split somehow - mykeys int, mycount int, mycomment varchar currently, have ssis package pulls information , creates local table. i've seen answers using functions feed select statement (e.g. mykeys ), nothing includes multiple fields e.g. ( mykeys , mycount , mycomment ). maybe make ragged right or fixed length destination , have comma text qualifier?

string - How to use argument of a function as name of variable? -

i have feeling trivial, , apologize asking such easy questions, appreciate following problem: have function requires 2 arguments: myfun <- function(fm, name){ ... } the data frame used can via dat <- eval(fm$call$data) inside function. inside dat , there variable name identical second argument, i.e. there variable dat$name (note second argument of function not include reference dataframe, i.e. name not equal dat$name name ) , use variable. q: how can that? concrete example: following serves example: air <- data(airquality) fm <- lm(ozone ~ solar.r, data=airquality) myfun <- function(fm, name){ df <- eval(fm$call$data) name[1:5] } myfun(fm, temp) the purpose of function show first 5 elements of variable name in dataframe has been used fitting fm . however, name not recognized variable in corresponding data frame. neither wrapping with(df, ...) , df$name or equivalent solutions trick. how work? edit: have played around bit furt

aspectj - spring aop - exception while creating advice around JdbcTemplate methods -

i've web application uses apache dbcp , spring jdbc perform database operations on oracle database. need write performance logger logs individual times of each database operation. tried writing around advice on 'execute' methods of org.springframework.jdbc.core.jdbctemplate results in error when spring gets initialized. logger class , exception stacktrace follows:- i tried use cglib proxies enabling errors out on dao classes extends spring's storedprocedure class , use constructor injection. @aspect public class logger { @around("this(org.springframework.jdbc.core.jdbctemplate) && execution(* execute(*))") public object invoke(proceedingjoinpoint pjp) throws throwable { long time = system.currenttimemillis(); object result = pjp.proceed(); logger.debug("time consumed = " + (system.currenttimemillis() - time)); return result; } exception stacktrace: severe: exception sending context initialized event listener inst

python - Appending list elements to a symarray -

i'm trying add numpy arrays single array, code looks like: m1=symarray('', 2) in range(0,len(countersum)): if countersum[i]==1: m1.append(gmcounter[i]) this give error attributeerror: 'numpy.ndarray' object has no attribute 'append' i have tried changing append vstack gives same error if modify last line have m1=gcounter[i] works selects first element of gcounter meeting condition, , disregards afterwards. does know how can resolve this? i have seen thread append numpy array numpy array unable declare need append numpy array beforehand. many thanks @bakuriu correct, can not extend numpy array without copying. however, depending on application, can convert numpy array list , manipulate there: m1 = sympy.symarray('', 2) m2 = list(m1) x = sympy.symbols('x') m2.append(x) print m2 this gives >>> [_0, _1, x]

c# - Compare month of year enum with datetime month -

i have enum: public enum monthsoftheyear { january = 1, february = 2, march = 4, april = 8, may = 16, june = 32, july = 64, august = 128, september = 256, october = 512, november = 1024, december = 2048, allmonths = 4095, } and datime.now.month. for example if value of month 5 equals "may", how can compare month enum? example not work: if (!monthsofyear.any(x=>x.code.equals((monthsoftheyear)(1 << (currentdatetime.month - 1))) this bit of strange way represent month, not difficult want. the operator need left bit shift operator , << . if imagine number string of bits, 0000 0000 1111 0000 (240 in binary) then bit shift operators shift them number of places left or right; shifting left 1 0000 0001 1110 0000 (480 in binary) in case, january bit 1 shifted left 0 times, february bit 1 shifted left 1 time, , on: int may = 5; monthsoftheyear result = (monthsoftheyear)(1 << (ma

linux - cmake : error : 'AT_SYMLINK_NOFOLLOW' undeclared -

i getting following error when compiling cmake. error: 'at_symlink_nofollow' undeclared what cause of error please suggest. bug in raspbian because defined in following file fcntl.h per google. http://lxr.free-electrons.com/source/include/uapi/linux/fcntl.h#l44 [ 37%] building c object utilities/cmlibarchive/libarchive/cmakefiles/cmlibarchive.dir/archive_read_disk_posix.c.o /home/ignite/rpi_package_sb2/cmake-2.8.10.2/utilities/cmlibarchive/libarchive/archive_read_disk_posix.c: in function 'tree_current_lstat': /home/ignite/rpi_package_sb2/cmake-2.8.10.2/utilities/cmlibarchive/libarchive/archive_read_disk_posix.c:2139:7: error: 'at_symlink_nofollow' undeclared (first use in function) /home/ignite/rpi_package_sb2/cmake-2.8.10.2/utilities/cmlibarchive/libarchive/archive_read_disk_posix.c:2139:7: note: each undeclared identifier reported once each function appears in make[2]: *** [utilities/cmlibarchive/libarchive/cmakefiles/cmlibarchive.dir/archive_rea

classification - How to use MFCC vectors for classifying a single audio file? -

this silly question, couldn't find details anywhere. so have audio recording (wav file) 3 seconds long. sample , needs classified [class_a] or [class_b]. by following tutroial on mfcc, divided sample frames (291 frames exact) , i've gotten mfccs each frame. now have 291 feature vectors, length of each vector 13. my question is; how use vectors classifier (k-nn example)? have 291 vectors represent 1 sample. know how work 1 vector 1 sample, don't know if have 291 of them. couldn't find explanation anywhere. each of vectors represent spectral characteristics of audio file, varies in time. depending on length of frames, might want group of them (for example averaging dimension) match resolution want classifier work. example, think of particular sound might have envelope attack time of 2ms: may fine-grained want time quantization a) group , average number of mfcc vectors represent 2ms; or b) recompute mfccs desired time resolution. if want keep resolut

javascript - ClosureCompiler removing dead code with advanced optimizations -

the following code: (function() { var hello = function(name) { alert('hello, ' + name); } hello('new user'); })(); with advanced_optimizations compiled to: alert("hello, new user"); but code: (function() { var hello = function(name) { alert('hello, ' + name); } hello.a = 5; hello('new user'); })(); is compiled to: function a(b){alert("hello, "+b)}a.a=5;a("new user"); why cannot ignore hello.a = 5 ? (it cannot used outside context, there no eval , no [] , no new function() .) for work, compiler need determine no 1 had replaced "alert" function looked @ the calling function: alert = function() { console.log(arguments.callee.caller.a); } but "alert" external function there no way determine does. generally, javascript mutable cases properties can safely removed functions rare isn't worth effort find them. generally, closure compiler can remove propertie

php - Best ways in which to conduct background tasks -

using php, want have scheduled tasks based upon time server running. say @ 7pm on sunday want database query ran. the way in i've considered doing put task in script ran on each page load in session init. any ideas? one method automatically run php script @ specified time intervals use crontab. can particularly beneficial scripts need automatically update information without user interaction such script gathers website statistics can emailed or script regularly retrieves content website. see: php cli , cron

statusbar - iOS - Can I make the status bar look like the in-call -

i need status bar there call , execute piece of code when user taps status bar. possible. can't find api allowing me play status bar yes, you can use show messages in status bar (or "like in status bar"): https://github.com/petersantino/twstatus and can put gesturerecognizer on top of or button in order catch tap of user ( enabling when desired event happening). hope helps.

HighCharts legend.value and legend.percent items to 2 decimal points Math.Round() -

unfortunately how lengthy thing don't have fiddle it, didn't build it, trying assure these values set 2 decimal points, regardless of value of it. if it's 100, want read 100.00 , seemingly issue having. code section, replaces template value this; if (islegend) { if (legendfootertemplate) { legendfooterdata = legendfootertemplate.replace("highcharts.value", addcommastolargenumber(math.round(totalvalues * 100) / 100)); legendfooterdata = legendfooterdata.replace("highcharts.percent", math.round(totalpercent)); legendtable.append("<tr>" + legendfooterdata + "</tr>"); } //make legend visible legendtable.css("visibility", "visible"); } you can see adds commas larger numbers , takes formatted number , plugs template highcharts.value , highcharts.percent live. want know how can manipulate math.ro

sql server - SQL 'stuff' and 'FOR XML PATH' generating strange symbols -

i have following query inside larger select statement in sql server: convert(nvarchar(2000),stuff((select '; ' + isnull(d2.selectedcomments,'') #studentdetails d2 d2.stud_pk = a.stud_pk , d2.courseno = a.courseno , d2.section = a.section xml path('')),1,2,'')) selectedcomments, this column generating strange symbols after entries such this approach satisfactory .&#x0d . don't understand .&#x0d coming from. tried doing select selectedcomments #studentdetails right before , don't see .&#x0d . can tell coming from? if modify use of xml path, unescaping , won't need resort using replace function: , stuff( ( select '; ' + isnull( d2.selectedcomments, '' ) #studentdetails d2 d2.stud_pk = a.stud_pk , d2.courseno = a.courseno , d2.section = a.section xml path(''), type ).value('.', 'nvarchar(max)')

bash - Shell Script to replace multiple instances of unix timestamps in a file -

i have file has data similar following: > <element > stream="12" > target_trans="133106" > trans="48467" > filemodtime="1358349304" > type="1" > eol="0" > user_id="33" /> <element > stream="14" > target_trans="133106" > trans="48467" > filemodtime="1358539304" > type="1" > eol="0" > user_id="33" /> <element > stream="11" > target_trans="133113" > trans="48467" > filemodtime="1158539204" > type="1" > eol="0" > user_id="33" /> <element > stream="11" > target_trans="133106" > trans="48

unit testing - jQuery Trigger event but still have event.isTrigger false -

jquery provides istrigger property allows know if event "real event" or "triggered". $(ele).on("click", function(e){ if(e.istrigger){ // event triggered, not real event }else{ // real event } }) for unit-testing purposes, there way trigger event , somehow overwrite istrigger property.. , in event callback still behave (by having istrigger === false ) if real click event.. trying following code: var triggerclick = jquery.event("click", { istrigger:false, data:{ istrigger:false } but doesn't seem pass correctly.. how native way, avoiding jquery istrigger altogether: function simulateclick(elem) { var evt = document.createevent("mouseevents"); evt.initmouseevent("click", true, true, elem, 0, 0, 0, 0, 0, false, false, false, false, 0, null); if (document.createevent) { elem.dispatchevent(evt); } else { elem.fireevent("o

java - How to create and start a dream service atomatically android -

i trying start dream service. currently, code: @suppresslint("newapi") public class dreamlockservice extends dreamservice { private static final string tag = "dreamlockservice"; public utility utilobj = new utility(); //private button btnexit; private button btnlogin; private edittext lgpass; @override public void onattachedtowindow() { super.onattachedtowindow(); // exit dream upon user touch setinteractive(true); // hide system ui setfullscreen(true); // set dream layout setcontentview(r.layout.lockservice); //setclicklistener(); toast.maketext(this, "lock service created", toast.length_long).show(); } //use initial setup, such calling setcontentview(). @override public void ondreamingstarted() { super.ondreamingstarted(); // exit dream upon user touch setinteractive(true); // hide system ui

linux - read raw input from keyboard in python -

Image
i'm trying raw input of keyboard in python. have logitech gaming keyboard programmable keys, logitech doesn't provide drivers linux. thought (try) write own driver this. in think solution like: with open('/dev/keyboard', 'rb') keyboard: while true: inp = keyboard.read() -do something- english isn't native language. if find errors, please correct it. two input methods rely on os handling keyboard import sys line in sys.stdin.readlines(): print line this 1 "simple" solution problem considering reads sys.stdin you'll need driver , if os strips stuff along way break anyways. this solution (linux afaik): import sys, select, tty, termios class nonblockingconsole(object): def __enter__(self): self.old_settings = termios.tcgetattr(sys.stdin) tty.setcbreak(sys.stdin.fileno()) return self def __exit__(self, type, value, traceback): termios.tcsetattr(sys.stdin, ter

java - What is registration ID in Android and how does it creates internally? -

i'm new android , don't understand concepts.what registration id used in google cloud messaging?how creates internally - unique device id apple device token or else?how differs application id? may stupid question don't understand concepts. is temporally id allows gcm services identify device-application, trough server can send messages gcm , redirect device. more info here in advance copy text: an id issued gcm servers android application allows receive messages. once android application has registration id, sends 3rd-party application server, uses identify each device has registered receive messages given android application. in other words, registration id tied particular android application running on particular device.

CSS column widths: "as wide as needed" and "whatever's left" -

i have webpage looks like: <table> <tr> <td style=white-space:nowrap> lots of content... </td> <td> more content </td> </tr> </table> this works nicely. left column takes width needs , right column takes as can. right column includes lot of automatic line-wrapping. i'd in pure css because semantically speaking there's nothing tabular. try either requires hard-coding widths or puts right column underneath left column. there way? float left column, , make right column non-floated overflow:hidden . cause right column automatically fill remaining width, without wrapping around below left column. jsfiddle demo .column1 { float: left; } .column2 { overflow: hidden; } this trick tested fine in browsers except ie6 (which shouldn't matter @ point).

Making call to server when application is in background in Windows Phone 8 -

i want make http request web server periodically after every 10 secs. i using timer in application makes http call. when application goes background when user press windows key.. timer stops can continue making call web server? i referred void chatter box application, looks voip application only. regards, srs you have make taskagent inherits scheduledtaskagent , override oninvoke() method. need add task wmappmanifest.xml <deployment ...> ... <app ...> ... <tasks> <defaulttask name="_default" navigationpage="mainpage.xaml" /> <extendedtask name="backgroundtask"> <backgroundserviceagent name="yourtaskagent" type="yournamespace.yourtaskagent" source="yourtaskagent" specifier="scheduledtaskagent" /> </extendedtask> </tasks> ... </app> ... </deployment> your main application cannot continue

php - ajax link json datatype call -

i want send data via ajax other page. have isolated problem. code. thank help..but no effect.. updated code it worked... <script> $(document).ready(function(){ $(".edit").click(function(event) { event.preventdefault(); //<--- prevent default behaviour var box = 1233; var size=123; var itemname=123; var potency=123; var quantity=12333; var datastring ={ 'box' :box, 'size':size , 'itemname':itemname, 'potency':potency, 'quantity':quantity }; $.ajax({ url: "dd.php", type: "post", data: datastring, success: function(data) { alert(data); }, error: function(data) { alert(data); } }); }); }); </script> so click lin

linux - How to enter C-M-b in Emacs under a windows keyboard? -

i running linux on vm under windows. when using emacs on linux, since keyboard doesn't have meta key, meta key command pressing esc, release it, , press subsequent letter key. what if command ctrl-meta-b? previous esc way wouldn't work since cancels ctrl. suggestion welcome. (emacs , linux noob here, please don't laugh , specific.) first hit esc , , ctrl + b . escape keypress applies entire following key combination.

javascript - How to define a "type" in AMD/RequireJS style -

i'm working on durandal spa, , i've setup views , viewmodels. i'm unclear how should creating "model" objects on client side. instance, let's want define , create "person" model object. everything else in app defined amd style. allows durandal/requirejs automatically load files needs. so, first thought might define "person" model type in models/person.js file, this: define(function () { var id = ko.observable(0); var firstname = ko.observable(''); var lastname = ko.observable(''); return = { id: id, firstname: firstname, lastname: lastname, }; }); however, don't think right, because here don't think there's way create individual "person" objects. instance, let's wanted create 2 "person" objects. durandal/requirejs happily load in "person" module, it's 1 object--and may want create instance of "person" typ

facebook - Anyway to get app info into OAuth Dialog -

i know has been posted before, haven't seen definitive answer bunch of "i thinks" or no answer. facebook documentation shows more in depth dialog box information app developer tool. however, seem box asking permissions. this going page tab, user won't see app details page , want describe them why i'm asking i'm asking for. answer points go either a)how it, or b)documentation showing can't done. thanks, andrew looks facebook documentation out of date. has since been updated. app information not in dialog box.

c# - Static context menu command target -

i have following context menu on header of column in datagridview. <datagridcheckboxcolumn binding="{binding include,updatesourcetrigger=propertychanged}" width="50"> <datagridcheckboxcolumn.headertemplate> <datatemplate> <textblock text="export"> <textblock.contextmenu> <contextmenu> <menuitem header="alle auswaehlen"/> <menuitem header="alle abwahelen"/> </contextmenu> </textblock.contextmenu> </textblock> </datatemplate> </datagridcheckboxcolumn.headertemplate> </datagridcheckboxcolumn> as can see, context menu static. how can map command attribute static methods in code? examples found online flexible binding or cut/copy. you use click event instead: <menu

How to express "is null" sql syntax in linq to sql -

how can express "is null" sql syntax in linq sql? where(r => (r.level1.equals(l[1] == "" ? null : l[1])) in above code linq sql converts linq expression following sql not want. @p1=null i want linq converted following sql @p1 null how can achieve this? try this if (l[1] == "") where(r => (r.level1 == null)); else where(r => (r.level1 == l[1])); if use ternary operator expression evaluator find it's expression returning string, cause of it'll use = operator.

python - simpler implementation of this string splitting loop -

i have function receives string dot delimited. want loop through value building , running code each level. here implementation: def example(name): module = [] in name.split('.'): module.append(i) print '.'.join(module) #do stuff here output >>> example('a.b.c.d') a.b a.b.c a.b.c.d but feels long winded. i'm looking simpler, cleaner or shorter implementation. split once, slice it: s = 'a.b.c.d' items = s.split('.') print [items[:i] in xrange(1, len(items) + 1)] # [['a'], ['a', 'b'], ['a', 'b', 'c'], ['a', 'b', 'c', 'd']]

ubuntu - How to start Tomcat as non root on boot -

how start tomcat under different user on boot? i've tried following command prompts password. su -c "/etc/tomcat/bin/catalina.sh start" tomcat i'm using tomcat 7.0.40 , ubuntu 12.04. use jsvc , read tomcat jsvc manual or install package tomcat7 .

html - IE9 sometimes switching to Document Mode: IE7 Standards -

i imagine might quick , easy question who's more familiar ie browser modes. we have intranet application window that's switching 'document mode: ie7 standards' (w/ browser mode: ie9) per dev tools -- relatively rarely, it's hard tell leads issue. result form fields jumbled, css/floats skewed, scripts don't work right, etc. once problem occurs, way solve close browser , restart internet explorer. we found user while experiencing glitch, opened dev tools, , confirmed document mode had set ie7 , changing ie9 fixed everything. still, once has set ie7, way default ie9 close out of browser. otherwise, if close window not whole browser, it's ie7 each time open window. i don't know causing issue intermittently. thought doctype? can offer advice? <%@ page language="c#" autoeventwireup="true" codebehind="appscreen.aspx.cs" inherits="project.appscreen" %> <%@ register assembly="ajaxcontroltool

php - $_GET the value of (&) with AJAX -

i have 3 codes first 1 html : <html> <head> <script type = "text/javascript" src = "ajax.js"></script> </head> <body> <form method = "get" > <input type = "text" id ="a" ><br> <input type = "text" id = "b"><br> <input type = "button" value ="click" onclick = "process()"><br> <textarea id = "underbutton" ></textarea><br> </form> <body> </html> now javascript (ajax) : function process() { if(xmlhttp.readystate==0 || xmlhttp.readystate==4){ = document.getelementbyid("a").value; b = document.getelementbyid("b").value; xmlhttp.onreadystatechange = handleserverresponse; xmlhttp.open("get","file.php?a="+a+"&b="+b,true); xmlhttp.send();