Posts

Showing posts from February, 2014

sql - How to bound primary key to custom ON condition in Yii Relations? -

the problem: how bound primary key custom relation query? context, for: one source can relate several different modifications (many_many), each modification relate product (belongs_to). if several products has 1 source, means products same - that's criteria. (i can't merge same products, because may turn out not same, if merge them - can't split them back). so, when need find orders related product, want find orders same products, not current product. relation looks this: 'orderedproducts'=>array(self::has_many,'orderproduct','','on'=>('modification_id in ( select distinct ms2.modification_id products p1 left join products_modifications pm on pm.product_id = p1.product_id left join modifications_sources ms on ms.modification_id = pm.modification_id left join modifications_sources ms2 on ms2.source_id = ms.source_id p1.product_id='.$this->primarykey.' )')), 'orders'=>array(self::has_many,&#

apache2 - Set PHP's open_basedir for all users' public_html via mod_userdir -

i have apache 2 web server allows access public_html directory each user via mod_userdir , this: <ifmodule mod_userdir.c> userdir public_html userdir disabled root <directory /home/*/public_html> # [*] configuration here </directory> </ifmodule> i additionally configure php's open_basedir directive forbid file access outside user's homedir. user jim , directive be php_admin_value open_basedir "/home/jim/" question: apache offer way through variable @ spot marked [*] above, following? <directory /home/*/public_html> php_admin_value open_basedir "${apache_current_directory}" </directory> i don't know mod_php, should work. assume apache_current_directory variable supposed point current directory context, placing "." take care of (unless mod php doesn't behave). let me know how goes. <directory /home/*/public_html> php_admin_value

android - Embedding Cordova WebView call native method -

i have added embedding cordova webview in native radio stream player app, , thats works perfekt. but want change native view (viewflipper) javascript calling native function, how can this? .. please help, have googled hours now! finaly got work!!! i had make cordova plugin, , call native function way... @override public boolean execute(string action, jsonarray args, final callbackcontext callbackcontext) throws jsonexception { if (action.equals("radio")) { cordova.getactivity().runonuithread(new runnable() { public void run() { // button click //cordova.getactivity().findviewbyid(r.id.playbutton).performclick(); // method call ((radioapp) cordova.getactivity()).setviewflipper(0); ((radioapp) cordova.getactivity()).startstream(); // todo: not in use yet! callbackcontext.success(); // thread-safe. } })

Python 2.7: test if characters in a string are all Chinese characters -

the following code tests if characters in string chinese characters. works python 3 not python 2.7. how do in python 2.7? for ch in name: if ord(ch) < 0x4e00 or ord(ch) > 0x9fff: return false # byte str (you gae) in [1]: s = """chinese (汉语/漢語 hànyǔ or 中文 zhōngwén) group of related language varieties, several of not mutually intelligible,""" # unicode str in [2]: = u"""chinese (汉语/漢語 hànyǔ or 中文 zhōngwén) group of related language varieties, several of not mutually intelligible,""" # convert unicode using str.decode('utf-8') in [3]: print ''.join(c c in s.decode('utf-8') if u'\u4e00' <= c <= u'\u9fff') 汉语漢語中文 in [4]: print ''.join(c c in if u'\u4e00' <= c <= u'\u9fff') 汉语漢語中文 to make sure characters chinese, should do: all(u'\u4e00' <= c <= u'\u9fff'

android - Broadcast receiver is not stopping -

i working on app automatically decline incoming calls specific numbers , send sms in return.my broadcast receiver should enabled app only. so, added ( android:enabled="false" ) this. but, receiver still on default. i'm struck here. <uses-permission android:name="android.permission.call_phone"/> <uses-permission android:name="android.permission.read_phone_state"/> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.sifydy.automsgr.automsgr" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> &l

c# - How is an Enumerable converted to a Dictionary? -

i have following code msdn sample : if (sheetdata.elements<row>().where(r => r.rowindex == rowindex).count() != 0) { row = sheetdata.elements<row>().where(r => r.rowindex == rowindex).first(); ... which refactored follows: dictionary<uint, row> rowdic = sheetdata.elements<row>().todictionary(r => r.rowindex.value); if (rowdic[rowindex].count() != 0) { row = rowdic[rowindex]; ... now, sensed if enumerable.todictionary<> method actually has enumerate through data, redundant, msdn documentation not how conversion takes place. the alternative i'm thinking of using is: var foundrow = sheetdata.elements<row>().where(r => r.rowindex == rowindex); if (foundrow.count() != 0) { row = foundrow.first(); ... however, know possibly previous experiences faster , why. thanks. the cleaner alternative is: var row = sheetdata.elements<row>() .firstordefault(r => r.rowindex == rowind

Bash command as variable -

i trying store start of sed command inside variable this: sedcmd="sed -i '' " later execute command so: $sedcmd s/$orig_pkg/$package_name/g $f and doesn't work. running script bash -x, can see being expanded like: sed -i ''\'''\''' what correct way express this? define shell function: mysed () { sed -i "" "$@" } and call this: $ mysed s/$orig_pkg/$package_name/g $f

How to override node.js http to use a proxy for all outbound requests -

i created node.js app reaches out social media sites , caches our public feeds. i'm using existing npm modules facilitate accessing social media api's. works charm in dev environment on our production environment requests timing out because need go through proxy. without having modify npm modules how can make outbound requests go through proxy? use http.globalagent property. let intercept requests running in process. can modify requests formatted proxy server. http://nodejs.org/api/http.html#http_http_globalagent another option create proxy exception application.

options - Google Maps Api StreetView PanoramaOptions Point of View Setting from Lon Lat -

i've got streetviewpanorama identified lat lng coordinates. lat , lng coordinates not on road google car took picture, in center of building want see in streetview's picture. have 2 couple of coordinates, , think it's possible calculate pov degrees obtain correct shot of building. need how lon lat of point in automatically placed "the man", can calculate correct pov degrees. my implementation of kiks73's solution. make sure add geometry library when loading maps api: https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=visualization,places,geometry&sensor=true var dist = 50; service.getpanoramabylocation(targetlatlng, dist, function(panodata){ panoramalatlng = panodata.location.latlng; initstreetview(targetlatlng, panoramalatlng) }); function initstreetview(targetlatlng, panoramalatlng){ var panoramaoptions = { position: targetlatlng }; var streetview = new google.maps.streetviewpanorama(doc

What is the difference between ::: and :::.() in scala -

in scala list class shown that: list(1, 2) ::: list(3, 4) = list(3, 4).:::(list(1, 2)) = list(1, 2, 3, 4) . shouldn't: list(1,2) ::: list(3,4) = list(1,2).:::(list(3,4)) = list(3,4,1,2) ( method ::: prefixes list) from docs : def :::(prefix: list[a]): list[a] [use case] adds elements of given list in front of list. example: list(1, 2) ::: list(3, 4) = list(3, 4).:::(list(1, 2)) = list(1, 2, 3, 4) in scala, operators end in : right associative , invoking object appears on right side of operator. because right associative, prefix method called on object "to right", list(3, 4) . then name says, prefix list(3, 4) list(1, 2) , , that's why list(1, 2, 3 ,4) . not intuitive thing in world it's this: a ::: b // ending in :, flip argument order, call method on b. b .:: // :: = prefix b result = a(concatenated) b now let's @ right hand side: list(3, 4).:::(list(1, 2)) the . dot performing inversion of ::: prefixed invocation,

single sign on - SAML IDP, ADFS 2.0 SP & WS-Fed Application -

update: i able adfs forward user relying party application. used componentspace's saml2.0 library , relaystate. though forwards wif application, doesn't recognize user having been authenticated. instead initiates sp-initiated sso scenario redirecting idp sts. i'm not sure how should proceed. original message: i have configured single-sign-on setup in following manner: idp - portal website posts saml2 responses sp. sp - adfs 2.0 configured claims provider trust configured saml2.0 endpoint (with idp of course) rp application - asp.net application configured relying party trust in adfs (ws-fed). when log idp , click on link posts saml2 token adfs, works fine. taken idpinitiatedsignon.aspx page , told have been logged in. problem expect see drop down list of applications choose (which should include single rp application) see nothing. have 2 buttons allowing me sign out of applications or single application. there trick configuring rp application trust i'm

swing - Detecting Keyboard Input while Having a Focus on JpopupMenu (Java) -

i know if there way detect keyboard input while having focus on jpopupmenu. remove focus on jpopupmenu whenever there input detection keyboard. possible? thank you. below simplified code have written. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.caretevent; import javax.swing.event.caretlistener; import javax.swing.event.changelistener; import javax.swing.event.changeevent; import java.net.*; import java.io.*; public class testclass { static jpopupmenu textpopupmenu = new jpopupmenu("menu"); final static jtextarea textinput = new jtextarea(50,80); final static jpanel overallpanel = new jpanel(); final static jframe overallframe = new jframe("test"); public static void main(string[] args) { swingutilities.invokelater(new runnable() { @override public void run() { final acti

python - Puzzling bug on very tiny OpenCL kernel when trying to read an image2d (using pyopencl) -

while developing opencl kernel supposed compute features on image, came across bug didn’t manage solve. figure out problem built silly, tiny kernel still returns wrong values. here is: __constant sampler_t sampler = clk_normalized_coords_false | clk_address_clamp_to_edge | clk_filter_nearest; __kernel void readimagetest(__read_only image2d_t img, __global float *result){ const int2 coord = (int2)(get_local_id(0), get_local_id(1)); int2 nbofworkers = (int2)(get_local_size(0), get_local_size(1)); uint4 tmp = read_imageui(img, sampler, coord); result[coord.x + coord.y * nbofworkers.x] = (float)tmp.x; } as can see, kernel made work 1 workgroup each thread copies red channel of image global buffer. call kernel 1 workgroup of size (2, 2) on image of 6 6 pixels. red channels contain value different 0. these values go 0 35 left upper corner pixel having red value set 0, right neighbor 1 , on, until rig

objective c - NSOutlineView crash on error EXC_BAD_ACCESS code=13 -

i have nsoutlineview custom cell named listcell. set label , icon custom cell. nsoutlineview crash on error exc_bad_access code=13. have idea, how repair it? thx reply. - (nsinteger)outlineview:(nsoutlineview *)outlineview numberofchildrenofitem:(id)item { return [[[datasingleton shareddata] pages] count]; } - (bool)outlineview:(nsoutlineview *)outlineview isitemexpandable:(id)item { return no; } - (id)outlineview:(nsoutlineview *)outlineview objectvaluefortablecolumn:(nstablecolumn *)tablecolumn byitem:(id)item { return item; } - (id)outlineview:(nsoutlineview *)outlineview child:(nsinteger)index ofitem:(id)item { listtablecellview *cell = [outlineview makeviewwithidentifier:@"listcell" owner:self]; cell.label.stringvalue = [nsstring stringwithformat:@"%ld", index + 1]; [cell.label setbackgroundcolor:[nscolor clearcolor]]; if ([self.icons objectforkey:[nsstring stringwithformat:@"%ld", index]]) [[cell icon] setimage:[self.icon

javascript - QUnit fails tests inconsistently/alternately -

i have simplified qunit test consists of 2 simple tests fails randomly/alternately no reason (they both atomic, meaning 1 test doesn't change of other element) please see this jsfiddle try run multiple times module("basic actionbind"); //two simple tests test("action1", function() { ok(ele2.trigger("click").hasclass("clicked"), "basic click action"); }); test("action2", function() { ok(ele1.click().hasclass("clicked"), "basic click action"); }); the problem in caching of jquery objects in global context @ run-time. here's 2 snippets code (from link in question: http://jsfiddle.net/adardesign/azrk7/12/ ): html: <div id="qunit-fixture"> <span id="ele1" class="action" data-action="action1"></span> <span id="ele2" class="action" data-action="action2" ></span> </d

CSV File With PHP and MySQL - Data not uploading properly in database -

Image
i download script - http://www.k-fez.com/?p=101 website , trying upload csv file on server. uploading file blank - please check image <?php session_start(); if($_files["file"]["type"] != "application/vnd.ms-excel"){ die("this not csv file."); } elseif(is_uploaded_file($_files['file']['tmp_name'])){ //connect database $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'password'; $dbname = 'auction_tbl'; $link = mysql_connect($dbhost, $dbuser, $dbpass) or die('error connecting mysql server'); mysql_select_db($dbname); //process csv file $findings = " <form method=\"post\" action=\"importcsv.php\"> <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td>checking...</td> "; $handle = fopen($_files['file'][&

jquery - change color of fixed image after scrolling -

i want change color of simple icon white black - , - after amount of scrolling (due change in background color). see http://www.euimpact.com/erikverwey , scroll down - you'll see mean). now i'm hoping in css/jquery somehow , have smooth transition, i.e. it'd possible image half black half white when crossing line. but i'm guessing that's not possible, it? would have switch different image @ scrolling point? thanks lot! i don't think possible have different colors on edge but change color can use window scroll a fiddle $(window).scroll(function(){ if($(window).scrolltop()<800){ $('#fixed').css('background-color','yellow'); }else{ $('#fixed').css('background-color','white'); } }) i created fiddle div changes color on edge, have done complete mathematic, see issues. can play around fiddle find out exact values make working you.

What javascript templating engine is usable with bookmarklets? -

i have bookmarklet defines bunch of divs use script. using $('<div/>').css({}).addclass() etc.. separate divs code promote readability. there js templating engines support bookmarklets? short: not. long: not possible "no" , sure, because can know subject. can keep eye on subject of bookmarklets , i've never seen such thing. start imagine how 1 might created, - depending on goals - doubt effort wold worthwhile.

javascript - Backbone Model triggers event conditionally, View doesn't hear it -

i'm creating geolocation model, fetching localstorage, , checking if have there latitude property there. if there isn't, 'geolocation:city_state_blank' event triggered. if 'geolocation:city_state_blank' heard, @get_users_geolocation() fired. class app.geolocation extends backbone.model initialize: -> @on 'geolocation:city_state_blank', -> @get_users_geolocation() @fetch().always => if @get('city_state').length 0 @trigger 'geolocation:city_state_blank' else @trigger('geolocation:done') get_users_geolocation: => # code / save (in localstorage) users geolocation , city / state @trigger('geolocation:done') after get_users_geolocation() done event geolocation:done triggered. i've removed details of fetching users geolocation / reverse geolocation lookups, asynchronous. end result of work boils down triggering geol

javascript - How to fetch JSON from a php script -

i able plot list of point on google map using : (function() { window.onload = function() { var map = new google.maps.map(document.getelementbyid("map"), { center: new google.maps.latlng(41.6, -0.88), zoom: 12, maptypeid: google.maps.maptypeid.roadmap }); // creating json data var json = [ { "nombre": "name1", "lat": "41.653", "long": "-0.907922", }, { "nombre": "name2", "lat": "41.6693", "long": "-0.891317", }, { "nombre": "name3", "lat": "41.6502", "long": "-0.875212", } ]; var infowindow = new google.maps.infowindow(); (var = 0, leng

c# - How to refer to the a properties accessor and mutator (getter/setter) -

i wondering if there high performant way refer properties getter or setter. example, how fill in details second example class below public class example { public example() { action<int> setter = setx; func<int> getter = getx; } public int getx() { return 0; } public void setx(int value){} } public class example2 { public example2() { action<int> setter = ...; func<int> getter = ...; } public int x { get{ return 0; } set{} } } i know create lamdas myself so: action<int> setter = x => x = x . 1 of reasons wish compare references in other parts of application. wish use references identify particular property. for example, want succeed : var example = new example(); func<int> = example.getx; func<int> somethingelse = example.getx; bool equality = something.equals(somethingelse); only using properties. i imagine accomplished reflection, m

node.js - How to find out whether there are still events registered in the event loop (bonus: how many) -

i trying write node.js program execute , monitor javascript programs. looking way find out whether monitored program still "running" i.e. doing useful. in current approach, when receiving code test, start new child process , hand code it. child process instruments code creates sandbox using contextify , executes code using sandbox. after sandbox.run(code) call returned know blocking part of code finished , can show in ui. however, don't whether code registered timers using settimeouts or created other event sources cause parts of code exited later. don't know whether it's "finished" yet. is there way in node.js check whether there still events on event loop handled (or better, how many left)? i found this other question , talks how monitor event loop find out whether performance of node still fine. i'm not interested in performance (i don't care if executing code blocking 10s or doing 1ms every 2 minutes) , don't want use outsid

java - Do action when something is printed in System.err -

like in topic - trying action when printed error stream, code below not working: try { system.setout(new printstream("infolog.txt")); system.seterr(new printstream(new fileoutputstream("errorlog.txt") { public void write(int b) throws ioexception { super.write(b); error(); } public void write(byte[] b) throws ioexception { super.write(b); error(); } })); } catch (filenotfoundexception ex) { logger.getlogger(housecalc.class.getname()).log(level.severe, null, ex); } is there way "catch" system.err stream , make action before gets printed file? make sure override the appropriate methods . have @ source of printstream , because might calling each other . want way down. write(char cbuf[], int off, int len) might 1 need.

javascript - c# html array of form elements -

@using (html.beginform()) { @html.validationsummary(true) <div id="elem"> <div class="fields"> <select name="items[1][0]" id="items[1][0]"> <option value="1">book</option> <option value="2">brush</option> </select>&nbsp;&nbsp; <input type="text" value="1" name="items[1][1]" id="items[1][1]">&nbsp;&nbsp; <a id="test" href="#">remove item</a> </div> </div> </div><a href="#" id="addelem">add item</a></div> <br /> <input type="submit" name="name" value="submit" /> } basically, has set of 2 fields name field , serial field defined in 2 dimensional array. add item link work

quotes - Parsing Exchange Recipients from a string with Regex -

i'm break down 2 operations since can't seem figure out regular expression in one. however, thought ask brain trust here see if can (which i'm sure can). essentially have string containing recipients field email in exchange. want parse out individual recipients. don't need validate emails or anything. data comma separated except if comma in between set of quotes. that's part that's messing me up. right i'm using: (?"[^"\r\n]*") which gives me quoted names, , ([a-za-z0-9_-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([a-za-z0-9-]+.)+))([a-za-z]{2,4}|[0-9]{1,3}) which gives me email addresses here's have.. data: "george washington" <gwashington@government.net>, "abraham lincoln" <alincoln@government.net>, "carter, jimmy" <jimmy.carter@presidents.com>, "nixon, richard m." <tricky.dick@presidents.com> what i'd this: "george washington" <gwas

html - Emmet overwritten snippet -

i have been following lessons on html , css provided jeffery way on tuts+: http://learncss.tutsplus.com/ i got video on zen coding: http://learncss.tutsplus.com/lesson/zen-coding/ i tried installing zen code sublime text 2 couldn't work. looked around on web , found emmet, seemed new best thing. installed through command pallete>"package install">"emmet". works great, issue snippet used before overwritten emmet. the snippet used: <snippet> <content><![cdata[ <li type="square">${1:item} ${2:} ]]></content> <tabtrigger>li</tabtrigger> </snippet> li + tab trigger: <li type="square"> is there way me add emmet in sublime text 2? or use emmet accomplish tag? found guide emmet tabtriggers, not find one: http://docs.emmet.io/cheat-sheet/ you can either create own snippet in emmet: http://docs.emmet.io/customization/snippets/ http://docs.emmet.io/abbrev

ios - Embed OpenCV framework inside another xCode project without linking -

i have developed xcode static library iphone app using opencv. want give static library them don't want them go through hassle of making opencv work in project changing build settings , that, that's had myself in static library. i use 'projectception' method dragging static-library-project main xcode project. when use method need add frameworks use in static library project again in main project in 'link binary libraries' build phase. so question is: there way opencv in static library project , new project imports static library not have opencv work? yes. clone(copy) opencv inside project (headers , implementation)*, desclare copied files inside project , don't use c/c++ include folder , library linkage. *implementations in modules/.../src/

jquery svg - Dashtype line in svg path -

i want create dash type line in svg using path. how can apply dash style svg path make dashed line. please refer below svg. <path id="container_svg_john_0" fill="none" stroke-width="3" stroke="url(#container_svg_john0gradient)" stroke-linecap="butt" stroke-linejoin="round" d="m 0 -17.25 l 21.633333333333333 -112.12499999999999 m 21.633333333333333 -112.12499999999999 l 43.266666666666666 -51.75 m 43.266666666666666 -51.75 l 86.53333333333333 -25.875 m 86.53333333333333 -25.875 l 108.16666666666666 -155.25 "></path> thanks, siva you looking stroke-dasharray property: <path id="container_svg_john_0" fill="none" stroke-width="3" stroke="url(#container_svg_john0gradient)" stroke-linecap="butt" stroke-linejoin="round" stroke-dasharray="10,10" d="m 0 -17.25 l 21.633333333333333 -112.124999

c++ - Add, enable, disable log4cxx ConsoleAppender at runtime -

how dynamically turn log4cxx logging console on , off in application? goal here process used choice, command line parm or gui input or whatever. in hypothetical main loop: if ( userwantstostartconsolelogger ) consolelogger( true ); if ( userwantstostopconsolelogger ) consolelogger( false ); my logging setup is: #include <log4cxx/logger.h> #include <log4cxx/propertyconfigurator.h> #include <log4cxx/helpers/exception.h> int main( int argc, char** argv ) { const log4cxx::loggerptr logger; log4cxx::propertyconfigurator::configure("./logs.config"); } where ./logs.config looks like: log4j.rootlogger=info, file log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%5p [%t] (%f:%l) - %m%n log4j.appender.file=org.apache.log4j.rollingfileappender log4j.appender.file.file=logs/system.logs log4j.appender.file.maxfilesize=1mb lo

php - Checking if username exists in Database jQuery -

i want check if username taken, here script, outputs "undefined". can me, please? :) this in jquery - $("#registerusername").val() value of input. $.post('checkregister.php',{username: $("#registerusername").val()}, function(data){ window.alert(data.exists); if(data.exists){ window.alert("name found"); }else{ window.alert("name not found"); } }, 'json'); this in checkregister.php header('content-type: text/json'); if(!isset($_post['username'])) exit; $db = new pdo('mysql:host=localhost;dbname=testdatabase','root','pw000'); $query = $db->prepare("select * users username = '" . $_post['username'] . "'"); $query->execute(); echo json_encode(array('exists' => $query->rowcount() > 0)); first, might want strengthen php against sql injection 'sanitizing' input. next wh

java - Selecting Display:None With Jsoup -

i practicing jsoup see possibilities amazing parser can do. there 1 thing unable resolve : i need remove tags display none attribute. 1 obvious way use select : doc.select("*[style=display:none]").remove(); but doesn't apply cases. sometimes, in style tag, there more 1 property, style="display:none,width...." , someytimes, there spaces, colons etc style="display: none;". i tried solve applying : if(!doc.getelementsbyattributevaluecontaining("style", "display").isempty()){ if(!doc.getelementsbyattributevaluecontaining("style", "none").isempty()){ // not sure remove here. } } what should approach done? you try valcontaining construct selector so: doc.select("*[style*=display:none]").remove(); if not match want, try checking out documentation here more options: http://jsoup.org/apidocs/org/jsoup/select/selector.html

sql - How to return a row only if multiple clauses are met -

i working on application dispense liquids. here organization of db canister: canister_id{pk} ingredient_id{fk} ingredient: ingredient_id{pk} ingredient_name drink: drink_id{pk} drink_name ingredientinstance: instance_id{pk} drink_id{fk} ingredient_id{fk} amount each drink has multiple ingredients(held in ingredientinstance table), there 12 canisters. trying write sql command gather drinks have of required ingredients in canisters. so far, have. select distinct drink.drink_name drink, ingredientinstance, canister (((ingredientinstance.drink_id)=[drink].[drink_id]) , ((ingredientinstance.ingredient_id) in (select ingredient_id canister))); however, returning drinks have single ingredient available. looking way ensure every associated ingredient in ingredientinstance, in canister. for example, let's drink1 requires ingredient1 , ingredient2 . want appear in result if both of ingredient ids present in canisters, not if 1 or 0 ingredients

PHP - In an array like 1,3,6,7; how to select row 3? (lowest number below 6) -

i have obscure array follows product id's , respective details. here example of array output : id - 1 stockcode - 113 desc - printer 1 cost - r 113.00 id - 3 stockcode - 133 desc - printer 3 cost - r 133.00 id - 6 stockcode - 163 desc - printer 6 cost - r 163.00 id - 7 stockcode - desc - printer 6 details cost - id - 8 stockcode - desc - printer 6 cost - for reason long explain, able loop through array , within loop , produce outcome. that being id data in second value , nothing in first , third values, gets second value appended preceding 2nd value of key (id) came before here stuck current id. once has been done, key must deleted , process continues. here code that, array named $csvarray , $key relate "id" in example: # clean array - append 2nd values previous values foreach($csvarray $key=>$val) { // imagine id # 7 in loop if ($val[0] == '' && $val[1] !== '' && $val[2] == '') { $

jquery - .Unbind doesnt work with vimeo -

im tryin embed vimeo-video website using jqyuery. when click on button video displaying. , when press close haves close , come original state. embedding works great, closing of video doesnt work. think wrong unbinding. jquery(document).ready(function() { jquery(".button").bind("click", openvideo); jquery(".closevideo").bind("click", closevideo); function openvideo(){ alert(event.target.id); jquery(this).closest('.post').animate({width: "955px"}, 500); jquery(this).closest('#new-royalslider-1').hide(); jquery(this).closest('.post').children('.videoplayer').show(); jquery(this).closest('.post').children('.videoplayer').html('<iframe src="http://player.vimeo.com/video/'+ event.target.id +'?autoplay=1" width="100%" height="570" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></if

ios - Core Data Entity attribute disappearing -

i create core data entity magical record in 1 of classes. save context , assign entity custom cell object's property. i pass cell object different class displays it. @ random point, entity 's attributes become nil. i can still find entity in data base , still valid. @ no point cell object become de-refereance (its stored in class property array). so, @ 1 point in program, here entity : 2013-05-08 13:58:51.425 debug | -[datasetsubbar doescellarray:containcellwithdataset:] | cell.dataset: <savedanalysis: 0x22b0a4d0> (entity: savedanalysis; id: 0x22bba720 <x-coredata://42ca4347-1df1-4c6b-ab44-03efe3d86f3a/savedanalysis/p110> ; data: { createdate = "2013-05-08 18:58:00 +0000"; name = "unsaved analysis"; }) a few seconds later: 2013-05-08 13:58:54.417 debug | -[datasetsubbar createdisplaypanelcells] | cell.dataset.name: (null) 2013-05-08 13:58:54.417 debug | -[datasetsubbar createdisplaypanelcells] | cell.dataset: <sav

version control - Git folding commits without squash -

i have following scenario: i have staged changes , have 3 commits ahead of master. want staged changes apart of oldest commit of three. there couple ways know of this, i'm looking alternate/better methods. here's first method think of. git commit -m "some dummy message since going squashed" git rebase -i head~4 which bring editor, , can move dummy commit want , squash it. is there better/faster/or different way this? i'm trying more productive, , learn git inside , out, info appreciated. you can use git reset, described here: http://git-scm.com/blog/2011/07/11/reset.html git reset --soft head~3 then git commit again.

rdlc - How to add up row totals in report viewer -

i'm new reporting , jargon goes try draw insted of write it. | | | b | c | d | e | ------------------------------------------------- | apples | 1 | 3 | 6 | 2 | 12 | ------------------------------------------------- | oranges | 3 | 2 | 4 | 1 | 10 | ------------------------------------------------- | bananas | 5 | 3 | | 1 | 9 | ------------------------------------------------- | | | | | | 31 | i need sum last column e indicated 31 . cells values 12 , 10 , 9 obtained =sum(fields!a.value + fields!b.value + fields!c.value + fields!d.value) . i can't change sql query and/or dataset used. 1 have suggestion? thanks! edit: i've added function code public total_lookup_sum integer = 0 public function lookup_sum(byval value integer) integer total_lookup_sum = total_lookup_sum + value return total_lookup_sum end function and calling

javascript - jquery draggable containment doesn't work if draggable element has transformation applied -

i'm trying use jquery draggable 's containment feature doesn't seem work if object being contained has transformation applied it. jsfiddle example: http://jsfiddle.net/us2fr/ does know how can fix this? after tweaks drag function, have working solution: http://jsfiddle.net/ggun9/2/ you can test changing scale , orig values. if test div smaller container stay within it's bounds. if it's larger, you'll able drag around, stay in bounds (i.e. shouldn't ever see white space inside container ). update: i noticed today jsfiddle example above not work if css left , top values not 0px test div. i've fixed , updated fiddle: http://jsfiddle.net/ggun9/3/ hopefully in future!

java - How do generics of generics work? -

while understand of corner-cases of generics, i'm missing following example. i have following class 1 public class test<t> { 2 public static void main(string[] args) { 3 test<? extends number> t = new test<bigdecimal>(); 4 list<test<? extends number>> l =collections.singletonlist(t); 5 } 6 } line 4 gives me error type mismatch: cannot convert list<test<capture#1-of ? extends number>> list<test<? extends number>>`. obviously, compiler thinks different ? not equal. while gut-feeling tells me, correct. can provide example runtime-error if line 4 legal? edit: to avoid confusion, replaced =null in line 3 concrete assignment as kenny has noted in comment, can around with: list<test<? extends number>> l = collections.<test<? extends number>>singletonlist(t); this tells operation isn't unsafe , it's victim of limited inference . if unsafe, above wouldn

eclipse - Android DDMS file explorer not working for Rooted Samsung Galaxy Note GT-N7000 -

Image
i have been playing @ 2 days now. have rooted samsung galaxy note gt-n7000 (android 4.1.2 - hard requirement). trying file explorer in ddms display in eclipse (i using file explorer correctly, works fine galaxy nexus). have tried adb root (already runs in root) getprop ro.secure (returns 1, galaxy nexus). have tried ln -s toolbox ls (returns 'file exists') chmod +x toolbox . toolbox being symbolically linked correctly: lrwxrwxrwx root root 2013-02-26 09:30 ls -> toolbox -rwxr-xr-x root shell 134976 2008-08-01 08:00 toolbox (etc ls -l /system/bin) i can adb shell , ls , every other command fine via adb. ddms>file explorer still draw blank. have rerooted , reflashed incase wrong. used multiple roms. unrooted it. uninstalled busybox make sure not conflicting (busybox runs fine on galaxy nexus) , still nothing. have updated drivers , firmware installed. there else missing not cause ddms file explorer not work??? current rom

html - Setting DOCTYPE With Server-Side Javascript -

i have real quick question. want set doctype html page need using server side javascript. every answer see on site says "i don't see why want it" never answers question (that find... please point me in direction of post if wrong). the reason needs done because technically being sent html email. using exacttarget , won't allow me type above starting < html > tag. if try establish doctype after it, gets removed. now have access server side javascript before email renders. need set doctype because trying set < td > tags "display:block" , not work default doctype. need write script after opening < html > tag set doctype page (email). i wish use following doctype if unwise feel free advise: <!doctype html > also here css not working current doctype: @media screen , (max-width: 660px) { td {display:block !important;} } here html: <table bgcolor="#0033cc" width="100%" border="0"

ios - Core Data Encryption Class -

i'm trying use wonderful git inside xcode project: https://github.com/project-imas/encrypted-core-data it's functional when creating new empty sqlite db. but, how can use existing populated regular database? need encrypt sqlite file , use class provided git. thanks all! you need use sqlcipher convenience function sqlcipher_export . in particular, @ example number 1 plaintext migration.

c++ - how to allocate pointer to pointer on stack and how on heap? -

is correct way allocate pointer pointer on stack , on heap? if not, correct way it? int a=7; int* mrpointer=&a; *mrpointer; int** iptr; // iptr on stack *iptr=mrpointer; //not ok int** iptr_h = new int*(); // iptr_h on heap *iptr_h=mrpointer; thanks mat's answer know correct way put on stack: int** iptr; // iptr on stack iptr=&mrpointer; and on heap: int** iptr_h = new int*(); // iptr_h on heap *iptr_h=mrpointer; if want pointer pointer points @ a variable, how that. int a=7; int* mrpointer=&a; *mrpointer; int** iptr; // iptr on stack iptr=&mrpointer; edit: clarify, in above code changed *iptr = mrpointer; iptr = &mrpointer; . this indeed make pointer same place, via heap. int** iptr_h = new int*(); // iptr_h on heap *iptr_h=mrpointer; edit explain based on comment: one see need this: int* mrspointer; int** iptr = &mrspointer; *iptr = mrpointer;

vim shortcut for keyboard combo and a function call -

i have vim function (written else) runs highlighted visual block script in program. have keybinding ( f9 ) can call visual block of lines. i further automatize things creating specific shortcuts 2 tasks: visually select here beginning of document , call function. visually select current line , call function. i don't need use macro, tried use macros this. added :let @r='0vgg<f9>' to .vimrc first task. , when try run it, seems highlight right area, function call never happens. how suggest create these shortcuts successfully? thanks you should take function, if supports range . if true, don't have visual selection. could: nnoremap <f7> :1,.call yourfunction()<cr> nnoremap <f8> :.call yourfunction()<cr> so, <f7> call function range line1 till current line. <f8> call function on current line. if want define macro, have escape <f9> : :let @r="0vgg\<f9>" otherwise, vim t

java - BufferedImage isn't presented inside JPanel -

i've tried test technique presented in ->this answer <- . private void jbutton1mouseclicked(java.awt.event.mouseevent evt) { bufferedimage img = new bufferedimage(plotpanel.getwidth(),plotpanel.getheight(),bufferedimage.type_4byte_abgr); graphics2d g2d = img.creategraphics(); g2d.setcolor(color.red); g2d.drawline(0, 0, plotpanel.getwidth(), plotpanel.getheight()); jlabel piclabel = new jlabel(new imageicon( img )); plotpanel.add(piclabel); plotpanel.revalidate(); plotpanel.repaint(); } why plotpanel still remains intact? update here well-anticipated sscce: package javaapplication10; import javax.swing.swingutilities; public class javaapplication10 { public static void main(string[] args) { swingutilities.invokelater(new runnable() { public void run() { new newjframe().setvisible(true); }