Posts

Showing posts from April, 2015

arrays - ruby enumerables: is there a detect for results of block evaluation? -

i'm looking similar #detect in enumerables, not quite. enumerable does: [1, 2, 3].detect {|i| > 1 } #=> 2 it returns first instance of array matches condition. now, purpose return value of block. concern not conditions, instance, first not nil. this: [var1, var2, var3].wanted_detect {|var| another_function(var) } in function return first result of another_function call isn't nil. mapping values of applying method on variables , using detect not option. 1 ideally have work in lazy enumerators, mapping of possible values no-go [var1, var2, var3].lazy.map { |var| another_function(var) }.compact.first if don't have access enumerable#lazy , easy enough implement want: module enumerable def wanted_detect self.each |obj| val = yield obj return val if val end end end demo: [1, 2, 3, 4].wanted_detect { |x| x*x if x > 2 } # => 9 edit: sorry, missed last paragraph till falsetru pointed out. thanks comments, falset

jquery - show hide menu on click -

so have html: <ul> <li><a>categ 1</a> <ul> <li><a>subcateg 1</a><li> <li><a>subcateg 1</a><li> </ul> <li><a>categ2</a> <ul> <li><a>subcateg 2</a><li> <li><a>subcateg 3</a> <ul> <li><a>sub sub categ 3</a><li> <li><a>sub sub categ 3</a><li> </ul> <li> </ul> </ul> etc. and js http://jsfiddle.net/fmm3a/ - click on red area(there needs image, test put red bg) i open submenus don't close parent branch, when open other branch other ones close thank you the html list posted here full of errors (you not closing lists (' '), have forgotten tags... well, after correcting them: what t

Make clickable textview in android -

by way have showed ids db. textview setnote = (textview) findviewbyid(r.id.idnotes); setnote.settext(""); //empty current text //db connection databasehandler db = new databasehandler(this); list<contact> contacts = db.getall(); (contact cn : contacts) { integer id = cn.getid(); setnote.append(id.tostring()+"\n"); } result 12 35 42 now want make these ids clickable such when user clicks on each id, open separate activity corresponding id. how can this? if want make whole textview clickable can add onclicklistener others have mentioned. however, if want make each of id's you're printing clickable separately (ie. each 1 goes somewhere else), you'll have create add own span class. here's example implementation. first define own span extending clickablespan : static class myclickablespan extends clickablespan { onclicklistener mlistener; public myclickablespan(onclicklistener listener)

indexing - postgresql full text search function syntax -

in postgres database have table table1 , column column1 type text. , created index column create index idx_column1 on table1 using gin (to_tsvector('english', column1)); question is, why when execute query select * table1 to_tsvector('english', column1) @@ to_tsquery('searchedtext') index used, query index not used select * table1 ts_match_vq(to_tsvector('english', column1),to_tsquery('searchedtext')) wild guess: vector @@ query defined create operator @@( procedure = ts_match_vq, leftarg = tsvector, rightarg = tsquery, commutator = @@, restrict = tsmatchsel, join = tsmatchjoinsel); looking @ tsmatchjoinsel there quite lot going on (don't ask me what, kind of c way beyond me....) if go through different functions, there calculations involved. when using ts_match_vq directly, bypass these calculations. that's why ts_match_vq never mentioned in docs , should use @@ since takes care of callin

css - how to add background color to input text if it is a dojo datepicker? -

i can't set background color (or border color) of input text, if dojo datepicker. dojo datepicker input text 2 additional attribute: dojotype="dropdowndatepicker" displayformat="yyyy-mm-dd" i assume dojo has own style, if provide style specifies background color, dojo overrides it. something not work: <input type="text" ..other attributes.. style="width:5em;border:solid #ff0000;"> any appriciated. and may add dojo version old dirt ( upgraded) can't take advantage of newer features dijit, etc. dojo uses templates of widgets. html code write (with dojotype attributes , stuff) nothing more placeholder configure widget. inline css applied html applied top level of widget. your widget consists out of multiple html elements , may happend css write inline, not applied correct element. also, dojo indeed uses themes (wich define class="themename" on parent tag (usually <body> ) , default themes o

jquery - Issue with a fixed header allignment -

i'm building site friend, , i've implemented fixed header. http://scsports.comeze.com/blog.php problem when scroll header moves right 7px. have no idea why, i've tried doesn't work. ideas appreciated! html+js: <div class="navbar"> <div class="navbar-inner"> <a class="brand" href="#"><img src="images/logo2.png" class="logo" alt="header logo"></a> <?php include 'socialbtn.php';?> <div class="test"> <ul class="nav"> <!--<li class="active">--> <li><a id="index_link" href="index.php">home</a></li> <li><a id="therapist_link" href="therapist_profile.php">therapist profile</a></li> <li><a href="services.php">services & prices</a></li>

Password requirement not same as email regex c# -

i have mvc application code: public class register { [regularexpression(@"^(?=.*\d)(?=.*[a-za-z]).{7,14}$", errormessage = "password not in proper format")] public string password{ get; set; } } what validate password contain atleast 7-14 characters, atleast 1 number , 1 upper case letter. another requirement should not same email address. how can that? seems [compare(email)] not possible on scenario? thanks in advance! using mvc foolproof validation can write [notequalto("emailaddress", errormessage="passwords must different emailaddress")] public string password{ get; set; } http://foolproof.codeplex.com/

php - Using database objects in functions -

in webapp building make use of pdo database object querying database. instantiated @ top of every page using custom class built based on pdo: $db = new database; //database name of class. i use class in script: $db->query("select field table"); $results = $db->resultset(); i have number of standalone functions need make use of database object. my question is better practise pass $db function argument or globalize within function, given $db globally used variable. have heard things avoiding polluting global namespace. i.e. function myfunction($db, $a1, $a2){ //stuff } vs function myfunction($a1, $a2){ global $db; //stuff } in opinion, global vars practice. think should use first solution: passing db instance first parameters function. if have 1 instance of database , better option make database class singleton. allow $db = database.getinstance(); in functions.

remotewebdriver configure one node per browser? -

i want run tests on remote vm using selenium grid vm has different browsers question is: necessary start node every single browser? no not required ! using single command can start node browsers.

magento still trying to load compiled files even after disabled -

anyone this, it's wierd , i've run out of ideas. i've manually disabled compiler commenting out 2 lines in includes/config.php, i've deleted includes/src , includes/stat directories complete when try edit product errors because magento trying include files in compiled includes/src folder (which no longer exists) i've tried recompiling , accessing on compiled site when error. fatal error: require_once(): failed opening required 'mage/adminhtml/block/widget/grid.php' (include_path='/content/includes/src:.:/usr/share/pear:/usr/share/php') in /content/includes/src/uni_fileuploader_block_adminhtml_widget_grid.php on line 9 i'm figuring sort site can @ least edit compiler disabled , work through issues compiled site can't either magento seems want access compiled files when compiler disabled. running 1.7.0.2 additionally - may or may not related. when run compiler.php command line bunch of warnings follows compilation processes s

Compile files with references to each other in Scala -

this first day of programming scala , need build project. so, let's have 1 file config.scala , contains line var bestpage1:basepage = null , file basepage.scala , contains if(m_refer != null) m_refer.mkstring(config.refersmalldivisor) else "" . and when try compile 1 of them, error: not found: value config or error: not found: value basepage . so how compile them both? added: file contents basepage.scala config.scala the reason it's not finding config because config class doesn't exist. the scwikimetric.config class, however, does. import , things go better, think.

visual studio 2012 - Error in MVVM when building -

i created pcl called tipcalc>core, tutorial witch building one . here tipviewmodel.cs using cirrious.mvvmcross.viewmodels; namespace tipcalc.core { public class tipviewmodel : mvxviewmodel { private readonly icalculation _calculation; public tipviewmodel(icalculation calculation) { _calculation = calculation; } public override void start() { _subtotal = 100; _generosity = 10; recalcuate(); base.start(); } private double _subtotal; public double subtotal { { return _subtotal; } set { _subtotal = value; raisepropertychanged(() => subtotal); recalcuate(); } } private int _generosity; public int generosity { { return _generosity; } set { _generosity = value; raisepropertychanged(() => generosity); recalcuate(); } } private double _tip; public double tip { { return _tip; } set { _tip = value; raisepropertych

java - GridBagLayout and minimum width -

i want make panel constrained maximum width, reduces width when container becomes shorter. i used gridbaglayout behaves weirdly when size becomes short enough. import java.awt.color; import java.awt.dimension; import java.awt.gridbagconstraints; import java.awt.gridbaglayout; import javax.swing.jframe; import javax.swing.jpanel; /** * @author michael nesterenko * */ public class ssce extends jframe { /** * */ public ssce() { setdefaultcloseoperation(jframe.exit_on_close); gridbaglayout gbl = new gridbaglayout(); gbl.columnwidths = new int[] {200, 1}; gbl.columnweights = new double[] {0, 1}; gbl.rowheights = new int[] {10}; gbl.rowweights = new double[] {0}; setlayout(gbl); gridbagconstraints gbc = new gridbagconstraints(); gbc.fill = gridbagconstraints.horizontal; jpanel sizerestrictedpanel = new jpanel(); sizerestrictedpanel.setbackground(color.blue); si

c# - Parsing ISO 8601 with timezone to .NET datetime -

i have iso 8601 timestamp in format: yyyy-mm-ddthh:mm:ss[.nnnnnnn][{+|-}hh:mm] yyyy-mm-ddthh:mm:ss[{+|-}hh:mm] examples: 2013-07-03t02:16:03.000+01:00 2013-07-03t02:16:03+01:00 how can parse .net framework datetime correct timezone supplied? the datetime.tryparse doesn't work because trailing info regarding timezone . you should able format using datetimeoffset , k custom format specifier . can convert datetime afterwards if want to. sample code: using system; using system.globalization; class test { static void main() { string text = "2013-07-03t02:16:03.000+01:00"; string pattern = "yyyy-mm-dd't'hh:mm:ss.fffk"; datetimeoffset dto = datetimeoffset.parseexact (text, pattern, cultureinfo.invariantculture); console.writeline(dto); } } one thing note badly named - it's not time zone, it's utc offset. doesn't tell original time zone. (there can several d

How to display second item of Card Layout in Secha Touch -

Image
i have 3 card items of card layout, if click other view related second card item, want display second card item, , not swip front side, swip side 2 card of 1 st , 3rd. here code of: ext.define('myapp.view.main', { extend: 'ext.carousel.carousel', requires: ['ext.titlebar'], alias: 'widget.mainmenuview', config: { layout: { type: 'card', }, indicator: false, items:[ { xtype:'firstpage', cls: 'firstpage', scrollable: false, }, { xtype:'secondpage', cls: 'secondpage', }, { xtype:'thirdpage', cls: 'thirdpage', }, ] }//end of config }); this card layout. here want display secondpage of card item. display ok doing this, not swip previous card, going back. ext.define('myapp.view.main', { extend: 'ext.carousel.carousel', requires: ['ext.titlebar'], alias: 'widget.mai

Why put a lang="en" in the <html> tag -

this question has answer here: what lang attribute of <html> tag used for? 4 answers normally when write html doc write <!doctype html> <html> <head> ... i looking @ source of website other day notice had included langauge attribute in <html> tag read <!doctype html> <html lang="en"> <head> ... any idea why ? guessed may search engines, surly advanced nlp search engines can nowadays work out language page in.. from w3c this attribute specifies base language of element's attribute values , text content. default value of attribute unknown. language information specified via lang attribute may used user agent control rendering in variety of ways. situations author-supplied language information may helpful include: assisting search engines assisting speech synthesizers helpin

javascript - Is there a way to add a header in the middle of the rows in jqgrid? -

i have multiple columns in grid, first row dropdown, , second row need provide header. there way provide header in middle of rows.? http://i44.tinypic.com/2qsx9ir.png thanks in advance. i don't think so. why not put dropdown outside/above grid?

asp.net mvc 4 - the process cannot access the file 'xxx.xml' because it is being used by another process -

i googled lot, dint solution problem. iam trying add node in xxx.xml file, throwing error " the process cannot access file 'xxx.xml' because being used process ", below class public class registration { list users; list newusers; string userpath = string.empty; string newuserpath = string.empty; string strusername = string.empty; public bool findusername(string firstname, string lastname, string emailaddress, string country, string purchasedate, string username, string password) { //put code offers database offers variable if (readxml(firstname, lastname, emailaddress, country, purchasedate, username, password)) return true; else return false; } //bool readxml(xmldocument xmlfile2) bool readxml(string firstname, string lastname, string emailaddress, string country, string purchasedate, string username, string password) { try {

c# - How do I access something from a virtual class so I can use them for If/Else statements in the MAIN class? -

class registration { public virtual void register() { int registration_system; console.write("registration system"); console.write("\n 1. add student" + "\n 2. view student" + "\n 3. search" + "\n 4. edit" + "\n 5. delete" + "\n 6. exit"); console.write("\nchoose: "); registration_system = int.parse(console.readline()); } } class program //main class { static void main(string[] args) { registration r = new registration(); r.register(); msit = new msit(); mscs cs = new mscs(); } } so need access registration_system 's value in order use them in if/else system main class: if (registration_system == 1) { } .. i'll doing @ least 6 other classes since missed couple of lessons. far need set skele

HTML img align attribute vs CSS float -

i read align attribute of <img> deprecated in html 4.01. i'm curious 1 thing, align attribute same thing css float? the align attribute distinctly different things depending on value give it. of things have been replaced float , others vertical-align .

how to avoid horizontal scrolling in jquery mobile of page? -

Image
can please tell me how avoid horizontal scrolling in query mobile? page able horizontally.. i need remove horizontal scrolling user scroll vertically working..? here code.. <div data-role="page" id="realtimescreen" > <div data-role="header" data-theme="b" data-position="fixed" data-tap-toggle="false"> <h1 class="ui-title" id="heading" style="text-align:left;margin-left: 20px;" ></h1> <div class="ui-btn-right" id="addbuttons" data-role="controlgroup" data-type="horizontal"> <a ><img src="img/follow-realtime.png" class="follow_h"id=""/></a> <a><img src="img/stop-realtime.png" id="" class="stop_h"/></a> <a><img src="img/email-document.png" id="&q

matlab - How to add appropriate noise to a graph -

Image
i have matlab graph. trajectory. want add noise graph. tried adding normal distribution noise. using rand. e.g. x1=x+a*rand(size(x)); and y. the results attached below. not want. gives me either scatter plot, or noisy plot. illustrated below. first row did, third row want. different graph columns stand different standard deviation (value of a). q. how obtain third type (row) of plot? p.s. first row when use plot(...,".",markersize,1); , second row simple vector plot. the issue want noise have characteristic. have many samples along curve, , you'd stay "connected". you'd smooth results, , want curve stay closed. so, in order: random walk noise keep points connected. low-pass-filtered noise keep curve smooth. , fix noise endpoint 0 (smoothly) ensure closed result. here's code generates 16 different kinds of noise (4x4), varying overall scale , overall amount of filtering. you'll have adjust both of these choices based

spawn - Erlang: Why can't I link two gen_servers? -

i have 2 gen_server modules. first serv.erl -module(serv). -behaviour(gen_server). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, code_change/3, terminate/2, start_link/0 ]). start_link() -> gen_server:start_link(?module, [], []). init([]) -> process_flag(trap_exit, true), spawn_link(user, start_link,[]), {ok, []}. handle_call(_e, _from, state) -> {noreply, state}. handle_cast(_message, state) -> {noreply, state}. terminate(_reason, _state) -> ok. handle_info(message, state) -> {noreply, state}. code_change(_oldversion, state, _extra) -> {ok, state}. and user.erl (which same except init/1): init([]) -> {ok, []}. i thought servers last forever. , if first server dies 1 gets {'exit', pid, reason} message. but if start modules serv:start_link() , user module exit after start message {'exit',pid,normal} . why user die? w

WPF filtering ListBox after ComboBox selected changes c# -

i have combobox binded 1 datatable(1 column "country") , listbox binded 1(2 columns "name", "country"). how make listbox filter on selected item in combo box changes? for example: combobox values: ger, pol, rus datatable binded listbox: name | country john | ger luke | pol sasha| rus cj | ger carl | pol when choose ger in combobox want refresh listbox see only: john cj i used filter datatable dataset.tables["name"].defaultview.rowfilter = "country '%" + comboboxfilter.text + "%' "; but have result delayed 1 click. change | result ger | no change pol | see ger names rus | see pol names pol | see rus names why delayed? combobox.text delayed 1 event to actuall selected value in selection change event code needed datarowview drw = (datarowview)(sender combobox).selecteditem; string text = drw["type"].tostring() ;

encryption - Decrypt tor traffic -

i got tor client using on mashine in local network, capture traffic. can redirect tor traffic on server/client, add clients in network, modify or inject every packet mashine. so, there way decrypt tor traffic or see requested resources? one of ways see requested resources dns-sniffing. if client isn't encapsulate dns-requests traffic tor network , requested internet (not tor internal) resources can capture network packets between client , dns-server.

excel vba - else if statement defaulting to the last condition vba -

i'm writing macro read column of dates, check month of each item, record number in variable, , put final number in cell. program looking through column of 2999 items. column isn't full. number selected because number of items high. the each loop checks month each cell , increases month's variable 1. @ end, december variable around 2500. there 500 filled rows. sum of months comes 2999 (the number of rows being searched). i'm not sure why it's doing this. tried adding "else" condition. it's not reaching far. a15 never filled "batman". have missing simple. help? dim rng3 range dim jancount integer dim febcount integer dim marcount integer dim aprcount integer dim maycount integer dim juncount integer dim julcount integer dim augcount integer dim sepcount integer dim octcount integer dim novcount integer dim deccount integer dim datevalue date dim monthint integer set rng3 = sheets("sheet2").range("k2:k3000") each ce

php - How to only save new tweets/instagram photos to database? -

i'm building 2 cron-jobs regularly searches new tweets , instagram photos(and potentially more services) based on tag. the content saved database , later outputted webpage. allows faster loading , more importantly ability remove tweets not displayed. i want make sure no posts saved twice in database , not sure approach best. here options consider: i use laravel , has ability demand postid unique, make database refuse when try save existing posts. might render unnesseary sql-queries though. i check database latest saved post id , stop loop once post. atleast in twitter, can pass parameter since_id, wich allows me latest posts. haven't found same parameter in instagram , wouldn't work html-scraping either. twitter provides 'created_at' value, giving date , time tweet created. each time cron job runs, store date , time, on next run, upload tweet if date/time prior value of 'created_at'. i'm not familiar instagram, sorry - assume s

javascript - How can I create a zoom animation from one ng-view to another? -

my screen broke 4 equal rectangles each chart in. want user able click on chart , application zoom new view chart whole page. so set-up: app/charts displays charts. when user selects chart (say chart-1), app navigates app/charts/chart-1. i chart clicked expand view until takes whole screen (the new view). i'm open approach this. css, javascript libraries, hacks (maybe use 1 view , zoom in on selected div?) want able navigate full screen chart url though... thanks, appreciated. <div class="wrapper {selected_class}"> <div ng-click="selected_class='top-left'" class="top-left"></div> <div ng-click="selected_class='top-right'" class="top-right"></div> <div ng-click="selected_class='bottom-left'" class="bottom-left"></div> <div ng-click="selected_class='bottom-right'" class="bottom-right">

bash - Process substitution - Node.js child_process -

i'm trying run child process modify file (in 2 steps) before reading modified content stdout. i'm trying using process substitution works in bash not when try node. this kind of, command looks like.. var p = exec('command2 <(capture /dev/stdout | command1 -i file -) -', function (error, stdout, stderr) { console.log(stderr); }); stderr prints: /bin/sh: -c: line 0: syntax error near unexpected token `(' what proper way of doing in node? i solved putting commands in shell script , calling script node child process. needed add following set bash in posix mode allow process substitution: set +o posix there nicer way of doing directly within node did job. cheers!

multithreading - Does a Self-Hosted Windows Forms WCF Service need to be on a background thread? -

i've searched , searched , seen questions similar, not specific, this. i doing msmq-based request/response wcf setup, windows forms client sends msmq wcf message service, runs long running process, , uses string addressed passed client put status updates in queue on client. client should self-host wcf msmq based service picks , responds status messages. the problem is, opening host in program.cs , waiting close until formclose, that, @ startup, windows form process 1 message in queue (leftover previous run), , no more. feels kind of threading issue. however, examples i've seen seem act it's okay host.open() in form create or startup, , host.close() on shutdown, , should pick messages fine. if has example of doing wcf incoming msmq messages picked whenever arrive, while ui stays repsonsive, please let me know. for it's worth, make sure service , queue configured correctly, did simple wcf standalone library project same config , source files, , processes me

php - Linear representation of an array tree -

i have 1 1 linear tree languages => types => products => etc; languages having many types , types having many products , on. i have written recursive function return array in following style: array ( [0] => array ( [id] => 166 [name] => product1 [type] => product [depth] => 2 [parent] => array ( [0] => array ( [id] => 165 [name] => default [type] => type [depth] => 1 [parent] => array ( [0] => array ( [id] => 1 [name] => en [type] => language [depth] => 0

javascript - Flot 0.8.2 Line Chart - Color Bug -

Image
i working flot line charts , setting colors. found odd bug. after first 3 colors, plot uses last color of other lines. not correct behavior. what makes more interesting legend displays correct colors. known bug? var dataset = [ {label: "d1", data: demand}, {label: "d2", data: demand2}, {label: "d3", data: demand3}, {label: "d4", data: demand4}, {label: "d5", data: demand5}, {label: "d6", data: demand6} ] $.plot(placeholder2, dataset, { series: { }, legend: { nocolumns: 0, position: "nw" }, colors:["#2980b9","#d35400","#f39c12","#7f8cff","#c0392b","#7f8c8d"] }); just make sure wasn't going crazy, , confirm, tried code again, removed colors specification. you'll see flot's default colors, last color "sticks". looks bug result

php - Mysql, finding missing numbers in a sequence -

this question has answer here: sql: find missing ids in table 15 answers i have huge table couple hundred thousand records. have unique id first column though missing in sequence of numbers. i trying show list of numbers missing individually. so example: 10029 10032 10034 10036 i trying show: 10030 10031 10033 10035 i found query seems missing numbers when there's range: select t1.id+1 missing data t1 left join data t2 on t1.id+1 = t2.id t2.id null result: 10030 10033 as can see, 10031 , 10035 missing list. perhaps starting point. not tested, might work select @min := (select min(id) yourtable); // smallest id in table select @last := @min; // cache min value clause select id, id - @last difference, @last := id yourtable id > @min order id asc having difference > 1 it won't give individual missing ids, it'

ios - GLSL ES precision errors and overflows -

i have following fragment shader: precision highp float; varying highp vec2 vtexcoord; uniform sampler2d ucolortexture; void main () { highp vec4 tmp; tmp = ((texture2d (ucolortexture, vtexcoord) + texture2d (ucolortexture, vtexcoord)) / 2.0); gl_fragcolor = tmp; } i know shader not make sense should still run correct , try reproduce problem it. when analyze shader xcode opengl-es analyzer shows error: overflow in implicit conversion, minimum range lowp float (-2,2) and not shows error, rendering output broken overflows. it's not false positive analyzer overflows. can explain me why dis produces overflow although chose highp everywhere? you didn't really choose highp everywhere; glsl es spec chapter 8 (built-in functions): precision qualifiers parameters , return values not shown. texture functions, precision of return type matches precision of sampler type. and 4.5.3 (default precision qualifiers): the fragment langu

asp.net - Sudden Named Pipes Provider Error 40 -

i'm trying deploy new build of asp.net site iis 6. current build of site works fine. however, whenever deploy new build, named pipes error. there few code(logic) changes, nothing data connections, , web.config files in 2 builds identical. idea why might happening? as mentioned, turns out new deploy connecting internally(hosted locally) (diff ip, same db instance), while the current deploy reaching out externally since it's not hosted locally(data center). exact same server, hit different ips.

WPF looks different for a .net 3.5 project after installing .net 4.5 on my system -

i have user interface targeted use .net 3.5. in user interface there graphical issues (sliders have stair-step effect, text skewed) , caused (so i've been told) new graphics card assuming .net 4.0 installed. calls function has (since 3.5) been altered/improved, in 3.5 behaves differently graphics card assumes, , therefore renders responses incorrectly. in attempt fix issue decided upgrade project utilize .net 4.5 due several large wpf improvements. upon installing .net 4.5 on system, however, saw graphical issues disappear, before changed project target .net 4.5. does know going on? troubling side effect unanticipated; project says it's utilizing 3.5, it's rendering if it's using 4.5. .net 4.5 not side-by-side .net 4.0 . replace 4.0. on channel 9 have listened interview bcl team promise without side effects (or @ least no bad side effects) but wpf there changes. in case better - @ least when installing .net 4.5 better. have case in .net 4 , looks

wpf - Viewbox is clipping my dockpanel -

Image
this program looks in editor this screen shot tablet program running on. the xaml said code this <window x:class="dliunitlibrary_wpf.configurewindowlandscape" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:dliunitlibrary_wpf" xmlns:posbutton="clr-namespace:dliunitlibrary_wpf.buttons" xmlns:unitimagepanels="clr-namespace:dliunitlibrary_wpf.unitimagepanels" background="{dynamicresource formbackground}" width="800" height="480" windowstate="maximized" windowstyle="none" loaded="window_loaded"> <window.resources> <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="d

plugins - Make a pyramid app ready for standalone and embedded mode -

i'm developing wiki engine. since application can usefull (at least company's private use) in own should able run standalone pyramid application, own graphical theme. wiki feature useful part of bigger project, , able include other pyramid applications. i found pyramid features me achieve first i'm not sure whether it's best way , second problems remain open. here potential issues see: templates: how switch between standalone mode , hosted mode host variables: event if can reuse host template, variables may needed correctly render templates not set guest (the wiki engine) application. authentication: guest app defines own login system (based on pyramid_persona). can guest application reuse host authentication system? my current idea use config.include() system of pyramid. in wiki engine, in __init__.py define include(config) method in addition the main() method used standalone mode. in host application define variable in .ini file points template

multithreading - out of memory exception while using multithread in C# -

i new threading , stuck here on issue. have application using multi threading. have function uploads thousands of images on ftp server. each images creating new thread. thread calls function connect ftp server, upload file , returns boolean value if uploaded. my problem is, since uploading thousands of images , each creating own thread, after sometime out of memory exception , application freezes. my codes follows: public int16 uploadfiles(string[] files) { foreach (var filename in files) { if (uploadfile(filename)) { strlogtext += "\r\n\tfile: " + filename + " downloaded."; } } } private bool uploadfile(string filename) { var blndownload = false; var thread = new thread(() => downloadfilenow(filename, out blndownload)) {isbackground = true}; thread.start(); return blndownload; } private void downloadfilenow(string filename, out bool bl

wix3.7 - How to rebuild the exact same msi file from source with WiX? -

after application installed msi made wix : if run same msi file go in maintenance mode , can repair / uninstall. if run msi rebuilt source product id="*" in wix source start normal install , not detect it's installed. if go through install listed installed 2 times (with same version number) in add/remove programs. if run msi rebuilt source product id="my-own-guid" in wix source error "another version of product installed. ..." how can build exact same msi have in source control? don't have keep original msi file source? you can set <package id="your_guid"...> msi has same packagecode each build.

c++ - Task Scheduler: run task each hour from the current moment -

here problem: need create scheduled task executed each hour right moment installed. , must started each time user log in. so far good. using examples msdn i've created task based on ilogontrigger, i've set repetition 1 hour , thats ok. after relogin or reboot task starts - need. don't want user reboot or relogin right now. so question is: how make countdown current moment? understand can force run registered task - thats want avoid, want start hour later, , again, , again, etc... one solution can imagine right create logon task without repetition , start delay. , each time executes run again delay. bad solution me. may i'm missing something? oh. , must compatible first version of task scheduler (i.e. task_compatibility_v1 setting set). can live without :) thanks advices if any. ok, i've managed how want myself. for task scheduler 2.0 can done assigning trigger task: iregistrationtask. if task_compatibility_v1 setting set trigger wouldn'

DHCP C++ error LNK2019 -

given follow code cannot seem figure out why receiving error if help. code: #include "stdafx.h" #include "windows.h" #include "dhcpcsdk.h" //#include "dhcpcsvc.dll" #include <iostream> using namespace std; #define number_of_options 7 //#define number_of_options 4 enum optionarraypositions { mask, dns, hostname, vendor, lease_time, message_type, serverip }; bool retrievedhcpinfo(lpwstr pszadaptername); void printasascii(dhcpcapi_params param); void printasip(dhcpcapi_params param); void printasint(dhcpcapi_params param); void printmask(dhcpcapi_params param); void printdns(dhcpcapi_params param); void printhostname(dhcpcapi_params param); void printvendor(dhcpcapi_params param); void printleasetime(dhcpcapi_params param); void printmessagetype(dhcpcapi_params param); void printserverip(dhcpcapi_params param); bool retrievedhcpinfo(lpwstr pszadaptername) { dword dwerror, dwsize; char tmpbuffer[1000]; /

objective c - Why NSJSONSerialization uses NSData instead of NSString? -

is there reason nsjsonserialization use nsdata instead of nsstring representing json data? nsstring seems more obvious choice me... i imagine more efficient encourage parsing nsdata instead of nsstring . if parsing response server, example, you'll nsdata object representing buffer of raw bytes returned server (note nsjsonserialization includes method parsing nsinputstream directly). parsing whole thing nsstring waste since intermediate object thrown out. instead, nsjsonserialization parsing bytes in nsdata object directly , construct nsstrings appropriate keys , values in resulting data structure.

javascript - Why do regex constructors need to be double escaped? -

in regex below, \s denotes space character. imagine regex parser, going through string , sees \ , knows next character special. but not case double escapes required. why this? var res = new regexp('(\\s|^)' + foo).test(moo); is there concrete example of how single escape mis-interpreted else? you constructing regular expression passing string regexp constructor. you need escape \ string literal can express data before transform regular expression.

web services - Java 6 | SOAP Webservice generating without embedding it inside some parameter -

i trying integrate legacy application in have defined message format data structure. now use java 6 publish our web service via following code: endpoint.publish(urlstring, new notificationlistener()); my notificationlistener service contains 1 method , definition follows: @webservice public class notificationlistener { @webmethod(action="notifystatus111") @webresult(name="notificationresponse") public notificationresponse notifystatus1(@webparam(name="notification") notification notification) { return new notificationresponse(); } and using wsgen command generate stubs webservice via following ant command: <project default="wsgen"> <target name="wsgen" > <exec executable="wsgen"> <arg line="-cp ./bin -keep -s ./src -d ./bin com.xyz.listener.notificationlistener"/> </exec> </target> </project> now p

bittorrent - Want to make a Search Engine -

i want make torrent search engine provide links other torrent sites. need data other sites index them in database. so, legal crawl website purpose or there other way that. depending on site, without permission not legal. you might wish investigate common crawl , website has crawled entirety of web. check out tou section check on legality of all.

Google Analytics API: Can I view time and location of every visit? -

i writing php script access google analytics data using api. need following report: within given time range every visitor coming paid search need know time of visit , location (city) visitor came from. is possible construct such query? dimensions/metrics/filters like? example great! no. google analytics not show data exact minutes (hour of day smallest unit of time) , not report single visits/user sessions - ga reports aggregated data. can have aggregated values cpc visits given city given hour of day that's closest gets.

javascript - Is there a style to apply that allows the legend to style each series as a button? -

i'd style legend each series looks button it's more intuitive users know can click on series , filter each series. how can achieve this? see highcharts legend documentation . hopefully, may find available property fits needs. edit: play style property

javascript - What is the easiest way to trigger a C# class from an asp.net page? -

in asp.net page have 3 labels: a default name filter by filled list of names want click on new filter filled list of items filtered 2 , 3 both filled content loaded in c# code behind it. when page loads, automatically filtered default text of first label. want click on other labels call method triggered on page load filtering clicked on name. my problem i've tried replacing first label whichever name clicked on , loading content again filtered first label, seems reset label it's default text filtering same way does. perhaps ajax easiest way haven't tried basic example doing great. if have more questions ask. you can use page methods. have sign method [webmethod] attribute tutorial here

c++ - calling a self destructor from inside a method -

i wanted know if possible call destructor of class own method. instance have class foo created such foo* f = new foo(); now suppose foo has method called finalize void foo::finalize() { //do finalizing code //delete instance; } is possible finalize call destructor of foo , recover memory allocated new ? if how ? you can call delete this; delete object within method

git - Copying some branches of a repository into a new repository -

we have huge git repository (say )that contains many branches. want create new smaller repository (say b) contain few branches of a. what know follows clone branches repository local push these branches repository b. don't have method copy these branches directly repository b?. or improvement above mthod? if have direct access repo a , can directly branch want new repo b . but if need clone first, concrete example exists in " clone stable , 1 other branch in git? ", , uses same tip question mentioned mnagel , git remote : cd b git init . git remote add -f -t remote-branch1 -t remote-branch1 remote-name remote-url note -f which, when used git remote add , fetch remote_name .

Can't access Leaflet map with Backbone.js -

when initialising leaflet map backbone.js can't access exact map anymore. e.g.: mapview.map.locate({setview: true, maxzoom: 10}); will result in typeerror: 'undefined' not function (evaluating 'mapview.map.locate({setview: true, maxzoom: 10})') the map initialized via separate view in dashboard view like: this.mapview = new mapview(); $(this.$el).find('.content').append(this.mapview.el).find('.map').addclass('full').css({ 'height': $(window).height() / 2 }); this view looks like: var mapview = backbone.view.extend({ template: _.template(""), render: function () { this.$el.html(this.template()); this.map = l.map(this.el).setview([48.00786, 13.17989], 8); this.map = l.tilelayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: 'openstreetmap &copy; mitwirkende der <a href="http://osm.org/copyright