Posts

Showing posts from May, 2014

java - Thread dumps and signals to get deadlocks with line numbers -

i thread dump, "kill -3" on android process, can see deadlocks. but, adb shell, "operation not permitted," since test phones not rooted. are deadlocks visible in ddms thread monitor? but, line numbers not available there. here article explains how debug thread deadlock in android. adding self logging might catching deadlocks. plus if app doing network/disk operations might want read on android strictmode . http://developer.android.com/reference/android/os/strictmode.html

python - alignment of stacked subplots -

Image
edit: i found myself answer (see below) how align images within subplots: for ax in axes: ax.set_anchor('w') edit end i have data plot imshow. it's long in x direction, break multiple lines plotting slices of data in vertically stacked subplots. happy result last subplot (not wide others) want left aligned others. the code below tested python 2.7.1 , matplotlib 1.2.x. #! /usr/bin/env python import matplotlib.pyplot plt import numpy np x_slice = [0,3] y_slices = [[0,10],[10,20],[20,30],[30,35]] d = np.arange(35*3).reshape((35,3)).t vmin = d.min() vmax = d.max() fig, axes = plt.subplots(len(y_slices), 1) i, s in enumerate(y_slices): axes[i].imshow( d[ x_slice[0]:x_slice[1], s[0]:s[1] ], vmin=vmin, vmax=vmax, aspect='equal', interpolation='none' ) plt.show() results in given tip zhenya played around axis.get/set_position. tried half width don't understand effect has for ax in axes: ...

I cannot create or open a Unit Test Project in Visual Studio 2012 RC -

i consistently getting errors upon opening or creating unit test project in visual studio 2012 rc. might find answers on how resolve issue. have tried multiple repair installations. have tried uninstalling , re-installing. have removed handful of extensions come product (nuget). either fixing bug or finding out assistance welcome. the 'microsoft.visualstudio.testtools.tips.tuippackage.tuippackage, microsoft.visualstudio.qualitytools.tips.tuippackage, version=11.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a' package did not load correctly. problem may have been caused configuration change or installation of extension. can more information examining file 'c:\users\me\appdata\roaming\microsoft\visualstudio\11.0\activitylog.xml'. i believe relevant section file: entering function cvspackageinfo::hrinstantiatepackage {52cbd135-1f97-2580-011f-c7cd052e44de} begin package loadbegin package load {52cbd135-1f97-2580-011f-c7cd052e44de} error setsite failed p...

iphone - IOS background work -

i have iphone application facebook iphone. application must connect server , read message every 2 hours regularly. have thread read message when application terminated thread cannot work. can thread run undependently main delegate or how can find solution problem? you cannot have app stuff in background. there api finish tasks uploading photo killed after around 10 minutes. but apple push notification service seems appropriate solution problem. server notifies device there new happening , fetch actual messages when user opens app. edit: of ios 7 apple implemented feature can schedule running tasks fetch data in background. tasks not guaranteed run @ specific times. see release notes ios 7 , linked methods below: apps regularly update content contacting server can register system , launched periodically retrieve content in background. register, include uibackgroundmodes key fetch value in app’s info.plist file. then, when app launched, call setminimumbac...

javascript - Looping over array and comparing to regex -

so, i'll admit being bit of js noob, far can tell, should working , not. background: i have form 3 list boxes. list boxes named app1, db1, , db2. i'm using javascript allow user add additional list boxes, increasing name tag each additional select box. when add additional app named boxes, value increments each additional field. if try add addtional db named selects, fails recognize 2nd tag on first loop through array. causes me end 2 elements named db2. on each subsequent tag, recognized , incremented. here html db1 tag: <select name="db1"> *options* </select> and db2: <select name="db2"> *options* </select> the tags identical. here function using figure out next number in sequence (note: tag either app or db, tags array of select tag names in dom, if inspect tags, gives me ['app1', 'db1', 'db2', ''] ): function return_select_name(tag, tags) { matches = new array(); v...

android - How can i detect that there is a VOIP call running by code? -

hi iam having application transfer alot of data using wifi within background service, want when there voip call want stop service. how can detect when there voip call?? had think can see if external mic in use , there no gsm call, dont know how detect if external mic in use. find how use mic myaudiorecord.startrecording(); i want detect if in use.can 1 me? , if there better ideas detect voip call appreciate it. in advance

javascript - How do I get the path of the currently running script? -

we have ie extension implemented browser helper object (bho). have utility function written in c++ add window object of page other scripts in page can use load local script files dynamically. in order resolve relative paths these local script files, however, need determine path of javascript file calls our function: myfunc() written in c++ , exposed page's javascript file:///path/to/some/javascript.js (additional stack frames) from top frame want information script calling myfunc() located in file:///path/to/some/javascript.js. i first expected use iactivescriptdebug interface stacktrace our utility function. however, appears impossible iactivescript interface iwebbrowser2 interface or associated document (see full callstack multiple frames js on ie8 ). the thing can think of register our own script debugger implementation , have myfunc() break debugger. however, i'm skeptical work without prompting user whether want break debugger. before doing more tho...

.net - Google Translate API Issue -

i trying translate simple string using google translate api. although have not setup billing have api key accomplish this. it giving error/exception: google.apis.requests.requesterror daily limit exceeded [403] errors [ message[daily limit exceeded] location[ - ] reason[dailylimitexceeded] domain[usagelimits] ] please let me know how can overcome this. thanks. according documentation, seems api in particular can't used without paying fee translate api -> courtesy limit: 0 characters/day other apis allow limeted amount of free requests it's not case of google translation. you can verify on google api console.

vb.net - Dynamically do postback -

is possible postback dynamically in vb.net or c#.net? there asp button (let buttona) if click buttona has actions , trigger postback postback should not triggered onclicking button . after performing actions has trigger postback i have searched day couldnt find solution pls help thanks lot caty by deafult asp buttons postback. if want perform client side function before postback add onclientclick property , return true or false function depending if want postback or not. <asp:button id="btn1" onclientclick="return myfunction();" /> function myfunction() { alert('test'); return true; //do postback }

ms access - Connect to ONLINE MySQL database using DSN ODBC 2 -

i facing problem: stackoverflow question except host doesn't seem have cpanel. since answer given in linked question cpanel related has not helped me. there can do? it seems trying connect client machine located on desk mysql server instance located in service provider's server farm. you're trying use odbc "driver" mysql this, can @ mysql data ms access. (right?) you need make sure particular hosting service provider allows remote connections mysql server instances. service providers, lowest-cost ones, prevent these remote connections using firewalls or other network isolation techniques. (they because it's easier control both security , performance when own web servers can connect mysql servers. ) if service provider prevents these connections matter of policy, you're going need service provider. if allow remote connections, may need enable connections mysql database. that's "cpanel" function mentioned in other question ...

Calling .NET superclass method in Matlab -

stackers, right facing 1 issue concerned on calling .net methods in matlab. relative reference can found through link below: [http://www.mathworks.com/help/techdoc/matlab_external/brpb5k6.html][1] my issue when object .net, want call superclass's method. means want cast type super parent's type. image got objecta .net calling in matlab, class of objecta child of objectb, intention should below line of code: objectb = cast(objecta, 'parent class type') it not work, helps or comments on it? thanks methods in parent (superclass or base) type inherited, , can called on object of subtype. or trying call base class version of virtual method? cannot outside class.

perl - How do I extract data from a quoted-printable encoded HTML table? -

Image
i know there many other posts related html::tableextract module, of them have been @ higher level understand @ moment. have small table (3 rows, 5 columns) email , want scrape data in second row. however, limited knowledge of perl, have been having lot of trouble following documentation online. the table looks this: time notspam probablespam likelyspam spam 2012-05 10252205 62192 55995 3797710 total "" "" "" "" here snippet of code trying parse. second of 3 rows: <tr class=3dmailviewunreadodd> <td class=3dreportviewheader align=3d"left"> =09 2012-05 </td> =20=20 =20=20=20=20 <td align=3d'right' class=3d'mailviewrowreadeven'> 10252205 =20=20=20=20 </td> =20=20 =20=20=20=20 <td align=3d'right' class=3d'mailviewrowreadeven'> 62192 =20=20=20=20 </td> =20=20 =20=20=...

jQuery popover wont load second time -

i using popover on page: https://github.com/klaas4/jquery.popover have multiple instances of popover different content , triggers. javascript says should happen when press link $(".addworker").popover({ title: "worker", content: "laddar..." }); $(".addworker").click(function (event) { event.preventdefault(); $(this).popover( 'ajax', "/jobs/addworker?jobid=" + $(this).attr("id") ).popover('show'); }); $(".markasfinished").popover({ title: "finished", content: "laddar..." }); $(".markasfinished").click(function (e) { e.preventdefault(); $(this).popover( uncaught typeerror: object [object object] has no method 'popover' (repeated 3 times) 'ajax', "/jobs/markasfinished?jobid=" + $(this).parent().parent().attr("data-jobid") + "&userid=" + $(...

asp classic - Sorting two dimensional array by date -

i have 2 dimensional array. 1 dimension date, other dimension name. and trying sort these array values latest date. i looked @ couple of examples , came this. but dates not sorted properly. datamax = ubound(sdatearray)-1 = 0 datamax j = + 1 datamax if datediff("s", dataarray(j, 0), dataarray(i, 0)) > 0 temporalvariable = sdatearray(i, 0) sdatearray(i, 0) = sdatearray(j, 0) sdatearray(j, 0) = temporalvariable end if next next i=0 datamax response.write (sdatearray(i) & "<br>") next that loop not correct sorting algorithm. http://en.wikipedia.org/wiki/sorting_algorithm

java - How create instance of generic class with result of Class.forName -

can create instance of generic class without knowing type parameter? have 'class' type, have been obtained class.forname (classname); //generic class public class mappedfield<t> extends field { private t value; private string sourcename; public mappedfield(string name, string sourcename, fieldtype type){ super(name, type); this.sourcename = sourcename; } public mappedfield(string name, string sourcename, fieldtype type, boolean key){ super(name, type, key); this.sourcename = sourcename; } } //here's situation string columnname = field.getsourcename() != null ? field.getsourcename() : field.getname(); class c = class.forname(field.gettype().getfullclassname()); //i need if `field.gettype() = "integer"`: `mappedfield<integer> objfield = new mappedfield<integer>(field)`; mappedfield objfield = new mappedfield(field); objfield.setvalue(getfield...

ajax - Multiform data form with PHP CURL -

how serialize following code , make static variable above listen previous form input? how post multi form data following, please help. <?php $dest = 'phonenumber'; $user = 'username'; $pass = 'passowrd'; $ch = curl_init("http://hlr.routotelecom.com/"); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, "number=$dest&user=$user&pass=$pass"); curl_setopt($ch, curlopt_postfields, array('field1=value&field2=value2')); curl_setopt($ch, curlopt_returntransfer, 1); $output = curl_exec($ch); curl_close($ch); echo print_r(json_decode($output), 1); ?> don't build own query string. curl happily accept array , you: $data = array( 'number' => $dest, 'user' => $user, 'pass' =...

winapi - Event triggered Window Message -

is there way generate window message when event set? want setup overlapped i/o operation, not blocking, not poll status. know can use thread, need operation. there seems there better way. you can that, windows supports more directly using msgwaitformultipleobjects , return when message, or of handles pass (which can one) signaled. alternatively, use readfileex / writefileex i/o, , use msgwaitformultipleobjectsex . in case, specify completion routine. execution jumps directly call msgwaitformultipleobjectsex completion routine, without having @ messages/return values figure out happened, jump code deal appropriately. either way, continue process other windows messages , deal completion of i/o, without polling i/o completion.

php - Standards for exiting a function -

possible duplicate: why should function have 1 exit-point? as cs student have had beaten head there should 1 exit point in function, @ end. eg. this: function foo() { //do stuff here if($bar) { $out = false; } else { $out = true; } return $out; } not: function foo() { //do stuff here if($bar) { return false; } return true; } however have seen second type of exiting used quite in other peoples code in php, , in core code frameworks (like kohana have been using lately). method of exiting function considered okay in php standards? edit: can see why have been told not can easier track problems in function 1 exit point, other times can see why should allowed other problems better solved or tracked in functions multiple exit points. edit 2: added "do stuff here" comments code example make people happy i've used latter route, since have declare $out , have ...

Simple script not working with .prepend() and .css() methods in jQuery -

today run interesting thing don't quite understand. (see below) simple jquery script not working, want change background color of prepended div red if blue == true (which true). var panel = $("<div id='panel'></div>"); var panelbg = $("#panel"); var test = "true"; var red = "true"; var blue = "true"; if (test == "true") { if (red == "true") { $("#first").prepend(panel); } if (blue == "true") { panelbg.css("background-color","red"); } } but when change line: panelbg.css("background-color","red"); to this: $("#panel").css("background-color","red"); the script works. working demo: http://jsfiddle.net/wk2jw/ at point when lookup #panel , not exist in dom yet, therefore line returns no objects: var panelbg = $("#panel"); ...

PHP json_encode for JQuery -

i'm working on method in class outputs error messages both ajax , regular post request. php part works fine, json part doesn't seem to. here method: public $formerror = false; public $phperrors = ''; public $jsonerrors = array(); // ------------------------------------------------------------ // error processing // ------------------------------------------------------------ private function responsemessage($bool, $msg) { $return['error'] = $bool; $return['msg'] = $msg; if (isset($_post['plajax']) && $_post['plajax'] == true) { $this->jsonerrors[] = $return; } else { foreach ((array) $msg $key => $value) { $this->phperrors .= $msg; } } $this->formerror = true; } i think, problem no matter if single error message or multiple, json object wrapped square brackets. couldn't find online show example. messages this: single error: [{"error"...

jQuery Focus in Internet Explorer -

i have input type text search field , i'm using jquery , focus, it's not working in internet explorer , wonder if have done wrong in code or if there better way it? preciate help! thanks! $(document).ready(function(){ $("#search12_176db646136e9421c49d1b").focus(); }); the #search12_176db646136e9421c49d1b id id of input tag. try this: $(document).ready(function(){ settimeout(function() { $("#search12_176db646136e9421c49d1b").focus(); },1000); }); or $("#search12_176db646136e9421c49d1b")[0].focus(); here $("#search12_176db646136e9421c49d1b")[0] is similar document.getelementbyid('search12_176db646136e9421c49d1b')

entity framework - Invalid assembly error when calling WCF service with EF -

i have written simple wcf service using entity framework 4.1. in references have entityframework.dll 4.1.0.0 , system.data.entity 4.0.0.0. have copy local set true on both. when publish service both of mentioned dll's in bin folder when call service following error: the given assembly name or codebase, 'c:\windows\microsoft.net\assembly\gac_msil\system.data.entity\v4.0_4.0.0.0__b77a5c561934e089\system.data.entity.dll', invalid. system.data.entity.dll not bin deployable. if have .net framework 4 installed on target machine should have assembly. should in gac. when loading assemblies clr first looks in gac , ignores whatever have in bin directory. if don't have .net framework 4 on target machine program not work - system.data.entity.dll part of .net framework , depends on .net framework (in case .net framework 4). try removing , readding reference system.data.entity.dll clear changes made in project copy , deploy program target machine.

raw_input("") has been eliminated from python 3.2 -

i have tried lot run raw_input("") on python console gives error. watch videos might have been made on old python. input("") method , why raw_input("") discarded in new version there reason ? raw_input() renamed input() in python v3.x the old input() gone, can emulate eval(input()) what's new in python 3 mention (and more): pep 3111 : raw_input() renamed input() . is, new input() function reads line sys.stdin , returns trailing newline stripped. raises eoferror if input terminated prematurely. old behavior of input(), use eval(input()).

Javascript - overriding new Date() behavior to offset GMT -

i'm developing website uses comet transmit data web clients. application time sensitive, have graph displaying points added every second. since web application comet driven there no real need client handle dates, should use server timestamp display information. i.e. plotted point on graph should display in tooltip server timestamp, regardless of user's timezone. i think best approach retrieve server's timestamp using rest. measure timezone offset between server , client time, add/deduct difference , use client's timestamp display purposes. is there way override default behavior of new date() result in me having server's timestamp local? many thanks. just redefine it, should work fine: if(date) { try{ date = null; date = function() { console.log("the more things change, more stay same!"); } date(); } catch(exeption) { console.log("couldn't override date object....

python - Database Design for Covariance Matrix (constant size, diagonally symmetric) -

i'm new realm of relational database design, , trying store 9x9 covariance matrix in table. rows , columns x, y, z terms of position, velocity, , acceleration. so: posx posy posz . . . accz ------------------------- posx | xx xy xz . . . posy | yx yy yz . . . posz | zx zy zz . . . . | . . . . | . . . . | . . . accz | so instance, upper-left element posxposx (shortened xx above), right posxposy, , on. matrix symmetric along diagonal (i.e. posxposy == posyposx). it's possible want store 6x6 matrix includes position , velocity in same table. from research, i've found normalized table design of creating table fields row number, column number, , value ( how represent 2-d data matrix in database ). can see benefit flexibility, since number of rows , columns can variable. best way proceed, though have set number of rows , columns (9x9 and/or 6x6)? envision creating table has fields each unique ...

java - Could Not Find the Main Class: HelloWorld. Program will Exit -

possible duplicate: .jar file keeps giving me “ not find main class”. program exit trying run basic "hello world" program. have followed step step tutorials , same error message each time: java.lang.noclassdeffounderror: helloworld caused by: java.lang.classnotfoundexception: helloworld @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) exception in thread "main" here program: public class helloworld { public static void main(string[] args) { system.out.println("hello world"); } } has had same issue , know how resolve it? is tutorial following: http://docs.oracle.com/javase/tutorial/getstarted/cupojava/win32.html ? if not, try 1 , see ...

java - jMockit's access to a private class -

i have public class private class inside it: public class out { private class in { public string afterlogic; public in(string parameter) { this.afterlogic = parameter+"!"; } } } and wanted test in class jmockit. along these lines: @test public void outintest() { out outer = new out(); object ob = deencapsulation.newinnerinstance("in", outer); //line x } the problema is, in line x, when trying cast ob in, in class not recognized. any idea how solve this? thanks! the constructor in class in takes string argument. therefore, need pass argument value: object ob = deencapsulation.newinnerinstance("in", outer, "test");

Python 3.2 split the string values in a list -

i have list below: rawinput = ['corp\\asre', 'corp\\banjar', 'corp\\bicknk', 'corp\\daniele'] i want able users = [] users = rawinput.split(",") print(users) how do in python 3.2? thanks. what have, rawinput = ['corp\\asre', 'corp\\banjar', 'corp\\bicknk', 'corp\\daniele'] is list of strings already. can iterate through list. don't need split anything. if had this, rawinput = "corp\\asre, corp\\banjar, corp\\bicknk, corp\\daniele" rawinput.split(',') return above list.

java - intellij have introduce constant be private not public -

in intellij idea 11.1.2, when using refactor shortcut introduce constant, makes public static final constant, whereas prefer default private . in older versions of intellij, i'm pretty sure had option of setting private default. know if there still exists option default private introduce constant refactor option rather having afterwards go declaration , edit public private ? thanks i had same problem , solved (idea 12). to introduce private constants default following: disable in-place mode (file -> settings -> editor -> uncheck "enable in-place mode") try introduce (you see refactor dialog). select "private" in dialog enable in-place mode enjoy private constants

iphone - iOS Audio Recording Size per Minute -

a high level question. i'm investigating possibility of app 2-3 hr audio recordings @ time. does know proximate minute per mb rate low (voice quality) level recordings? know can depend on lots of factors i'm looking approximate figure see how feasible can 2-3 hrs long. thanks! at cd quality (44.1k samples/per second) single channel 158.76 m samples 1 hour stretch. multiply sample size (say 16 bit int) , 317.52 mb per hour per channel. worst case, , bet implement compression reduce physical size. see questions how-to-record-voice-with-an-ipad

About gcc-compiled x86_64 code and C code optimization -

i compiled following c code: typedef struct { long x, y, z; } foo; long bar(foo *f, long i) { return f[i].x + f[i].y + f[i].z; } with command gcc -s -o3 test.c . here bar function in output: .section __text,__text,regular,pure_instructions .globl _bar .align 4, 0x90 _bar: leh_func_begin1: pushq %rbp ltmp0: movq %rsp, %rbp ltmp1: leaq (%rsi,%rsi,2), %rcx movq 8(%rdi,%rcx,8), %rax addq (%rdi,%rcx,8), %rax addq 16(%rdi,%rcx,8), %rax popq %rbp ret leh_func_end1: i have few questions assembly code: what purpose of " pushq %rbp ", " movq %rsp, %rbp ", , " popq %rbp ", if neither rbp nor rsp used in body of function? why rsi , rdi automatically contain arguments c function ( i , f , respectively) without reading them stack? i tried increasing size of foo 88 bytes (11 long s) , leaq instruction became imulq . make sense design structs have "rounder" sizes...

jquery - Trouble making JqGrid footer static inside a container -

i have jqgrid lot of columns, when scroll container on horizontal buttons in footer of jqgrid hide, wish make footer static scroll , still able see content of buttons. try the demo the answer (see this one , this one ). shows how generate context menu contains same information included in navigator buttons. 1 modifications of approach , find in practical. user don't need scroll @ all. user need click right mouse button same action. it's practical in case of long grids many rows or grids many columns in case.

xcode - When to use awakeFromNib , initWithWindow , windowDidLoad methods? -

can please explain me when have use methods ? , in sort of situation should use method ? right test works , use (yea beginner).. thanks. developing mac. first, should never call awakefromnib , windowdidload yourself. can implement them in custom classes, , cocoa call them @ appropriate time. awakefromnib works objects loaded nib archive, not windows , window controllers. it's general place setup—it's safe (you're guaranteed object loaded, has returned init call, , has of outlets set), still pretty early. windowdidload (and windowwillload) works windows, whether loaded nib archive or created on fly. it's not called on window, it's called on window's controller. (usually you're not creating own nswindow subclass, creating own nswindowcontroller subclass.) if have setup code depends on window being loaded, should put here (but it's not critical in simple cases, because try access window property, created). initwithwindow: call yourself, b...

java - How can i change an arraylist object (int , string, boolean "false") to (int,String,boolean"true") and return it back to the array list? -

i'm new programing , i'm working on library interface better acquainted of aspects of java. i'm trying call checkoutbook(); method user enters book isbn, if statement iterates threw arraylist looking isbn. if it's there index try call book object change boolean value false show book not available. can't figure out how it. it's been few days of looking. public void checkout() { // todo auto-generated method stub int q = l.getreturnb(); if (cat.cat.contains(q)){ book r = cat.cat.get(q); book b = new book(b.getisbn(),b.gettitle(),b.c); // c = boolean value true. r(b.getisbn(),b.gettitle(),false); cat.cat.add(r); } you have method inside book class called checkout changes book's boolean value false. call method inside if statement. if(cat.cat.contains(q)) { book r = cat.cat.get(q); r.checkout(); }

html - IOS Safari <select> element -

i have hierarchal dropdown menu visually differentiates hierarchy using space characters example <select> <option value='1'>top level item</option> <option value='2'>&nbsp;&nbsp;&nbsp;lower level item</option> <option value='3'>&nbsp;&nbsp;&nbsp;another lower level item</option> <option value='4'>another top level item</option> </select> this works in browsers except iphone spaces ignored , items shown @ same level. i'm using reactive design (same dom mobile , desktop) , have decided integrating jquery mobile themed select isn't option. are there easy work arounds or small plugins might me accomplish ios browsers? <optgroup> elements not fit b/c of parent options can selected. <optgroup> not allow selecting parent categories best can tell the core of requirement feature of particular site's navigation must on 1 d...

Defining a kalman filter and its application ( Concept) -

i have simple problem. tracking object , getting position in non-uniform time intervals. velocity , accelration of object not constant. data_=[time x,y,z] to design kalman filter, need define z=[x;y;z] % observation % estimation vector xt=[xt;yt;zt;x't;y't;z't] % ' first derivative p=covariance matrix of estimation vector r=covariance matrix of measurement q= covariance of noise question1: difference between these 2 r & p if measurment accuracy 1mm p? question2: benefit of using kalman filter in post processing. it smoth trajectory if yes why need it. hope enough information people. question 1 r covariance matrix of measurement. has nothing model , estimations. p covariance matrix of errors in estimations. totally realted model , way estimate state. p has nothing accuracy on measurements. have compute every iteration update equations. question 4 kalman's goal filtering noisy measurements of state want track, can result...

formatting - is there a way to add some spacing to cfmail type=text emails in Coldfusion when using variables only? -

i'm little in awe on how first cfmails looking. problem is, i'm using variables both text , content , still have sort of spacing. for example, if have: <cfprocessingdirective suppresswhitespace="no"> <cfmail to="#local.user.email#" from="..." server="..." username="..." password="..." wraptext="80" subject="#tx_automailer_register_subject# - #local.user.comp#"> #tx_automailer_default_hello# #tx_automailer_register_info# #tx_automailer_register_iln#: #local.user.iln# #tx_firma#: #local.user.firma# #tx_ansprechpartner#: #local.user.ansprechpartner# #tx_adresse#: #local.user.adresse# #tx_plz#: #local.user.plz# #tx_ort#: #local.user.ort# ... the place looks nice cfc :-) in mail going bazooka. question: there way space thi...

c# - ASP.Net get an error when trying to adjust css in code behind -

i have code in code behind: if (request.querystring["category"] == "9") { htmlcontrol downloadableproducts = (htmlcontrol)page.findcontrol("downloadableproducts"); downloadableproducts.style.add("display", "none"); } it generating following error: system.nullreferenceexception: object reference not set instance of object. on line 43 downloadableproducts.style.add("display", "none"); my div looks this: <div id="downloadableproducts" runat="server"> <a href="#">downloadedable products</a> </div> what doing wrong? if remove line code behind: htmlcontrol downloadableproducts = (htmlcontrol)page.findcontrol("downloadableproducts"); i error: the name 'downloadableproducts' not exist in current context since downloadableproducts runs @ server, should able remove line 42. commented out below: if (request.que...

Matching specific one-to-many entries with SQL -

suppose have 2 tables: product ------- productid name and language -------- productid code i have 3 products: 1, 'homebody' -> 1, en 2, 'continetnal' -> 2, fr -> 2, en -> 2, es 3, 'westy' -> 3, en -> 3, es -> 3, fr -> 3, pt 4, 'oktoberfest' -> 4, de suppose have list of languages interested en, fr, es in create 3 types of query select number of products. match language in list ('homebody', 'continental', 'westy') match languages in list ('continental', 'westy') match languages in list ('continental') i think solution first just: select * products p join language l on (p.productid = l.productid) l.code in ('en', 'es', 'fr') what way me solve other queries? suspect count number of languages associated product , make sure equal-to or at-least...

javascript - Variable is undefined error (even if console.log shows variable) -

my function looks that var mail_ntfy=$("#nav_mail"), question_ntfy=$("#nav_question"), users_ntfy=$("#nav_users"); function checkall(){ var data=checkfor("m,q,u"); if(mail_ntfy.attr("data-number")!=data.m_count && data.m_count!=0) mail_ntfy.attr("data-number", data.m_count); if(question_ntfy.attr("data-number")!=data.q_count && data.q_count!=0) question_ntfy.attr("data-number", data.q_count); if(users_ntfy.attr("data-number")!=data.u_count && data.u_count!=0) users_ntfy.attr("data-number", data.u-count); shownotes(data.msg); chngtitle(data.msg); } $(document).ready(function () { setinterval(checkall(), 10000); }) function checkfor(param){ $.ajax({ url: "core/notifications.php", type: "post", datatype: "json", data: { chk...

ruby on rails 3 - Keeping the previous value of an attribute -

i have following situation: if name attribute of student object changes, want keep old value , save table. so, if have student object name attribute 'john 1', after student.update_attributes(:name => 'john 2') want able capture old name value 'john 1' in before_update callback hook, instance. what's best way ? in advance. in before_update hook, can access special _was methods previous value of each field before_update new_name = self.name # 'john 2' old_name = self.name_was # 'john 1' end

c# - Metadata for System.Core.DLL couldn't be found in .NET 3.5 -

Image
i want compile code using codedom , initializse compiler paramees doing likd this: compilerparameters parameters = new compilerparameters(); parameters.referencedassemblies.add("system.dll"); parameters.referencedassemblies.add("system.windows.forms.dll"); parameters.referencedassemblies.add("system.core.dll"); //only works in .net 4.0 if put target framework of visual studio on .net 4.0, no problem, works. if put target framework of visual studio on .net 3.5, gives me error in picture. , need run unnder .net 3.5 :(

c++ - object won't pack data -

i'm trying pack data in c++ struct. my struct has layout: struct structname { int16_t member1; int32_t member2; uint32_t member3; uint32_t member4; uint32_t member5; etc }__attribute__((packed)); using offsetof($structname, $membername) correct offsets of data (0,2,6,10,14 . . .), when access data member-name data @ 4 byte offsets (0,4,8,12,16 . . .) if struct wasn't packed. is } __attribute__((packed)); the correct way make struct packed? . . update: mydogisbox wrote: for record, __attribute__((packed)) , #pramga pack(1) , #pragma pack(push, 1) worked. __attribute__((packed)) gcc extension, supported. the clang documentation says supports #pragma pack(...) directive: clang has experimental support extensions microsoft visual c++; enable it, use -fms-extensions command-line option. default windows targets. note support incomplete; enabling microsoft extensions silently drop constructs (including __declsp...

c# - "float: left" Behaviour in WPF -

is possible, in wpf, have image on left side of container, have wrapping textblock stay beside image wraps down below image once height of textblock exceeds height of image? kind of behaviour similar float: left; in css, example doing: <img src="..." style="float: left;">some text here wraps below image once text exceeds image height ...but in wpf. possible? i'm binding database don't want split textblock. there isn't way composite wpf panels behavior without splitting text across multiple controls, flowdocument has functionality via floaters. http://blogs.msdn.com/b/llobo/archive/2005/11/20/floaters.aspx or http://msdn.microsoft.com/en-us/magazine/cc163371.aspx it may take more work text db flowdocument structure, , flowdocument pretty heavy if using textblocks before, give want. without more context can't say.

iphone app - uitabbarcontroller to always select first view in a uinavigationcontroller? -

i building iphone application. i have tabbarcontroller has 2 tab items. each tabitem links different navigationcontroller. each navigationcontroller links hierarchy of tableviewcontrollers. when user clicks on tab 1, clicks on item in table, clicks tab 2, , clicks on tab1, application shows table looking @ before clicked on tab2. how app show first table of tab 1 every time clicks on tab 1 instead of showing recent table looking @ before leaving tab1? i prefer programmatic solution opposed using xcode storyboard. if none exists, storyboard solution fine too. call poptorootviewcontrolleranimated: on navigationcontroller when tabbarcontroller changes tab being displayed.

c# - Why am I getting a RPC server error using a SaveFileDialogue in a WinForms app? -

i'm getting error when try use savefiledialogue in winforms app. must missing error makes no sense (to me!)! the error is: "first-chance exception @ 0x000007fefc99cacd in testproject.exe: 0x000006ba: rpc server unavailable." the error occurs when line runs: "if (sd.showdialog() == dialogresult.ok)". here code: var sd = new savefiledialog(); sd.filter = "pdf (*.pdf)|*.pdf|show files (*.*)|*.*"; sd.filename = "untitled"; sd.title = "save as"; if (sd.showdialog() == dialogresult.ok) { // here } edit: i'm saving file locally, error occurs before user has picked location save, occurs @ point try show dialogue user pick location! probably have activated flag in exceptions debug menu. try reset default configuration going debug -> exceptions -> reset all

indexing - postgis spatial query assistance -

assuming have 3 tables: a. municipalities (multipolygon) b. postcode centroids (point) c. user data (point) entries (c) match entries on (b) fk (code). i looking efficient way to: count number of user data (c) in municipalities (a) using st_contains . but here catch: if entry in c null (or matches condition) use if exists matching entry in b using fk !!! currently have tried various patterns , although spatially querying & b , & c both sub-second, once add them in 1 query (goal) outcome on 4secs sample of i've tried: this worse (60+ secs): select a.*, (select (select case when c.geom null b.geom else c.geom end c left join b on c.id=b.id) b st_contains(a.geom, b.geom) ) count this 15 sec: select a.id, ..., -- other fields count(b.geom) a, (select case when c.geom null b.geom else c.geom end c left join b on c.id=b.id) b st_contains(a.geom, b.geom) group a.id, ...

php - fixing improperly escaped string in javascript -

i'm connecting php webservice returns urls of images in json (using php json_encode function). i'm working within mootools 1.2.5 system, needs work on mobile phones. the format of image node returned in data this: "thumb": "<img src=\"http://photos.imgserv.com/201107222000000.jpg\" />" for reason iphone , android see null value when pass response.json them. can pass response.text object them no problem, json.decode fails since double quotes not escaped properly. if manually add double slashes on image tags this: "thumb": "<img src=\\"http://photos.imgserv.com/201107222000000.jpg\\" />" it works designed. however, i'm having hell of time getting right regexp replace \" in original response.text \\" . is there "right" way handle response.json mobile phones, , alternately how can write string.replace() regex handle these escape chars? thanks! edit add: here...

php \r\n output issue in email -

i know simple issue , i've searched answers on here , other places through google still can't seem work. here's issue. have following code: $name = $_post['name']; $phone = filter_var($_post['phone'], filter_sanitize_number_int); $address = $_post['address']; $city = $_post['city']; $contact_time = $_post['call-time']; $job_descr = $_post['job-description']; $subject= $name. ' requested quote'; $text = $name. " requested quote.\r\n"; foreach($_post $item => $key)// of variables sent , put them in list emailed { if(!empty($key) , $item != 'submit') $textappend .= "$item: $key\r\n"; } $text .= "information:\r\n$textappend"; the email collects variables , sends them. problem not output new line \r\n in code. displays in single line. not using right quotation double quotes? appreciated. thanks $headers .= "\n--$boundary\n"; // beginning \n...

Recurring Events Schema w/ MongoDB -

i've read of papers out there describing data storing methods recurring events, i'm still trying wrap head around best practice, concerning mongodb. my main concern cheaply retrieve of events occur within given timeframe. secondary concern modify , alter single occurrences without taking entire event chain out of whack. looking @ others have asked similar questions, have come possibility. i'm not sold on it, , love pointers in right direction. my idea: within each event document, have... a recurring string field closely matches ical standard an "occurrences" embedded document or array field contains changes/edit on specific occurrences (such changing description or start time, or canceling single occurence). an occurrence start , end field define queried boundaries of recurrence rule pros: able store changes , still maintain association other events easily queried, model on business side have construct each event though cons/potential prob...

Forming Lisp code to task -- related to flatten list method -

i'm having issues trying form code problem want resolve. goes this: ~ goal: flatten nested list 1 number if object list, replace list sum of atoms. with nested lists, flatten innermost lists first , work there. example: (condense '(2 3 4 (3 1 1 1) (2 3 (1 2)) 5)) (2 3 4 (6) (2 3 (3)) 5) (2 3 4 (6) (8) 5) (28) => 28 i've tried implement flatten list function problem , ended this: (defun condense (lst) (cond ((null lst) nil) ((atom lst) (list lst))) (t (append (flatten (apply #'+ (cdr lst)))))) but gives me errors :( could explain me wrong processing/code? how can improve it? update: june 5 2012 (defun condense(lxt) (typecase lxt (number (abs lxt)) (list (if (all-atoms lxt) (calculate lxt) (condense (mapcar #'condense lxt)))))) so here, in code, true intent shown. have function calculate performs calculation based off values in list. not same operat...

Grabbing image with cURL php -

trying save image server using curl. image appears download. shows correct bytes when link image not work. dl see , nope blank image. here code... whats issue it? $ch = curl_init("'. $image .'"); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer,1); $rawdata=curl_exec ($ch); curl_close ($ch); $fp = fopen("$rename.jpg",'w'); fwrite($fp, $rawdata); fclose($fp); i test script work fine me, remove useless double quote , dot $image. <? $image ="http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=5"; $rename="123"; $ch = curl_init($image); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer,1); $rawdata=curl_exec ($ch); curl_close ($ch); $fp = fopen("$rename.jpg",'w'); fwrite($fp, $rawdata); fclose($fp); ?>

memory management - Does Java duplicate data when calling Collection values() on a Hashtable? -

i want iterate through values of hashtable, has large amount of data (apx. 1 gb). that, using: hashtable<string,object> myhashtable = new hashtable<string,object>; // fill hashtable here... // values collection: collection<object> myvalues = myhashtable.values(); // values array: arraylist<object> myarray = myvalues.toarray(); // iterate through values here... so, question is: multiplying data stored? have 3 copies of same values stored in ram (one copy in hashtable, 1 copye in collection, , 1 copy in arraylist)? if answer yes, copied data, there way iterate through values of hashtable without duplicating data? if answer no, mean collection stores pointers? in case, if modify data in hashtable after having created collection, collection reflect change? (same question arraylist). thanks! the values() method not duplicate data, per documentation , returns view of values in map - meaning: if change elements in myvalues changes reflecte...

java - Httprest performance improvement -

i doing httprest post call send data third party, data in order of 3 10 million , can send 1 record per request along username , password authentication specified third party sample code using public static void main(string[] args) { try { defaulthttpclient httpclient = new defaulthttpclient(); httppost postrequest = new httppost( "http://localhost:8080/restfulexample/json/product/post"); stringentity input = new stringentity("{\"qty\":100,\"name\":\"ipad 4\"}"); input.setcontenttype("application/json"); postrequest.setentity(input); httpresponse response = httpclient.execute(postrequest); if (response.getstatusline().getstatuscode() != 201) { throw new runtimeexception("failed : http error code : " + response.getstatusline().getstatuscode()); } bufferedreader br = new bufferedreader( new inputstreamreader((response....

Does Sencha Touch 2.0 support access to the Microphone (on mobile phones) in their Tools SDK? -

sencha touch's tools sdk support wrapping html5+js+css3 native app (i assume in similar manner phonegap). provides limited access mobile features camera. can't find out: does support access microphone on phone? i gonna no, think short http://www.sencha.com/forum/showthread.php?207849-is-there-a-microphone-(for-recording)-control-available-in-sencha-touch-2 http://www.sencha.com/forum/showthread.php?183880-how-to-record-audio-in-a-sencha-app&highlight=microphone you need use phonegap/cordova hope helps

compiler construction - What can be the possible reasons for the object code of an unchanged C++ file to change on recompilation? -

it's not question. it's dormant question found on quora. 1 answer of header files might have changed author of questions claims did not. love hear people here have :) changed header files different compiler different command line options timestamp in object code nondeterministic code generator or optimizer profile-driven optimization changed profile nondeterminism induced changes in os provided services

ruby on rails - Finding records with two specific records in another table -

i have product model has_and_belongs_to_many :taxons , , want find products in specific taxons. for example, if product belongs both "ruby on rails" , "shirts" taxon, want product returned in dataset, not if belongs either "ruby on rails" or "shirts" i had problem while back, thankfully there nice solution. def self.has_taxons(taxons) id = arel_table[:id] product.joins(:taxons).where(taxons: { name: taxons }).group(id).having(id.count.eq(taxons.size)) end

php - Can I use Wordpress as an API to load content to my site? -

i'm using wordpress manage posts in website, don't want use wordpress template/visualization. use manage content , program bit display content in website. well, can access wordpress database , load content own queries. want know if viable use wordpress create bridge between site , wordpress database. simplifying, want know if wordpress provides methods getallposts() , getallcomments manage database connection, queries , returns objects or need build in application. not native wordpress, "viable" through plugins. example: http://code.google.com/p/wordpress-posts-api/ claims want posts, , expand load comments - or may find exact plug in want bit of searching. i've never used 1 written else this, have built similar functionality expose posts etc xml feeds (then displayed in flash, example). relatively easy if start else's plug-in , expand. just 1 word of warning - these plugins great operate in full wordpress environment, easy run. downside...

objective c - class method where self if used within a block -

i've got class method uses dispatch_once create static object. inside dispatch_once block use [self class] , wondering if need use weak reference self avoid retain cycle? + (nsarray *)accountnames{ static nsarray *names = nil; static dispatch_once_t predicate; dispatch_once(&predicate, ^{ names = [[[self class] accounts] allkeys]; names = [names sortedarrayusingselector:@selector(caseinsensitivecompare:)]; }); return names; } if use weak reference self warning: + (nsarray *)accountnames{ static nsarray *names = nil; static dispatch_once_t predicate; __weak tuaccount *wself = self; dispatch_once(&predicate, ^{ names = [[[wself class] accounts] allkeys]; names = [names sortedarrayusingselector:@selector(caseinsensitivecompare:)]; }); return names; } incompatible pointer types initializing 'tuaccount *__weak' expression of type 'const class' because warning don't ...

Javascript interval and iframe -

i have asp.net page opens page in jquerywindow (iframe) loads contents , button. when user clicks button, call function work , setinterval function @ end of click function. interval function works fine , while window(iframe) opened, when close window, interval stops in firefox , error show in console: attempt run compile-and-go script on cleared scope however works ie. any ideas? later desc : interval function in parent. used firebug surprisingly saw function going called in interval returns error , works fine. :o firefox has garbage-collected iframe's scope due not existing anymore. other browsers may not things same way. try calling top.setinterval(...) instead of setinterval(...) .

how to show image that is last captured from camera in android? -

i using following code in onactivityresult not working file file1 = new file( environment.getexternalstoragedirectory().getabsolutepath(),imagecapture); if (file1.exists()) { //do action image=(imageview)findviewbyid(r.id.image); bitmap mybitmap = bitmapfactory.decodefile(file1.getabsolutepath()); image.setimagebitmap(mybitmap); image.invalidate(); } but not able why not working have used android camera intent: how full sized photo? gives error on line mimageuri = uri.fromfile(photo); appreciated. import android.app.activity; import android.content.intent; import android.graphics.bitmap; import android.os.bundle; import android.view.view; import android.widget.button; import android.widget.imageview; public class mainactivity extends activity { /** called when activity first created. */ button btntakephoto; imageview imgtakenphoto; private static final int cam_r...

android - I am getting ClassNotFoundException, in log cat? why? -

for project java classes in 1 package - com.example.android.bitmapfun - , manifest is: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.android.bitmapfun" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="15" android:targetsdkversion="15" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.access_network_state" /> <application android:description="@string/app_description" android:hardwareaccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name="com.example.android.bitmapfun.imagegridact...

riak search - json properties are all strings? -

i'm storing json docs in riak search, example: { boolean: true, number: 1.234, string: "gretchen" } however, when querying them (riak search), notice fields returned query strings: { boolean: "true", number: "1.234", string: "gretchen" } this makes query results useless binding objects, unless sequentially retrieve each doc again via key. possible correctly typed fields returned? e.g. couch+lucene correctly , makes useful querying + binding. sounds it's not possible, need use map reduce this. sean @ basho: "what search query returns "index document", or result of transforming input before adding search indexes; means nested fields flattened. if want original, can use mapreduce retrieve documents resulting search query."