Posts

Showing posts from March, 2013

three.js - Issue upgrading threejs with shaders -

i working on 3d dataviz. need show world data on , using chrome experiments (chromeexperiments.com/globe) guide. the issue visualizations made threejs r40 , hard find docs tried upgrade r71. i solved compatibility issues rendering world cant make show atmosphere, in fact, when try show atmosphere nothing shown (is atmosphere rendered black , hides world). i think problem shader not sure. does have clue? this code using: gist.github.com/glena/0b2875044cd6c39ff150 thanks ========== update: if remove fragentshader, rendered red sphere stills covers world black background: var mesh = new three.mesh(new three.spheregeometry(100, 40, 30), new three.shadermaterial({ uniforms: uniforms, vertexshader: shader.vertexshader }) ); the issue (as said @westlangley) was mesh.flipsided = true; ==> mesh.material.side = three.backside;

ant - build.xml ignoring <echo> tags and if options -

i have sencha ext.js project , trying user input , take action based on user input in build.xml file. here's build.xml : <?xml version="1.0" encoding="utf-8"?> <project xmlns:if="ant:if" xmlns:unless="ant:unless" name="psogn" default=".help"> <import file="${basedir}/.sencha/app/build-impl.xml"/> <target name="-after-build"> <echo>57 ...</echo> <property name="realperl" value="/usr/bin/perl"/> <echo>59 ...</echo> <exec executable="/bin/hostname" outputproperty="myhost"> <arg value="-s"/> </exec> <echo>64 ...</echo> <exec executable="${realperl}" outputproperty="env"> <arg value="../bin/getcf.pl"/> <arg value="--co...

python - "tput: Unknown terminal 'emacs'" messages when using PyCharm / iPython console on Windows -

i using pycharm ipython on windows. python have installed on box latest anaconda distribution, python 3.4 flavor. very often, while using console, numerous instances of following warning message: tput: unknown terminal "emacs" this mixed in normal output. has else experienced and/or fixed this? have dug through both ipython , pycharm documentation , have not found related. did install new recently? check path "unixy", example removed ...\git\bin path , solved problem me.

javascript - Jquery clone method to clone mutliple (more than one) div's (not a single div multiple times) inside a page -

i need method clone 4 div's id's d_1, d_2, d_3, d_4 including contents inside each div @ once , detach divs, , need find copy of d_1 , contents clone , append again page. something like: var cloned=$('[id^="d_"]').clone(); $('[id^="d_"]').detach(); and find div id =d_1 clone , append body. is possible? use document fragment. var $documentfragment = $(document.createdocumentfragment()); $('[id^="d_"]').each(function(){ $documentfragment.append($(this).clone().addclass("_cloned")); }); $documentfragment.clone().appendto(document.body); if want looking element fragment, can this: $(document.body).find("#d_1._cloned"). ... ; if want remove element , append first copied fragment: $("._cloned", document.body).remove(); $documentfragment.find("#d_1").clone().appendto(document.body);

How could I have access to content of csv file after upload with Angularjs? -

i have wrote simple csv upload function angular-file-upload. code following. think need access content of file upload. need first several rows of csv show preview of file. know how data? app.controller('reporting.importexternaldata.controllers.main', [ '$scope', 'fileuploader', function ($scope, fileuploader) { console.log('hahahahahaah'); var uploader = $scope.uploader = new fileuploader({ autoupload: false, queuelimit: 1, filters: [{ name: 'csvonly', fn: function(item) { console.log('in filter, file type (item.type) is: ' + item.type); console.info('size: ' + item.size); return true; } }] }); } ]); html: <div> <h2> choose csv file ...

c++ - Unable to compile PCAP Program in Visual studio -

following code retrieve mac addresses airpcap adapter. facing issues when executing program: please me in resolving error. #include <stdio.h> #include <conio.h> #include "packet32.h" #include <ntddndis.h> #include "stdafx.h" #define max_num_adapter 10 char adapterlist[max_num_adapter][1024]; int main() { lpadapter lpadapter = 0; int i; dword dwerrorcode; wchar adaptername[8192]; wchar *temp,*temp1; int adapternum=0,open; ulong adapterlength; ppacket_oid_data oiddata; boolean status; // // obtain name of adapters installed on machine // printf("packet.dll test application. library version:%s\n", packetgetversion()); printf("adapters installed:\n"); i=0; adapterlength = sizeof(adaptername); if(packetgetadapternames(adaptername,&adapterlength)==false){ printf("unable retrieve lis...

excel - How to assign value from a named range in one worksheet to a cell in the active worksheet? -

i trying archive data formatted worksheet called bod_labsheet 1 called data. have done similar using userforms encountering problems here. when run macro, error "method 'range' of object _worksheet failed" on line dataworksheet.cells(emptyrow, 2) = bodworksheet.range("bod_lab_date").value the data worksheet active when copying. should copy values bod_labsheet array, activate data worksheet , recopy values? here complete code: sub submit_bod() ' ' submit_bod macro ' dim dataworksheet worksheet, bodworksheet worksheet, suspendedsolidsworksheet worksheet dim datasheetname string dim bodsheetname string dim suspendedsolidsname string datasheetname = "data" bodsheetname = "bod_labsheet" suspendedsolidsname = "suspended_solids_labsheet" set dataworksheet = activeworkbook.sheets(datasheetname) set bodworksheet = activeworkbook.sheets(bodsheetname) set suspendedsolidsworksheet = activeworkbook.sheets(su...

automation - Keystroke Characters Repeatedly With AppleScript -

is there possible way applescript automate typing following: aaaaaaaa , aaaaaaab , aaaaaaac , way zzzzzzzz ? it's 1 of simple functions hard figure out (for me, @ least). :/ what want permutation handler, i'm not sure if want run set of permutations, have 7 char positions 26 possibilities in each position, gives total of 7^26, or 9^21 different lines, considerable set. however, should able find suitable handler here http://macscripter.net/viewtopic.php?id=30365&p=1

Diagram running in the background causing low performance (JavaScript + jQuery) -

the problem encountering there javascript file running in background causing application run slow. i want javascript file run when in page1.html (because dynamic diagram), , not on page2.html or page3.html . using firefox performance analysis find out file running in background, , can see diagram18.js running in background of page2.html , page3.html ... idea on how can prevent file running in background of page2.html , page3.html ?? below jquery code, 2 things. first thing; loads html pages on icon user clicks on. second thing; checks if icon has been clicked ( page2.html or page3.html ), clear interval in diagram18.js . $(function(){ var icon_clicked = 0; $('.page-links').click(function() { $('#page').load('page' + $(this).data('target') + '.html'); $('[data-target]').on('click', function() { var icon = $(this).attr('data-target...

lamp - Bolt CMS Unknown Cache Error -

i'm getting error on every page, using bolt cms: error: uncaught exception 'symfony\component\httpkernel\exception\httpexception' message 'error opening file not lock app/cache/config_cache.php writing! try logging in ftp-client , check see if chmodded readable webuser (ie: 777 or 766, depending on setup of server). current path: /chroot/home/alumctr/[intentionally hidden]/html.' in vendor/silex/silex/src/silex/application.php:378 stack trace: #0 src/library.php(319): silex\application->abort(401, 'error opening f...') #1 src/config.php(753): bolt\library::saveserialize('/chroot/home/al...', array) #2 src/config.php(44): bolt\config->savecache() #3 src file: vendor/silex/silex/src/silex/application.php line: 378 the cache folder empty , has 777 permission. where error comiming from? thank all the problem here way chroot set up. error being caused file operation needs lock access write out file , separate php itse...

Achartengine Line Graph Using Data from JSON parsing -

i parsing json link in order 2 string series(the dates in x axis , integers in y axis). think need convert both strings integers, not sure. want display dates in x axis , values in y axis using graph line achartengine library. string serie json "formatted": "54.5x" "28.8x" "80.7x"....... string serie json "enddates": "2011-12-31" "2010-10-19" "2009-10-113"....... the 2 string series "formatted" , "enddates" how display formatted in y axis , dates in x axis using achartengine line graph? below line graph example achartengine modify. thank in advance. public class linegraph{ public intent getintent(context context) { // our first data int[] x = {1,2,3,4,5,6,7,8,9,10 }; // x values! int[] y = { 30, 34, 45, 57, 77, 89, 100, 111 ,123 ,145 }; // y values! timeseries series = new timeseries("line1");//that's description of line @ bottom for( ...

javascript - Specify which form to do post call -

i 1 post call html form fields. how specify values post call with? instance, want 2 separate post ajax call username/password , username/email. $('form').submit(function() { $.ajax({ type: "post", url: $('form').attr('action'), data: $(this).serialize(), success: function(data, status, xhr) { alert("login successful. redirecting"); window.settimeout(function() { window.location.href = "3.3.3.3/login" }, 5000); }, error: function(data, status, xhr) { $('form').trigger("reset"); alert("failed login. please try again."); } }); return false; alert("ajax request completed"); }); <html> html <head> <title>log in</title> <link rel="stylesheet" href="static"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> ...

Showing manually added value as the last option with ngOptions of Angularjs -

i creating select input using ngoption. <select ng-model="foo" ng-options="foo.bar foo in foos"> <option value="">add new</option> </select> now showing option first option in select input want show option last option in input. how can so? this not supported ngoptions . options are: push "add new" object onto foos use ng-repeat instead of ng-options - (don't this, way more trouble think) write (or find) ng-options -like directive works way want

java - How to stop a repeating task schedule in Bukkit -

i writing minigame minecraft , have problem schedule. don't know how stop schedule. please tell me how can stop running loop / timer / schedule: public void wartetimer() { count = bukkit.getscheduler().schedulesyncrepeatingtask( (plugin) this, new runnable() { @override public void run() { if (countdown > 0) { bukkit.broadcastmessage("§6countdown : " +countdown); countdown--; } else { game(); //bukkit.getscheduler().canceltask(count); //countdown = 5; } } }, 0l, 20l); } to stop scheduler in bukkit have id scheduler , call bukkit scheduler cancel method. i see have set count equal scheduler. assuming count integer. to stop scheduler put: bukkit.getscheduler().canceltask(taskid); in case use : bukkit.getscheduler().canc...

sql server - sql delete query -

Image
this question has answer here: is possible delete multiple tables in same sql statement? 5 answers how delete using inner join sql server? 14 answers when want exec following query: delete login, klantgegevens, ordergegevens login inner join klantgegevens on login.klantid=klantgegevens.klantid inner join ordergegevens on login.klantid=ordergegevens.loginnr login.klantid=3 i error: msg 102, level 15, state 1, line 1 incorrect syntax near ','. obviously there wrong between "delete" , "inner join". (delete login,klantgegevens,ordergegevens login inner join ) what should be? thankyou. edit : i want delete klantid 3. i don't know if attempt use inner joins implies want delete record if exists in 3 tables....

windows - Powershell: Variable assignment triggers module import -

this code works powershell command line generates error when run script: $key = 'hkcu:\software\microsoft\windows\currentversion\explorer\advanced' set-itemproperty $key hidden 1 when run script, following error: hkey_current_user\software\microsoft\windows\currentversion\explorer : module 'hkey_current_user' not loaded. more information, run 'import-module hkey_current_user'. @ c:\users\mybitch\desktop\vss-customize-desktop.ps1:19 char:6 + $key=hkey_current_user\software\microsoft\windows\currentversion\explorer + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : objectnotfound: (hkey_current_us...ersion\explorer:string) [], commandnotfoundexception + fullyqualifiederrorid : couldnotautoloadmodule this simple assignment...why powershell try import hkey_current_user module? why behavior different powershell command line? the error message betrays problem. in script, apparently doing...

php - Stripping out special characters -

in below query using str_replace function strip out '"' data parsing. getting error. ideas on how can fix this? note line 24 has str_replace funtion fatal error: variables can passed reference in /public_html/offices/update_db.php on line 24 query: $i = 0; while (($data = fgetcsv($handle, 0, $separator)) !== false) { if ($i == $first_row_offset) { $fields = []; foreach ($data $key => $item) { $fields[$item] = $key; } } elseif ($i > $first_row_offset) { $query = 'select * offices_empty_locations address="' . str_replace('"', '\"',$data[$fields['addres']], 0, 250)) . '" , zip="' . $data[$fields['zip']] . '"'; $result = mysqli_query($mysqli, $query); while ($tmp_data = mysqli_fetch_assoc($result)) { if (isset($tmp_data['latitude']) && $tmp_data['latitude'] > 0) { ...

ruby on rails - no implicit conversion of nil into String (sponsorship ) -

i getting above error , says has "+". please note did not code below page, told fix it. if awesome. mymoh controller 210. def sponsorships 211. dbdc_client.materialize("cv__recurring_gift__c") 212. #@gifts =cv__recurring_gift__c.find_all_by_cv__contact__c(current_user.convio_id) 213. @gifts = cv__recurring_gift__c.query("cv__contact__c = '" + current_user.convio_id + "' , child_status__c = 'sponsored' , cv__recurring_gift_status__c='active'") 214. @account = contact.find_by_id(current_user.convio_id) 215. #@old_sponsorships = child_sponsorship__c.query("sponsor__c = '" + current_user.convio_id + "' , status__c = 'open'") 216. @sponsorships = @gifts # + @old_sponsorships 217. unless @sponsorships.nil? 218. #if find sponsorships 219. @children = [] 220. @sponsorships.each | spons | 221. @photo = nil 222. unless spons.child__c.nil? 223. @child = child...

python - Numpy array slicing transposes internal data -

i writing c extension shall deal numpy arrays. have written function read , output numpy array. using it, noticed weird behavior appears when use slicing in input array. the c function read (boolan) array: char **pymatrix_to_carrayptrschar(pyarrayobject *arrayin) { char **result, *array; int i, n, m, j; n = arrayin->dimensions[0]; m = arrayin->dimensions[1]; result = ptrvectorchar(n, m); array = (char *) arrayin->data; /* pointer arrayin data int */ (i = 0; < n; i++) { result[i] = &array[i * m]; } printarrchar(result, n, m); return result; } ptrvectorchar function memory allocation: char **ptrvectorchar(long dim1) { char **v; if (!(v = malloc(dim1 * sizeof(char*)))) { pyerr_setstring(pyexc_memoryerror, "in **ptrvectorchar. allocation of memory character array failed."); exit(0); } return v; } and printing done with: void printarrchar(char **arr, int d...

javascript - Go through an array and check for certain values? -

i'm trying create function continuously loop through array , check if there still elements value. if there no more of these elements, function execute action. i'm checking 0 . if nothing = 0 want display image. here's have, suggestions? function partiewin() { // on verifie si il y encore des cases avec pour valeur '0' et si non, on fini la partie var found = false; (i = 1; <= hauteur; i++) { (j = 1; j <= largeur; j++) { if (decor[i][j] != 0) { window.alert("you win"); found = 1; } } } if (!found) { } } this array var decor = new array(hauteur); (i = 0; <= hauteur; = + 1) { decor[i] = new array(largeur); } the array long list of shape : decor[1][1] = '24'; decor[1][2] = '21'; decor[4][8]='0' ; etc shouldn't work? i'm not getting alerts or answer whatsoever once '0' technically gone ma...

python - parsing a drugbank.xml file -

am trying out code github.com on drugbank xml file. keep getting error messsage: usage: drugbank.py [-h] --input input drugbank.py: error: following arguments required: --input/-i being new python, mean? here long code: def run(input): """writes relational database text files drugs, drug_target, drug_target_action, , targets tables. input: path of drugbank xml file. output: text files can used inputs sql tables. method: 1. read , parse xml file. 2. extract data , save records key, value pairs. 3. write output files.""" #output file names drugs_out = input + '.drugs.txt' drug_target_out = input + '.drug_target.txt' drug_target_action_out = input + '.drug_target_action.txt' targets_out = input + '.targets.txt' #counter number of records in each file record_counts = counter() #open input file , parse xml #get drugbank namspace print(...

angularjs - Event handlers being duplicated when changing routes -

i have data coming @ rate of around 30 times per second , it's being fed app via these event handlers. i'm using btford.socket-io , 0mq responsible getting data node.js server. i've tracked down data coming node server , realized it's coming correctly, duplication happening on angular side. what happens every time when leave view , come it, events fired twice as before. in btford api reference, gives suggestion of using socket.forward('dataupdate', $scope); $scope.$on('socket:dataupdate', function(ev, data) { $scope.somevar1 = data; $scope.somevar2 = data; $scope.somevar3 = data; $scope.somevar4 = data; }); which helped situation. but, said, in case, event being called 30 times second , handled 4 times there 4 variables. each time change route showing these variables, instead of doing work 4 times, 8 times , 12, 16 , goes on. that, i'm getting memory leak , browser crashes. does have ideas on how make better? even...

Exception casting valid JSON with Java -

i have json string : { "_id": -1, "create_date": 0, "update_date": 0, "description": "test", "active": true } in java, try parse using org.json.simple.parser.jsonparser : jsonparser jsonparser = new jsonparser(); org.json.simple.jsonobject jsonobject = (org.json.simple.jsonobject) jsonparser.parse(phonejson); i try retrieve _id field value: string s_id = ((string) jsonobject.get("_id")); but encounter following exception: java.lang.long cannot cast java.lang.string furthermore, if display field value in console: system.out.println("print value - _id: "+jsonobject.get("_id")); i get: print value - _id: -1 output in console. i have seen post: java.lang.long cannot cast java.lang.string but not me. what not understanding? you have use .tostring() method convert long string. string strlong = long.tostring(jsonobject.get("_id...

Send data from an android app to a Serial COM Port via Bluetooth -

i send , receive data phone application on computer connect port com , can send , receive data (like uart). exemple of such software (on computer) termite. for android app, tried bluetoothchat android support provides when try connect computer, says unable connect. i don't know if doing correctly because on computer software, have choose baud rate uart communication bt has no baudrate. could enlighten me? i suppose have pairing step between phone , computer in order establish channel (an rfcomm channel) exchange data. i suggest download bluetooth terminal 1 store: https://play.google.com/store/apps/details?id=es.pymasde.blueterm&hl=en

Chrome developer sidebar in extension pane -

i making developer extension chrome. create custom pane, , want add sidebar pane. this page includes documentation on how create sidebar in elements pane , sources pane. however, not include createsidebarpane method under extensionpanel type. there way add sidebar extension panes? by hand. if you're crating whole panel, it's html document under full control. but result, there no "standard" framework embedded in your html allow standard methods.

I'm trying to make my first android App using Android Developers myfirstapp guide but i'm getting all red flags in MyActivity.jav file -

Image
i'm trying make first android app using android developers myfirstapp guide i'm getting red flags in myactivity.java file now have little experience in java code trying learn go along more practical learner find hard learn things books prefer visual references , physically doing im learning do. appreciated what did errors first either have import android.support.v7.app.actionbaractivity or android.app.activity . if want use actionbaractivity need setup support library . to solve other issue need fix intent so; intent intent = new intent(this, displaymessageactivity.class); because intent expects class knows launch displaymessageactivity.

arrays - How can we assure that a Bitonic sequence will be formed from one longest increasing subsequence and one longest decreasing subsequence? -

for example have array[]={1,3,2,7,4,6,8,9} . longest increasing subsequence of array[]={1,3,4,6,8,9} , length=6. longest decreasing subsequence of array[]={3,2} , length=2. then bitonic subsequence of array[]={1,3,4,6,8,9} ? if yes length=6.but length of bitonic subsequence =length of lis + length of lds -1, here not equal. if no how can prove length of bitonic subsequence=length of lis+length of lds-1 correct me if wrong. thank you. the formula correct , gives out 6 only... consider lis[](as lis array) , lds[] (as lds array).. when iterate left right reach position lis[index]=6 i.e. lis till array[7] 6.. lds[index=7] 1 (trivially 1 element maximum length of series)... lis[7]+lds[7]-1=(6+1-1) now proof wanted bitonic sequence... lis[i],lds[i] represents longest increasing / decreasing sequence till i! now, want maximise that's why search on sample space! answer maximum of (lis[i]+lds[i]-1) 0<=i<=n-1 ... that -1 due repeated inclusion of element @ ...

Filtering Event List Google Calendar PHP -

i trying fetch events lie between user-given dates google calendar using following code segment: form name="dates" method="post" action="<?php echo $_server['php_self']; ?>"> start: <input type="date" name="start"> end: <input type="date" name="end"> <br /> <input type="submit" name="submit" value="anzeigen"> </form> <?php if(isset($_post['submit'])) { echo "dates chosen: start " . date($_post['start']) . ' , end ' . date($_post['end']); // api client , construct service object. $client = getclient(); $service = new google_service_calendar($client); // print next 10 events on user's calendar. $calendarid = 'bkrni7gfaiumlahibu0mnifjvk@group.calendar.google.com'; $optparams = array( 'maxresults' => 10, 'orderby'...

php - array_udiff() filter with 2 keys -

i need function find changes in 'right' key same user_id in example have 2 arrays: $a = array( array( 'user_id' => '367', 'right' => 'rw', ), array( 'user_id' => '48', 'right' => 'rwd', ) ); $b = array( array( 'user_id' => '57', 'right' => 'rwd', ), array( 'user_id' => '367', 'right' => 'rwd', ) ); $result = array_udiff($a, $b, 'myfunc'); $result2 = array_udiff($b, $a, 'myfunc'); now must receive: $result = array( array( 'user_id' => '367', 'right' => 'rw', ) ) $result2 = array( array( 'user_id' => '367', 'right' => 'rwd', ) ) i try lot did not correct function. can me please. e...

c# - Viewing data from another model results in DynamicProxies object being shown -

i working on desk system , writing view view tickets user. a ticket consists of parent data ticket category, open user, technician, etc. , there child ticketnotes. first ticket note (that added upon initial creation) ticket description. in table of tickets on view show 1 note (the ticket description) each ticket. here controller: public actionresult index() { var model = t in db.tickets join tn in db.ticketnotes on t.ticketid equals tn.ticketid t.openuserid == new guid("00000000-0000-0000-0000-000000000000") orderby t.opendate select t; return view(model); } my viewmodel: namespace helpdesk.webui.viewmodel { public class usertickets { public int ticketnumber { get; set; } public guid categoryid { get; set; } public virtual category category { get; set; } public guid openuserid { get; set; } public virtual user openuser { get; set; } ...

entity framework - Breeze - Saving decimal type has wrong scale? -

i'm using latest breezejs (1.5.3) data operations in sql server entity framework. save operation done successfully. savemap has decimal value full scale after update field in db has wrong scale (number of decimal points). e.g savemap has value 565.13435435 persisted in db field decimal(19,5) after update field has 2 decimal points this ef problem. default scale decimal types in ef 2. have tell ef scale column. if need 4 decimal places, use shortcut saying money type: [column(typename = "money")] public decimal mydecimalvalue { get; set; } but other cases, need specify precision in onmodelcreating method of dbcontext : protected override void onmodelcreating(dbmodelbuilder modelbuilder) { // configure precision match specified in database modelbuilder.entity<myentity>().property(p => p.mydecimalvalue).hasprecision(19, 5); }

Arduino Uno, multiple processes, multi-threading -

i´m facing problem application in arduino uno. the board has sensor counting products every second, after time sends number of products server process takes more second, code registering products not called until process completed piece of product not counted. i´ve been looking if arduino supports multi-threading in order have thread sending data server , other 1 registering number of products, have no clear answer far. what best solution face problem? const long max_iteration = 100000; const int off = 1; const int on = 0; const int photoelectric_sensor = 3; int counter = 0; long iteration = 0; int state = off; void loop() { registerproduct(); if (iteration >= max_iteration) { // process takes more second senddatatoserver(); iteration = 0; } iteration++; } void registerproduct() { int currentsensorstate = digitalread(photoelectric_sensor); if (currentsensorstate != state) { if (currentsensorstate == on) { ...

networking - Seamless Handover in Windows CE 5.0 and higher using WLAN and VPN over GPRS -

i have little tricky problem using network under windows ce .net compact framework. i try describe... first of there 3 types of connections established while starting application. first 1 wlan connection company network second 1 gprs connection third 1 openvpn connection should use gprs underlying. default way user in wlan area , connects company network. times user has leave wlan area needs network connection, connection should seamless switch grps on openvpn. if user enters wlan area again, connection should seamless switch wlan. so have tried observe connections notified if wifi goes down , switch gprs. now problem can't find way decide wich network adapter used if open socket tcp-connection in application. is there way? update: now i've tried this: foreach (networkinterface inf in networkinterface.getallnetworkinterfaces()) { if (inf.name == "cellular line") { try ...