Posts

Showing posts from July, 2010

scheme - SICP - Which functions converge to fixed points? -

in chapter 1 on fixed points, book says can find fixed points of functions using f(x) = f(f(x)) = f(f(f(x))) .... what functions? it doesn't work y = 2y when rewrite y = y/2 works does y need smaller everytime? or there general attributes function has have find fixed points method? what conditions should satisfy work? according banach fixed-point theorem , such point exists iff mapping (function) contraction. means that, example, y=2x doesn't have fixed point , y = 0,999... * x has. in general, if f maps [a,b] [a,b] , |f(x) - f(y)| should equal c * |x - y| 0 <= c < 1 (for x, y [a, b]).

What is the <base> element in HTML for? -

i learning how code on w3schools.com. there explanation on it's not helping. says "defines default address or default target links on page" why need this? you don’t need base element. used when most urls on page refer site other site of page; in case, <base href="..."> lets use relative urls those; other urls must absolute. in past, <base target=...> used on frameset pages in order make link open in particular frame.

c - Swap two pointers using XOR -

i have quick question using xor 2 swap 2 string literals. so have following: #include <stdio.h> #include <stdlib.h> #include <string.h> void intswap(int *a, int *b){ *a=*a^*b; *b=*a^*b; *a=*a^*b; } void swapstring(char **a, char **b){ char *temp=*a; *a=*b; *b=temp; } void main(){ char *s= "ha"; char *t= "oh"; printf("%s , %s \n",s,t); // prints ha oh swapstring(&s,&t); printf("%s , %s \n",s,t); // prints oh ha int a=10; int b=5; printf("%d %d\n",a,b); //print 10 5 intswap(&a,&b); printf("%d %d\n",a,b); //print 5 10 } as can see, used binary operation xor intswap. however, when tried same thing swapstring, it's not working. i error message saying: invalid operands binary ^ (have ‘char *’ , ‘char *’) do know how use xor swap 2 string literals? possible in c? ahead!! there's no bitwise operation

syntax - unknown error in shell script -

i have cobbled shell script submit multiple jobs on cluster, appears without giving me error message, output files missing , error log files empty. script supposed 1.) make bunch of new directories, 2.) copy 4 files each (mainparams, extraparams, infile, , structurejobsubmissionfile) 3.) submit each 1 cluster run structure while changing 1 parameter in mainparams file every tenth directory (that's 's/changethis/'$k'/g' line). test running on front end gives no errors, structure program date on cluster, , cluster administrators don't see wrong. thanks! #!/bin/bash reps=10 numk=10 k in $(seq $numk); in $(seq $reps); #make folder name (ex. k4rep7) tmpstr="k${k}rep${i}" #echo "making folder , filename $tmpstr" #make new folder mkdir $tmpstr #go folder cd ./$tmpstr #copy in input files cp ../str_in/* ./

c# - Hide XML data in a WPF Application -

i creating app in wpf. need store data related user. had figured how create folder in documents , stored data in xml file. but problem it editable persons , change value in xml file . is there way hide information? or need make choice storing data? you use compression password protection save data in .zip file. application can decompress zipped file xml original , read settings there. can use sharpziplib nuget achieve this.

Installing external linux kernel module into /lib/modules/`uname -r`/ directory -

i have small usb driver kernel module, want install module running kernel directory i.e. (/lib/modules/ uname -r /). should updates modules.alias , modules.usbmap file. any script available install external kernel module? thanks all: make -c /lib/modules/$(shell uname -r)/build m=$(pwd) modules install: make -c /lib/modules/$(shell uname -r)/build m=$(pwd) modules_install clean: make -c /lib/modules/$(shell uname -r)/build m=$(pwd) clean do "make" , "make install" --- 5.2 install_mod_dir external modules default installed directory under /lib/modules/$(kernelrelease)/extra/, may wish locate modules specific functionality in separate directory. purpose, use install_mod_dir specify alternative name "extra." $ make install_mod_dir=gandalf -c $kdir \ m=$pwd modules_install => install directory: /lib/modules/$(kernelrelease)/gandalf/

java - Handled exception still being written to stdout -

i'm using jetty server hosting java app. added request timeouts kill requests take long. file logs stdout (which should empty) started fill interruptedexception stack traces. like: java.lang.interruptedexception ...... lower level code-lines of project @ com.mycompany.webapps.mycontroller.mymethod(mycontroller.java:252) @ sun.reflect.generatedmethodaccessor67.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ org.springframework.web.method.support.invocablehandlermethod.invoke(invocablehandlermethod.java:219) @ org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:132) @ org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle(servletinvocablehandlermethod.java:104) @ org.springframework.web.servlet.mvc.method.annotation.requestmappi

php - Laravel 4.1 Eloquent Relations with belongstoMany or morphToMany god know what -

Image
programs has items , uitems table ( there can many programs , many programs can have same or different items whereas items can in different programs) pivot table : has items_id , items_type items_id can have ' id ' either items or uitems so if list programs::find(1)->with('items', 'uitems') if items_type ===user use uitems else use items need this! i have programs table: id user_id name description 1 2 x workouti high intensity 2 1 yn workouti low intensity 3 2 c workouti massive workout 4 2 b oldm abi sfsdf i have pivot table seen in picture below. programs table has relation 2 tables below items "core" --> id | category_id | name | description uitems "user" --> id | user_id | name | description if @ pivot table have 2 columns named items_id , items_type 2 represent items , uitems table so; if(items_type === 'user') pull info uitems as; if(items_type === '

php - How to generate texts as image in PDF -

i using dompdf generate pdf file. pdf contains texts. need content of pdf show image instead of texts. not know start. cannot find using google. suggestions? more info: in pdf generated, can select specific portion of texts highlighting using mouse. in pdf should generate, should not able select portion of texts because texts image. pdf should generate contains image, , image contains texts. you generate png first using phpgd / imagemagick shove through dompdf

android - How to modify color attribute in xml during runtime? -

in android game, there textview, background circle gray color. achieving following code in xml. <textview android:id="@+id/tv0" android:textcolor="#fff" android:textstyle="bold" android:background="@drawable/circle" android:layout_gravity="left" android:gravity="center_vertical|center_horizontal" android:layout_width="50dp" android:layout_height="50dp" /> where circle.xml is <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#aaaaaa" /> <corners android:topleftradius="60dp" android:toprightradius="60dp" android:bottomleftradius="60dp" android:bottomrightradius="60dp" /> </shape> now want change color of background circle based on user input. possible , how ? you have background of textview

CSS - Underline text but ignore the spaces -

Image
i have couple of links have margin-left of 3px. these links underlined , that: <a href='#'> test </a> unfortunately, there spaces inside link , i'm not able remove these space since don't have access html code. these spaces underlined, i'm not happy with. there way remove them without changing html? here fiddle shows problem: http://jsfiddle.net/e8quz/ update: here picture, want like: the spaces come line-breaks (well-known display:inline-block problematic). so make a elements display: block , float them left. demo ps: display:block "redundant", float sets display property of respective element "block". no harm ...!

javascript - calling jquery AJAX dynamically -

the following code not working me , don't know why... this js code: var geteventsfunctionscript = document.createelement('script'); geteventsfunctionscript.setattribute('type', 'text/javascript'); geteventsfunctionscript.innerhtml = "function getevents(){$.ajax({url:'myphp_file.php',type:'post',data:{'ajaxdata':'1'},success:function(response){alert('ajax executed!!');}});}"; w.document.body.appendchild(geteventsfunctionscript); this php code: if (isset($_post['ajaxdata'])) { exit; } my problem not working, ajax never executed (i never see alert) could give idea why not working? thank much you need call function afterwards: geteventsfunctionscript.innerhtml = "function getevents() { $.ajax({ url: 'myphp_file.php', type: 'post', data: { 'ajaxdata': '1' }, success: function (respo

xcode - cocos2d Curved Line -

i developing simple basketball game. stuck @ 1 point. when game start, user click on basketball generate curved line (using dot images saved in vector). so how control curved line? mean, in touchedmoved function. when user move finger (location x) less curved line first dot image (location x) curved line width extend , near basketball ring , vice versa. this feels poor design, if created class curved line , used event dispatcher add touch events? https://github.com/cocos2d/cocos2d-x/blob/v3/docs/release_notes.md#user-content-new-eventdispatcher

c - How to perform sequential read in procfs? -

#include <linux/module.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/proc_fs.h> #include <linux/jiffies.h> #include <linux/seq_file.h> //extern uint64_t interrupt_time; static struct proc_dir_entry *test_dir; static int my_proc_show(struct seq_file *m, void *v) { seq_printf(m, "%lu\n", jiffies); //seq_printf(m, "%lu", interrupt_time); return 0; } static int my_proc_open(struct inode *inode, struct file *file) { return single_open(file, my_proc_show, null); } static const struct file_operations tst_fops = { .open = my_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static int __init test_init(void) { test_dir = proc_mkdir("myproc", null); if (test_dir) proc_create("jiffies", 0, test_dir, &tst_fops); return 0; } static void __exit test_exit(v

c++ - Does Release call on an Interface ensure that the COM Component is distroyed -

i working on issue see intermittent crashes happening @ customer site, while code review, found have written code in destructor free memory etc. question when destruct-or gets called. does called when client call's release on interface. or how free resources consumed interface or when supposed free resources. i know when call relase returns "0" com calls dllcangetunloadnow , dll unloaded , freeing memory? can clarify regards tom typically implementing object's destructor called release if reference count has reached zero. performed implementing object's implementation of release . so, typical implementation of release looks this: ifacemethodimp_(ulong) release() { ulong cref = interlockeddecrement(&_cref); if (!cref) delete this; return cref; }

visual c++ - Convert C++ files to C# project -

i have c++ file , want include in c# project. there way add c# project? to use c++ c# need define half-managed, half-native interface in c++/cli. c++ not callable other variety of reasons. so create c++ project, enable clr , define classes , methods can used .net. there should plenty of resources around web on how so.

ssh - How to check hive query running on amazon EMR or EC2 after getting disconnected from client -

i have been facing problem several times. ssh amazon ec2 or emr machine using command line , run hive query in interactive mode. shows gradual progress of mapper , reducer phase. but, let's network problem disconnected ec2 or emr machine. now, hive query still running? if, yes can check progress report see on hive console again? so, 3 things can do: use web interface. amazon gives access detailed here run query in screen , if disconnected, reconnect , reattach previous session. can point logging happen file instead of stdout can reopen when log on machine run query using nohup it's not attached session , keep running on own after kicked off. again, pipe logging file rather stdout , check file or tail once log on.

python - TastyPie Django: ManyToMany field fails to load -

so have in models: class narative(models.model): voice = models.filefield(upload_to='uploads/%y/%m/%d',blank = true, null=true) def filename(self): return os.path.basename(self.voice.name) def clean(self): return os.path.basename(self.voice.name) def __unicode__(self): return self.filename() class geolocations(models.model): name = models.charfield(max_length=255) parent = models.foreignkey('self', blank=true,null=true) sort = models.integerfield(default=0, blank=true,null=true) description = htmlfield() locations = models.manytomanyfield('locgeo') excerpt = models.charfield(max_length=4096) icon = models.charfield(max_length=255, blank = true, null=true) tags = models.charfield(max_length=255, blank = true, null=true) categories = models.manytomanyfield('categories',blank = true, null=true) photos = models.manytomanyfield('photo', blank = true, null=tr

java - Null MultiPartConfig when creating GrizzlyHttpServer -

i´m trying create grizzly http server main method , getting illegalargumentexception: java.lang.illegalargumentexception: multipartconfig instance expected not present. have registered multipartconfigprovider class? i have tried register manually both new instance of multipartconfigprovider , class (see commented lines). missing? this code: public class resourceserver { public static final string host = "localhost"; public static final int port = 8080; public static final string root = "dummy"; public static final uri base_uri = resourceuribuilder.getbaseuri(host, port, root); private static final string base_package_name = "com.mycompany.myapp.resource"; public static httpserver startserver() { final resourceconfig rc = new resourceconfig().packages(true, base_package_name); // rc.register(new multipartconfig()); // // multipartconfigprovider provider = new multipartconfigprovider(); // rc.register(provider);

asp.net mvc - Configure location of static assets in .NET MVC application -

by default, static assets in .net mvc application live in 2 different directories, /content , /scripts . there way configure visual studio's server static assets in other directories? for instance, if load /css/main.css , need load ~/assets/css/main.css . need set route? those 2 folders defaults, there's nothing hard-wired in mvc directories. if use url.content , still have specify content folder in path, if that's you're looking for, i.e. url.content("~/context/site.css") . bundler, also, requires specific complete application-relative path. you can change folders whatever like, long specify references appropriately well. the thing is sort of hard-wired nuget packages have associated css , js files. has more developers, though. since content , scripts default directories, nuget package developers set these folders ones dump associated files into. so, if move new folder assets , next nuget package install, recreate content , scripts f

chef - When automatic attributes(Ohai data) get update? -

from introduction of http://docs.opscode.com/chef_overview_attributes.html#automatic-ohai , says "an automatic attribute contains data identified ohai at beginning of every chef-client run . automatic attribute cannot modified , has highest attribute precedence." from understanding: automatic attributes cannot modified. automatic attributes updated when chef-client runs for number 1, it's not true. i'm able modify automatic attribute. instance, change version of chef package: require 'chef' chef::config.from_file(file.join('/home/chefuser', '.chef', 'knife.rb')) query = chef::search::query.new # search node node name, test_machine in case nodes = query.search('node', "name:test_machine").first nodes[0].automatic["chef_packages"]["chef"]["version"] = "11.12.2" nodes[0].save and using knife node show test_machine -l | grep version the version of chef package

java - Incompatible return type of phone number -

how should change code inside of getphonenumber work correctly, idea? should in end +38(050)123-45-67. 38 code of country, phone number 501234567, have put 0 in begin of number 10 numbers here (>0<50) public string getphonenumber() { return string.format("+%d(%2$s)%3$s-%4$s-%5$s", 38, string.format("%010d", 501234567).substring(0, 3), string.format("%010d", 501234567).substring(3, 6), string.format("%010d", 501234567).substring(6, 8), string.format("%010d", 501234567).substring(8)); } complete code. public class solution { public static map<string,string> countries = new hashmap<string,string>(); public static class incomedataadapter implements customer, contact, incomedata { incomedata incomedata; public incomedataadapter(incomedata incomedata) { countr

bukkit - Console Filter plugin dev -

ok! developing console filter plugin server (ftb, monster, 1.6.4). ive been succesful in blocking console log set up, thier few logs im having difficulty with. here section console: 21.04 12:43:02 [server] startup [2.0.2] recieved client info dirtyredz 21.04 12:43:00 [server] info [consolefilter] message blocked: sending serverside check to: dirtyredz 21.04 12:43:00 [server] info [consolefilter] checking message: sending serverside check to: dirtyredz 21.04 12:43:00 [server] info [consolefilter] message blocked: loading player: dirtyredz 21.04 12:43:00 [server] info [consolefilter] checking message: loading player: dirtyredz 21.04 12:43:00 [server] info sending config data dirtyredz 21.04 12:43:00 [multicraft] dirtyredz ran command message of day 21.04 12:43:00 [consolefilter] checking message: dirtyredz ran command message of day 21.04 12:43:00 [connect] user dirtyredz, ip 11.1.1.111 21.04 12:43:00 [connect] user [consolefilter] checking message: dirtyredz, ip 11.1.1.111 the l

python - scipy LU factorization permutation matrix -

as understand lu factorization, means matrix can written = lu lower-triangular matrix l , upper-triangular matrix u. however, functions in scipy relating lu factorizations ( lu , lu_factor , lu_solve ) seem involve third matrix p, such = plu , p permutation matrix (and l, u before). what point of permutation matrix? if "true" lu factorization possible, why ever have p other identity matrix? consider gaussian elimination process. do if there's 0 on pivot? have switch rows, introduces p matrix. moreso, small non-zero pivot values lead numerical instability in floating point environment. basic algorithms avoid searching entry largest absolute value in pivot column , switching corresponding row pivot row. this switch can expensive, largest absolute value entry have bigger pivot's absolute value factor, e.g. 10, switch occur. reduces number of switches, keeps necessary limit floating point errors. search "lu factorization partial pivoting"

How to run Kaltura open source project (Java) -

i got kaltura java source here . have attempted run code in eclipse received errors. main question how compile code output. errors presented below. generated ks locally: [ntk1mmuyntgxmmu0odhiowzhmdgzotbhognlyta4nthlmmu3otmxzxw1ndmymts1ndmymtsxmzk4mji1ntezozi7nzk1mzt0zxn0vxnlcjs=] example failed. com.kaltura.client.kalturaapiexception: invalid ks "ntk1mmuyntgxmmu0odhiowzhmdgzotbhognlyta4nthlmmu3otmxzxw1ndmymts1ndmymtsxmzk4mji1ntezozi7nzk1mzt0zxn0vxnlcjs=", error "-1,invalid_str" @ com.kaltura.client.kalturaclientbase.getexceptiononapierror(kalturaclientbase.java:617) @ com.kaltura.client.kalturaclientbase.throwexceptiononapierror(kalturaclientbase.java:621) @ com.kaltura.client.kalturaclientbase.doqueue(kalturaclientbase.java:274) @ com.kaltura.client.services.kalturamediaservice.list(kalturamediaservice.java:316) @ com.kaltura.client.services.kalturamediaservice.list(kalturamediaservice.java:305) @ com.kaltura.client.

vb.net - Trying To Create A Small Mail App - Getting Lag When Checking For Mail And Typing New Message -

in application working on, have built functionality allows users send 'mini' emails each other. basically, output contents mysql db, , poll db check if there entries db user read=false status. have form shows inbox (and outbox) of messages refreshes when open. problem finding when user types detail message body field, there constant lag every xx when software checks db new messages. i know haven't set correctly , i'm therefore after best method of building routine. mainform: has timer fires every 5 seconds runs query against db , returns integer value select count(*) mail is_read = 0 , recipient = " & current_user.id showmessagesform: when opened, makes initial query db , returns messages current user datatable. clears listview control , re-populates using datatable. private sub loadmessages() dim querystring string try 'populate inbox lsvmail.items.clear() if inboxdatatable isnot nothing inboxdatatable.cle

cordova - Does PhoneGap support Windows Tablet? -

does phonegap support windows tablet? want create phone gap application widows 8 tablet. need know can done. although cordova (phonegap) 3.6 documentation lists windows 8 being supported, not api supported e.g. whitelist. there doesn't seem activity. these plugins not supported: battery , console , globalization , statusbar the test cases misleading in battery tests pass. not possible save contacts. vibration (ok tablet why tests pass?). splashscreen https://issues.apache.org/jira/browse/cb-7137 issue raised in july , has not been commented on. both tests fail. jira issues raised seem languishing. microsoft outsourced work windows phone akvelon described here . there doesn't seem info on tablet work.

javascript - Change Graph in the div using Drop Down List. -

here html code generate drop-down list - <form method="post" action="abc.php"> <select name="daterange" id="myselect" size="1" onchange="window.location=this.options[this.selectedindex].value"> <option value > select duration </option> <option value="/abc.php/?daterange=1d">last 24 hours</option> <option value="/abc.php/?daterange=2d">last 2 days</option> <option value="/abc.php/?daterange=1w">last week</option> <option value="/abc.php/?daterange=2w">last 2 weeks</option> <option value="/abc.php/?daterange=1m">last month</option> <option value="/abc.php/?daterange=3m">last 3 months</option> <option value="/abc.php/?daterange=6m">last 6 months</option> <option value="/abc.php

javascript - How to know how much time a user has our webpage open -

i'm trying guess how time user expend on website in php. that, thinking every new action on web, difference between $_server['request_time'] , current. planning stats of current hosting don't know if can these values via php request. point of view using first , second method, in advice should i'm not happy first option, cause server collapsed if amount of petitions high..., otherwise don't know other way if me, wonderful. on website i'm using html5, css3, php, javascript, jquery, ajax , mysql database. supposed i'd store , count time users stay logged in webpage. in advice. there few ways of doing this, 1 way accurate readings. php time difference this method talking checking time difference. mark time user visited page. when visitor navigates page, subtract 2 times , have duration user looking @ previous page. to make myself little more clear, below basic layout of actions need perform make php time difference method work. log cur

math - strange behavior when calculating numbers in PHP -

when run following php script calculating discount of 30% 11.5. i'll strange result. expect condition false when testing calculated result. instead true. whats wrong php in case? <?php $_discount = 30; $_price = 11.5; $_qty = 1; echo $_result = ((1-$_discount / 100) * $_price); // result 8.05 echo $_result; // prints 8.05; echo gettype($_result); // prints double echo $_result !== 8.05; // returns 1 instead of 0 ?> try use this : <?php $_discount = 30; $_price = 11.5; $_qty = 1; echo $_result = ((1-$_discount / 100) * $_price); // result 8.05 echo $_result; // prints 8.05; echo gettype($_result); // prints double echo (double)$_result !== 8.05; ?>

How to handle duplicate tags when creating tag in Asana API -

i using ruby wrapper "asana" create integration asana api. 1 problem when test tag creation through curl seems asana doesn't take care of duplicating tags. i.e. when following command twice. generate 2 tags different tag id. can asana detect duplicate tags , merge tasks together? curl -u <my_api_key>: https://app.asana.com/api/1.0/tags \ -d "name=test tag" \ -d "workspace=123123123" 1st response: {"data":{"id":11800363445095,"created_at":"2014-04-22t10:03:19.888z","name":"test tag","notes":"","....:[]}}% 2nd response: {"data":{"id":11800365867646,"created_at":"2014-04-22t10:03:27.501z","name":"test tag","notes":"","....:[]}}% note although tags have same name, have different ids. want if task created same tag name, fall on previous tag id. tags, p

html - How to use JQuery to auto reload div content every X seconds? -

i have been doing web page, , encountered problem on reloading div content. i have done research, , of examples found on has "script.php" on .load(), not need... ( example ) is there way use .load() load specific div content again? (btw, sry bad english etc... , hope explanation makes sense) code: <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> function update(){ $('#div1').load("index.html #div1"); } setinterval( 'update()', 1000 ); </script> </head> <body> <div id="div1"> <script language="javascript"> <!-- date=date() document.write(date) //--> </script> &

jquery - jqXHR Status Code Mismatch -

Image
i seeing status code of 302 on network tab of chrome dev tools getting 200 within error callback of ajax request. how possible 200 success inside error ? someone clear air please.

mysql - Previous/next button in PHP -

i´m pretty entirely new php, please bear me. i´m trying build website running on cms called core. i'm trying make previous/next buttons cycle through tags rather entries. tags stored in database core_tags. each tag has own tag_id, number. i've tried changing excisting code thep previous/next buttons, keeps giving me 'warning: mysql_fetch_array() expects parameter 1 resource, null given in /home/core/functions/get_entry.php on line 50'.' any appreciated. get_entry.php: <?php $b = $_server['request_uri']; if($entry) { $b = substr($b,0,strrpos($b,"/")) . "/core/"; $id = $entry; $isperma = true; } else { $b = substr($b,0,mb_strrpos($b,"/core/")+6); $id = $_request["id"]; } $root = $_server['document_root'] . $b; $http = "http://" . $_server['http_host'] . substr($b,0,strlen($b)-5); require_once($root . "user/configuration.php"); require_once($root

javascript - AngularJS filter by two fields -

i trying use analogously code filter tasks, doesn't work properly. if i'm using 1 filter it's ok ( no matter 1 i'm using ). when try filter second input doesn't work. moreover: when delete string first input , try filter second doesn't work @ all. <div> filters: <br /> company: <input ng-model="search.project.company.name_company"> <br /> project: <input ng-model="search.project.project_name"> <br /> </div> <table> <th>lp.</th> <th ><a href="" ng-click="sortby='project.company.name_company'">company</a></th> <th><a href="" ng-click="sortby='project.project_name'">project</a></th> <th><a href="" ng-click="sortby='time_start'">time start</a></th> <th><a href="" ng-click=&quo

python - Scipy.sparse multiplication error -

i attempting multiply 2 relatively large scipy.sparse matrices. 1 100000 x 20000 , other 20000 x 100000. machine has sufficient memory handle operation no means fast. have tried multiple times , same error (source code found here ): valueerror: last value of index pointer should less size of index , data arrays i life of me cannot figure out causing error. seems index pointer not getting scaled correct size when multiplied cannot find error originating from. on how solve error, or of other packages can handle operation? was using scipy version 0.13.0. upgraded current development version (0.15.0dev) , issue appears have been fixed.

ios - Automate copying resources from dependency project -

i have static library creates .a file exports public headers creates .bundle containing resources i have workspace containing project depends on lib. library part of workspace. able work out build dependencies on .a file , public headers. bundle, have manually add/update bundle applications copy bundle resources build phase. i want automate such bundle created in $(built_products_dir) gets copied in application bundle. is there way this, may run script? appreciate help. figured out. i added run script phase application. script copy generated bundle application, cp -r ${built_products_dir}/mybundle.bundle ${built_products_dir}/${product_name}.app/mybundle.bundle hope helps!

c++ - Destructor vs member function race again -

i've seen similar question: destructor vs member function race .. didn't find answer following. suppose have class owning worker thread. destructor of class can like: ~ourclass { ask_the_thread_to_terminate; wait_for_the_thread_to_terminate; .... do_other_things; } the question is: may call ourclass's member functions in worker thread sure these calls done before do_other_things in destructor? yes can. destruction of member variables willonly start after do_other_things completes execution. safe call member functions before object gets destructed.

c# - String to double with 0 tail -

this question has answer here: formatting doubles output in c# 10 answers storing double 2 digit precision 4 answers i don't know how remove tail of 0 on "double" conversion generic currency string in c#. this code double reddito = math.round(convert.todouble("12500,245"), 3); the expected result reddito = 12500.245 the real result reddito = 12500.245000000001 what matter? for currencies best use decimal type rather double. doubles , floats approximations of real number , can trouble financial calculations. recommended practice not test floats , doubles equality allow small tolerance around value particular reason.

How to create kendoNumericTextBox in kendo grid cell? -

is there way create widgets in kendo grid cell template? here sample code. columns: [{ field: "name", title: "contact name", width: 100 }, { field: "cost", title: "cost", template: "<input value='#: cost #'> </input>",// input must numerical down. }] i want create numerical down cost column. here demo use "editor" property in field definition. have specify function append widget row/bound cell. here's example put drop downlist in each of rows of grid: $('#grdusers').kendogrid({ scrollable: true, sortable: true, filterable: true, pageable: { refresh: true, pagesizes: true }, columns: [ { field: "id", title: "id", hidden: true }, { field: "username", title: "username" }, { field: "firstname",

java - Installing two grails app on Tomcat causes exception -

i need have tomcat 2 grails applications installed. both applications should using 8080 follows: localhost:8080/app1 localhost:8080/app2 i tried put 2 war files in webapps folder , upload server. while server uploading, got exception in catalina.out log file: apr 23, 2014 1:27:27 pm org.apache.coyote.abstractprotocol init info: initializing protocolhandler ["http-bio-8080"] apr 23, 2014 1:27:27 pm org.apache.coyote.abstractprotocol init severe: failed initialize end point associated protocolhandler ["http-bio-8080"] java.net.bindexception: address in use :8080 @ org.apache.tomcat.util.net.jioendpoint.bind(jioendpoint.java:410) @ org.apache.tomcat.util.net.abstractendpoint.init(abstractendpoint.java:640) @ org.apache.coyote.abstractprotocol.init(abstractprotocol.java:434) @ org.apache.coyote.http11.abstracthttp11jsseprotocol.init(abstracthttp11jsseprotocol.java:119) @ org.apache.catalina.connector.connec

javascript - ActiveXObject Number of rows counter -

i have piece of code: function getdata(evt){ var adresses = new array(); var j = 0; var excel = new activexobject("excel.application"); var fil = document.getelementbyid("file"); var excel_file = excel.workbooks.open(fil.value); var excel_sheet = excel.worksheets(1); for(var i=2;i<500;i++){ var morada = excel_sheet.range("e"+ ); var localidade = excel_sheet.range("c"+ ); var pais = excel_sheet.range("a"+i); adresses[j] = (morada + ", " + localidade + ", " + pais); j++; } for(var k = 0; k<j; k++) { codeaddress(adresses[k]); } } it receives excel file , processes data want. thing is, hard coded. for instant, in for: for(var i=2;i<500;i++) i using 500, use number of rows in sheet. have tried few things rows.count , whatever , gave alerts s

eclipse - Java resolve project path -

i trying return project's file path create file in said path. created file in path used static path project rather resolving programatically need do. using docs i've tried creating file: path path = paths.get("c:\\folder\\folder\\folder\\folder\\folder\\report\\"); string filepath = path.tostring() + "filename.pdf"; createfile(filepath, data, moredata); question: what if else uses d: drive or other? how resolve report folder if case? use relative path file, rather absolute path. path path = paths.get("reports/filename.pdf"); string filepath = path.tostring() + "filename.pdf"; createfile(filepath, data, moredata);

java - Printing objects work but drawing it won't? -

so every time try draw list of objects won't draw it. have draw methods under class , seems works since while loop under update() method works should. if iterates through list , prints out correctly how can implement read same list under paintcomponent? seems if when try gives me null pointer exception means must empty. update: public void update(iobservable o, object arg){ gwp = (gameworldproxy) o; gameobjects = gwp.getcollection().getiterator(); while(gameobjects.hasnext()){ gameobject gameobj = (gameobject) gameobjects.getnext(); system.out.println(gameobj); } this.repaint(); } paintcomponent: public void paintcomponent(graphics g){ super.paintcomponent(g); while(gameobjects.hasnext()){ gameobject gameobj = (gameobject) gameobjects.getnext(); gameobj.draw(g); } }

flash - Actionscript 3: How do I have a button that allows a group of buttons to rotate 90 degrees at a time? -

i'm new actionscript in adobe flash. have cluster of buttons navibar , want rotate 90 degrees @ time after each press of button. i've done research , i've found out rotating button impossible. of course, can try using movie clip instead of button, keep if possible. you buttonname.rotation = 90 what's impossible that? or if want rotate cluster (as in "...rotate it..." in question?), instead of individual buttons, put buttons inside of movieclip , rotate movieclip.

objective c - Is there a way to register custom accept headers to parse as JSON in AFNetworking 1.3? -

i have server sending json using following accept header: [self setdefaultheader:@"accept" value:@"application/vnd.com.test.v1+json"]; in success block of api calls, response data coming nsdata object. i read in following question issue retrieving json afnetworking need set @"application/json" if want json parsed nsdictionary automatically, otherwise have manually each call using nsjsonserialization . is there way can @"application/vnd.com.test.v1+json" recognized json , automatically json deserialization each request? add desired content types afhttprequestoperation using addacceptablecontenttypes: : [afjsonrequestoperation addacceptablecontenttypes:[nsset setwithobject:@"application/vnd.com.test.v1+json"];

Facebook feed dialog - customizing lower left icon/text -

Image
how customize text in lower-left hand corner in facebook feed dialog, shown in attachment? or text part of icon? if so, upload icon in facebook? haven't had luck finding directions. you have use actions parameter in feed dialog code make such text appear below icon have mentioned. check out feed dialog parameters here you have not mentioned anywhere in question, language using, if using- javascript sdk- actions: { name: 'join dropbox', link: 'http://url.com' } php sdk- 'actions' => json_encode( array( 'name' => 'join dropbox', 'link' => 'http://url.com' )) hope helps! :)

mysql - SQL Query for datewise data -

Image
i've situation need find sum of columns defined particular date. plese refer below table: in this, need find sum of numbers date wise i.e. 15 march 15 june (in above table months denoted number e.g. 5 may , on.) i did particular month each task below query: select (d1+d2+d3+d4+d5+d6+d7+d8+d9+d10+d11+d12+d13+d14+d15+d16+d17+d18+d19+d20+d21+d22+d23+d24+d25+d26+d27+d28+d29+d30+d31) hoursum table1 month='<given month>'; i don't want query idea sum half or less of column values addition. thanks. try d1 , d2 select sum(d1)+sum(d2) hoursum table1 group month,year refer "group by" https://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html updated answer: i think table structure strange should have 1 column name date rather having 31 columns(d1-d31). anyway, considering same table structure , data if want query data 15 march 2014 15 june 2014 need write query below: -- total sum of d1 d31 select sum(d1) +sum(d2) +sum(d3)

javascript - How to send an HTML form POST request using the HTML button tag? -

as of now, have user-input structure user provides username/password clicks either "login" or register" ends post request information. <form action="{% url 'users:login' %}" method = "post"> username: <input type="text" name="username"><br> password: <input type="password" name="passwd"><br> <input type="submit" name="login" value="log in"> <input type="submit" name="adduser" value="add user"> </form> what want replace 2 submit buttons tags, i.e.: <form class="control-group" action="{% url 'users:login' %}" method = "post"> <input type="text" placeholder="username" name="username"> <input type="password" placeholder="password" name="passwd">

performance - Need help/suggestions on android play music synchronously on multiple devices -

this question has answer here: android group play music synchrounously on multiple devices 1 answer i working on android app should play music synchronously on multiple android devices galaxy s4's group play how can achieve this. suggestions appreciated. finally got demo project on github. here's a link ! demo project play music synchronously on multiple android devices. bryan.

sony remote camera api to to do (Exposure) Bracketing with RAW pictures -

i happy nex-6 user, is... because remotely bracketing sequence in raw files hdr processing. first purchased ir remote, can either activate remote control or bracketing in shooting mode on camera.... then saw in-camera apps ... no raw support then found playmemories app on sony xperia z1.. no solution either. there camera remote api, v1 basic v2 better , develop java program (currently on windows planned develop android) take pictures. i see methods change exposure compensation, error 403 ... is there chance 1. api available 2. playmemories app add bracketing function on raw files 3. in-camera app save raw pictures ? best regards, nicolas thank feedback. can shoot raw+jpeg picture using api when set still quality setting raw+jpeg in camera body setting menu. raw file stored in memory card. api not fetch raw file, fetches jpeg. best regards, prem, member of developer world team @ sony

c++ - How to make array ( with a datatype of a class ) with undefined size -

my question: i have file following: input(1) input(2) input(3) input(6) input(7) output(22) output(23) 10 = nand(1, 3) 11 = nand(3, 6) 16 = nand(2, 11) 19 = nand(11, 7) 22 = nand(10, 16) 23 = nand(16, 19) now, read file , try find word nand . if find word nand want push id (which 10 first line) array. problem: array in want push id of nand should of class node type. how do that? ps: need array of node type because call method processing on 2 nodes e.g. wire(node* a, node*b); that's easy: include header vector: #include <vector> declare vector, of type node : std::vector<node> nodes; and when have created new node object: nodes.push_back(my_new_node); also, can have vector of node* if want manage memory on own. please note, possible address of object ( node ) vector have careful not trust between operations on vector.

typeface - setTypeface to all the layout at one time ...android -

is there away set type face views(including list view) @ 1 time, instead of doing each view.thank you can use following method set typeface layouts public void setfont(viewgroup group, typeface font) { int count = group.getchildcount(); view v; (int = 0; < count; i++) { v = group.getchildat(i); if (v instanceof textview || v instanceof edittext || v instanceof button) { ((textview) v).settypeface(font); } else if (v instanceof viewgroup) setfont((viewgroup) v, font); } }