Monday, 15 April 2013

c# - Label text doesn't get updated until the whole loop is completed -



c# - Label text doesn't get updated until the whole loop is completed -

i have winform programme calculations when user clicks on button , calls picturebox paint event draw new bmp based on results of calculations. works fine.

now want 100 times , every time picturebox refreshed, want see iteration it's in updating text on label per below:

private void button2_click(object sender, eventargs e) { (int iterations = 1; iterations <= 100; iterations++) { // calculations alter cellmap parameters cellmap.calculate(); // refresh picturebox1 picturebox1.invalidate(); picturebox1.update(); // update label current iteration number label1.text = iterations.tostring(); } } private void picturebox1_paint(object sender, painteventargs e) { bitmap bmp = new bitmap(cellmap.dimensions.width, cellmap.dimensions.height); graphics gbmp = graphics.fromimage(bmp); int rectwidth = scalefactor; int rectheight = scalefactor; // create solid brushes brush bluebrush = new solidbrush(color.blue); brush greenbrush = new solidbrush(color.green); brush transparentbrush = new solidbrush(color.transparent); graphics g = e.graphics; (int = 0; < cellmap.dimensions.width; i++) { (int j = 0; j < cellmap.dimensions.height; j++) { // retrieve rectangle , draw brush whichbrush; if (cellmap.getcell(i, j).currentstate == cellstate.state1) { whichbrush = bluebrush; } else if (cellmap.getcell(i, j).currentstate == cellstate.state2) { whichbrush = greenbrush; } else { whichbrush = transparentbrush; } // draw rectangle bmp gbmp.fillrectangle(whichbrush, i, j, 1f, 1f); } } g.interpolationmode = system.drawing.drawing2d.interpolationmode.nearestneighbor; g.drawimage(bmp, 0, 0, picturebox1.width, picturebox1.height); }

the problem having label text gets displayed after lastly picturebox update completed. essentially, not display 1 through 99. can see picturebox updates after every refresh bmp changes every iteration. idea?

to reply question why have it: windows forms programs run in single thread - ui thread. means must execute code in order, finish function before can switch ui code. in other words, can't update pictures until after finished function, if updated image 100 times, lastly 1 updated. using invalidate/update code tells compiler "pause" execution of function , forces update ui instead of waiting till end of function. hope helps!

c# winforms image repaint

ruby on rails - undefined method `each' for nil:NilClass? -



ruby on rails - undefined method `each' for nil:NilClass? -

i want dynamically create checkboxes users in database, shall possible take (one or many). however, apparently doing wrong because code below gives me next error:

undefined method `each' nil:nilclass ... <% @users.each |user| %> <--- line error

the controller:

class projectscontroller < applicationcontroller ... def new @project = project.new @users = (current_user.blank? ? user.all : user.find(:all, :conditions => ["id != ?", current_user.id])) end ... end

the view (new.html.erb):

<%= form_for @project |f| %> <div class="alert alert-block"> <%= f.error_messages %> </div> <div class="text_field"> <%= f.label :title%> <%= f.text_field :title%> </div> <div class="text_field"> <%= f.label :description%> <%= f.text_field :description%> </div> <div class="dropdown"> <%= f.label :start_date%> <%= f.date_select :start_date %> </div> <div class="dropdown"> <%= f.label :end_date%> <%= f.date_select :end_date %> </div> <% @users.each |user| %> <%= check_box_tag "project[member_ids][]", user.id, @project.member_ids.include?(user.id), :id => "user_#{user.id}" %> <%= label_tag "user_#{user.id}", user.first_name %> <% end %> <div class="checkbox"> </div> <div class="submit"> <%= f.submit "spara" %> </div> <% end %>

the model:

class project < activerecord::base has_and_belongs_to_many :users belongs_to :user has_many :tickets, :dependent => :destroy ... validations ... attr_accessible :user_id, :title, :description, :start_date, :end_date end

i have 5 users in database, table isn't empty or anything. doing wrong here?

the error happens when seek submit form , fails validation. if create action renders new template, that's problem lies.

as suggested 1 of commenters, can declare @users in create action. suggest declare when fails validation (to cut down number of db queries 1 , cut down creation of unnecessary active record objects) in next code

def create @project = project.new params[:project] if @project.save redirect_to @project else @users = user.all # declare here when needed render :new end end

ruby-on-rails ruby-on-rails-3 variables view instance-variables

ios - Animating the transition of switching between views -



ios - Animating the transition of switching between views -

i working through beginners guide programming ios6. it's been fine until when tried animate switching , forth between 2 views. final goal of exercise have seem if each view on of other (like sides of coin/piece of paper).

however, when utilize code given in book, 1 of animations activates book says code should work both.

i have been on code multiple times create sure have done right , have not been able distinguish difference between code have , code in book. know it's simple doing (or more not doing) don't have experience find it.

any help much appreciated.

code:

- (ibaction)switchviews:(id)sender { [uiview beginanimations:@"view flip" context:nil]; [uiview setanimationduration:1.25]; [uiview setanimationcurve:uiviewanimationcurveeaseinout]; if (self.yellowviewcontroller.view.superview == nil) { if (self.yellowviewcontroller == nil) { self.yellowviewcontroller = [[bidyellowviewcontroller alloc] initwithnibname:@"yellowview" bundle:nil]; } // 1 doesn't work [uiview setanimationtransition:uiviewanimationoptiontransitionflipfromright forview:self.view cache:yes]; [self.blueviewcontroller.view removefromsuperview]; [self.view insertsubview:self.yellowviewcontroller.view atindex:0]; } else { if (self.blueviewcontroller == nil) { self.blueviewcontroller = [[bidblueviewcontroller alloc] initwithnibname:@"blueview" bundle:nil]; } // 1 works [uiview setanimationtransition:uiviewanimationtransitionflipfromleft forview:self.view cache:yes]; [self.yellowviewcontroller.view removefromsuperview]; [self.view insertsubview:self.blueviewcontroller.view atindex:0]; } [uiview commitanimations]; }

its because utilize uiviewanimationoptiontransitionflipfromright instead of uiviewanimationtransitionflipfromright

ios animation view

Inno Setup - How to edit the "About Setup" dialog text box -



Inno Setup - How to edit the "About Setup" dialog text box -

i need edit or replace text in about setup dialog box text of inno setup.

here picture:

looking in net got code:

[setup] appname=my programme appvername=my programme v 1.5 defaultdirname={pf}\my programme outputdir=. [languages] name: "default"; messagesfile: "compiler:default.isl" [files] source: callbackctrl.dll; flags: dontcopy [code] type twfproc = function(h:hwnd;msg,wparam,lparam:longint):longint; function callwindowproc(lpprevwndfunc: longint; hwnd: hwnd; msg: uint; wparam: longint; lparam: longint): longint; external 'callwindowproca@user32.dll stdcall'; function setwindowlong(wnd: hwnd; index: integer; newlong: longint): longint; external 'setwindowlonga@user32.dll stdcall'; function wrapwfproc(callback: twfproc; paramcount: integer): longword; external 'wrapcallbackaddr@files:callbackctrl.dll stdcall'; var oldproc:longint; procedure aboutsetupclick; begin //edit text here msgbox('custom text here', mbinformation, mb_ok); end; function wfwndproc(h:hwnd;msg,wparam,lparam:longint):longint; begin if (msg=$112) , (wparam=9999) begin result:=0; aboutsetupclick; end else begin if msg=$2 setwindowlong(wizardform.handle,-4,oldproc); result:=callwindowproc(oldproc,h,msg,wparam,lparam); end; end; procedure initializewizard; begin oldproc:=setwindowlong(wizardform.handle,-4,wrapwfproc(@wfwndproc,4)); end;

seems work fine..

but if close installer, crash message.

please need help prepare code or give improve illustration alter text in setup dialog text box.

the dll used. here

you need give saved original windows procedure wizard form before exit setup application. so, utilize this:

const gwl_wndproc = -4; procedure deinitializesetup; begin setwindowlong(wizardform.handle, gwl_wndproc, oldproc); end;

anyway, can utilize more trustful library wrapping callbacks, innocallback library. i've made review of code used , added back upwards unicode innosetup versions, expecting utilize of innocallback library:

[setup] appname=my programme appversion=1.5 defaultdirname={pf}\my programme outputdir=userdocs:inno setup examples output [files] source: "innocallback.dll"; destdir: "{tmp}"; flags: dontcopy [code] #ifdef unicode #define aw "w" #else #define aw "a" #endif const gwl_wndproc = -4; sc_aboutbox = 9999; wm_syscommand = $0112; type wparam = uint_ptr; lparam = longint; lresult = longint; twindowproc = function(hwnd: hwnd; umsg: uint; wparam: wparam; lparam: lparam): lresult; function callwindowproc(lpprevwndfunc: longint; hwnd: hwnd; msg: uint; wparam: wparam; lparam: lparam): lresult; external 'callwindowproc{#aw}@user32.dll stdcall'; function setwindowlong(hwnd: hwnd; nindex: integer; dwnewlong: longint): longint; external 'setwindowlong{#aw}@user32.dll stdcall'; function wrapwindowproc(callback: twindowproc; paramcount: integer): longword; external 'wrapcallback@files:innocallback.dll stdcall'; var oldwndproc: longint; procedure showaboutbox; begin msgbox('hello, i''m box!', mbinformation, mb_ok); end; function wndproc(hwnd: hwnd; umsg: uint; wparam: wparam; lparam: lparam): lresult; begin if (umsg = wm_syscommand) , (wparam = sc_aboutbox) begin result := 0; showaboutbox; end else result := callwindowproc(oldwndproc, hwnd, umsg, wparam, lparam); end; procedure initializewizard; begin oldwndproc := setwindowlong(wizardform.handle, gwl_wndproc, wrapwindowproc(@wndproc, 4)); end; procedure deinitializesetup; begin setwindowlong(wizardform.handle, gwl_wndproc, oldwndproc); end;

inno-setup

search - PHP: searching for a specific element somewhere in an HTML document -



search - PHP: searching for a specific element somewhere in an HTML document -

i have rather big html document trying extract info from. have gotten far figuring out need utilize domdocument object, , xpath. need homecoming contents of specific div. news has class tag associated it. bad news is buried in non-specific location in html document, within several layers of othere div's, , location may change. so, looking homecoming contents of div.

<div class='target'>return of stuff</div>

the trick seems in don't know particular location particular div in. need way 'search entire dom div class-name of target'. there may multiple coinsurance, not. however, 1 time the, array of element contents, can take there. , again, using php 5.4.

the xpath query need is:

$query = "//div[@class='target']";

which can utilize domxpath object invoking query method.

php search dom xpath

iphone - How to insert and get the file in iOS device? -



iphone - How to insert and get the file in iOS device? -

i working ios development, possible insert file in device , file application. saw file-manager app in app-store , share files using bluetooth, itunes connect , wifi options. how this? please help me.

thanks in advance

i want upload doc or docx file , manage app.

iphone ios ipad file nsfilemanager

javascript - How can I use list instead of dropdown for the languages switcher? -



javascript - How can I use <ul> list instead of <select> dropdown for the languages switcher? -

i utilize msdropdown convert <select> <ul> list languages switcher. problem jquery plugin, select takes long time load after page loaded.

so, how can utilize ul list rather select?

this select code:

<select name="lang" class="language" onchange="location.href='index.php?lang='+this.value+''.$trackpage.'"> <option name="lang" data-image="style/lang/de.png" value="de">deutsch</option> <option name="lang" data-image="style/lang/en.png" value="en" selected="selected">english</option> <option name="lang" data-image="style/lang/es.png" value="es">espanol</option> <option name="lang" data-image="style/lang/fr.png" value="fr">francais</option> <option name="lang" data-image="style/lang/it.png" value="it">italiano</option> </select>

i tried with:

<ul onchange="location.href='index.php?lang='+this.value+'"> <li> <a href="" name="lang" data-image="style/lang/de.png" value="de">english</a> </li> </ul>

but value , onchange not supported ul , a. there way create ul works select attributes?

thank you! , sorry bad english!

updated reply 2015

as question still visited , due requests in comments, i've revisit code. can still find original reply below.

html

<button class="language_selector">choose language</button> <ul class="languages"> <li><a href="/en">english</a></li> <li><a href="/de">deutsch</a></li> </ul> <article> <h1>more content</h1> </article>

javascript

var trigger = $('.language_selector'); var list = $('.languages'); trigger.click(function() { trigger.toggleclass('active'); list.slidetoggle(200); }); // optional close list while new page loading list.click(function() { trigger.click(); });

css

.language_selector { width: 200px; background: #222; color: #eee; line-height: 25px; font-size: 14px; padding: 0 10px; cursor: pointer; } .languages { display: none; position: absolute; margin: 0; background: #dddddd; } .languages > li { width: 200px; background: #eee; line-height: 25px; font-size: 14px; padding: 0 10px; cursor: pointer; } .languages > li:hover { background: #aaa; }

demo

try before buy

original reply 2013

i this:

class="snippet-code-js lang-js prettyprint-override">var nav = $('#nav'); var selection = $('.select'); var select = selection.find('li'); nav.click(function(event) { if (nav.hasclass('active')) { nav.removeclass('active'); selection.stop().slideup(200); } else { nav.addclass('active'); selection.stop().slidedown(200); } event.preventdefault(); }); select.click(function(event) { // updated code select current language select.removeclass('active'); $(this).addclass('active'); alert ("location.href = 'index.php?lang=" + $(this).attr('data-value')); }); class="snippet-code-css lang-css prettyprint-override">h2 { width: 200px; background: #222; color: #eee; line-height: 25px; font-size: 14px; padding: 0 10px; cursor: pointer; } ol.select { display: none; } ol.select > li { width: 200px; background: #eee; line-height: 25px; font-size: 14px; padding: 0 10px; cursor: pointer; } ol.select > li:hover { background: #aaa; } class="snippet-code-html lang-html prettyprint-override"><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <h2 id="nav">choose language</h2> <ol class="select"> <li data-value="en">english</li> <li data-value="de">deutsch</li> </ol>

this 1 adds class the selected element. works, if remain on page after select , don't utilize location.href.

javascript jquery html drop-down-menu language-switching

bash - how i grep for certain log lines -



bash - how i grep for certain log lines -

i have next logs (removed unnecessary info) :

feb 18 11:38:54 kingston dhcpd: dhcpack feb 18 11:39:01 duxbury /usr/sbin/cron[27892]: feb 18 17:39:01 ruby /usr/sbin/cron[13080]:

how can grep server name (kingston, ruby or duxbury) while ensuring date/time info next server name? instance grep kingston, , homecoming "feb 18 11:38:54 kingston dhcpd: dhcpack" if "some info kingston" (no date/time info) available, nil returned. help!

grep -e "^[a-za-z]+ [0-9]+ [0-9]+:[0-9]+:[0-9]+ kingston"

bash grep debian rsyslog

c++ - Creating and Loading DialogBox from DLL -



c++ - Creating and Loading DialogBox from DLL -

i've created dialog box within win32 dll (using resource editor) , want show application programme (using dll) calls displaydialog, not working.

// appprogram.cpp ... lresult callback wndproc(hwnd hwnd, uint msg, wparam wparam, lparam lparam) { switch (msg) { case wm_command: switch (loword (wparam)) { case idm_file_new_dialog: displaydialog (hinst, hwnd); break; ... } break; .... } homecoming defwindowproc(hwnd, msg, wparam, lparam); }

my dll appears like

#include "stdafx.h" #include "mydll.h" export bool callback displaydialog (hinstance hinst, hwnd hwnd) { dialogbox (hinst, makeintresource (idd_dialog1), hwnd, reinterpret_cast<dlgproc> (diagproc)); // messagebox works here } ...

i've tested dll displays dialog if dialog belongs appprogram. here, want display dialog when part of dll.

please suggest whether should create dialog within dll or should pass program. + how show dialog in given scenario. in advance.

something this:

hmodule module = loadlibrary("mydll.dll"); hrsrc res = findresource(module, "#1234", rt_dialog); dlgtemplate* ptemplate = (dlgtemplate*)loadresource(module, res); dialogboxindirect(0, ptemplate, hwnd, dlgproc);

c++ winapi dll

ajax - Avoiding 'async: false' in JQuery validation -



ajax - Avoiding 'async: false' in JQuery validation -

i've written jquery validation method checking custom field. check info phone call server-side script using ajax, in turn, returns true or false. if false, response contain error message:

var errormessage; var rterrormessage = function() { homecoming errormessage; } jquery.validator.addmethod('customvalidation', function(value, element) { var valid = true; var url = '/validation?data=' + value; $.ajax({ url: url, type: 'get', datatype: 'json', async: false, success: function(responsedata) { if (responsedata && !responsedata.isvalid) { errormessage = responsedata.errormessage; valid = false; } } }); homecoming valid; }, rterrormessage);

this works, turning of synchronicity means browser freezes during request. rather annoying , jquery recommend against it... alternative?

thanks in advance.

use remote method of jquery validate - if homecoming true or false default error message , the field marked valid/invalid.

if homecoming other string "this error message" error message displayed string return.

if docs otherwise out of date using jquery validate 1.10.0

jquery ajax jquery-validate

c# - Where are CLR-defined methods like [delegate].BeginInvoke documented? -



c# - Where are CLR-defined methods like [delegate].BeginInvoke documented? -

[edit, rephrased:] seems question poorly worded indeed, , poorly received too. hope finish rephrasing helps...

msdn tells specifies: control.begininvoke() executes delegate on thread control's handle created on, gui thread. , dispatcher.begininvoke() run on thread dispatcher object created. thread created me.

but delegates "the clr automatically defines begininvoke , endinvoke" , these calls run on threadpool-thread instead. apart surprising different behaviour wonder how can find specs of functions automatically implemented.

for example: intelli-sense shows delegate has dynamicinvoke(). class system.delegate{} have dynamicinvoke() might imply delegate inherits it. delegate{} has no begininvoke(). , delegate{} has several functions delegate has not. delegate gets getobjectdata() method. , seems come iserializable.

so in conclusion, delegate appears gets methods (1) clr "automatically", (2) subset of delegate{} perchance multicastdelegate{}, , perchance (3) iserializble. where can find comprehensive specification of methods delegate gets? interesting begininvoke(), , it's exact signature, 2 aforementioned methods name have different sets of signatures.

[someone suggested in edit "delegate" "delegate". daresay, not.]

thanks

the control.begin/end/invoke() , dispatcher.begin/end/invoke() methods have identical names , similar behavior delegate's begin/end/invoke() methods best scrap thought same. of import difference delegate's methods type-safe, that's missing command , dispatcher versions. runtime behavior different well.

the rules rule delegate spelled out in detail in cli spec, ecma 335, chapter ii.14.6. best read chapter, i'll give synopsis.

a delegate declaration transformed class inherits multicastdelegate (not delegate specified in cli spec). class has 4 members, runtime implementation provided clr:

a constructor takes object , intptr. object delegate.target, intptr address of target method, delegate.method. these members used later when invoke delegate, target property supplies this reference if method delegate bound instance method, null static method. method property determines method gets invoked. don't specify these arguments directly, compiler supplies them when utilize new operator or subscribe event handler += operator. lots of syntax sugar in case of events, don't have utilize new operator explicitly.

an invoke() method. arguments of method dynamically generated , match delegate declaration. calling invoke() method runs delegate target method on same thread, synchronous call. utilize in c#, utilize syntax sugar allows delegate object invoked using object name, followed parentheses.

a begininvoke() method, provides way create asynchronous call. method completes while target method busy executing, similar threadpool.queueuserworkitem type-safe arguments. homecoming type system.iasyncresult, used find out when asynchronous phone call completed , supplied endinvoke() method. first argument optional system.asynccallback delegate object, it's target automatically called when asynchronous phone call complete. sec argument optional object, passed as-is callback, useful maintain track of state. additional arguments dynamically generated , match delegate declaration.

an endinvoke() method. takes single argument of type iasyncresult, must pass 1 got begininvoke(). completes asynchronous phone call , releases resources.

any additional methods see on delegate object ones inherited base of operations classes, multicastdelegate , delegate. dynamicinvoke() , getobjectdata().

asynchronous calls tricky ones , need utilize them. in fact not available in silverlight. delegate target method runs on arbitrary thread-pool thread. unhandled exception might throw captured , terminates thread not program. must phone call endinvoke(), not doing cause resource leak 10 minutes. if target method threw exception re-raised when phone call endinvoke(). have no command on thread-pool thread, there no way cancel or abort it. task or thread classes improve alternatives.

msdn relevant, methods of delegate type not documented. assumes know , specification , delegate declaration.

c# documentation msdn begininvoke

Php get records converbaet to two dimensional array -



Php get records converbaet to two dimensional array -

i record database convert 2 dimensional array.

example: $data = array( 1 => array ('name', 'surname','sex','address','web'), array('schwarz', 'oliver','m','kp','222.dddd'), array('test', 'peter','f','kk','wwww.fsadfs') );

how can format info database illustration above ?

here example, using pdo , in-memory sqlite database created within paste itself; having create database in-line makes script bit more verbose strictly necessary.

php arrays multidimensional-array

python - A program to convert multiple files to .wav -



python - A program to convert multiple files to .wav -

i'm looking create programme convert .ftm files .wav. .ftm proprietary format used video game music tracker programme called famitracker. programme utilize creates .ftm files has built-in .wav export feature, problem can 1 @ time. create programme convert multiple .ftm files in selected folder .wav consecutively. have on 3,000 files convert, , manually doing whole process take forever. i'm looking forwards learning this, not quite sure start.

any help appreciated, lot!

ps: it's worth, have python installed on computer. reasonable environment create such programme with?

i utilize windows 7 system.

if .ftm file dosnt have wacked encoding, maybe seek pymedia module in python, see if can convert them....

http://pymedia.org/

python converter wav

html - JavaScript form validation: Why does the first work but the second doesn't? -



html - JavaScript form validation: Why does the first work but the second doesn't? -

i have next form:

<form action="next.html" id="userinput" method="post" onsubmit="return validate();"> age: <input type="text" name="age" id="age"/> function validate() { var age = document.getelementbyid("age").value; if(age > 100 || age < 0) { alert("age must within 0 , 100"); homecoming false; } else { homecoming true; } }

this works normal. if come in number in age textbox great 100, show error message , remain @ current form page.

however, if utilize variable errormessage next show alert box, doesn't work. go next page without poping alert error message.

function validate() { var age = document.getelementbyid("age").value; var errormessage=""; if(age > 100 || age < 0) { errormessage = "age must within 0 , 100"; } if( errormessage !== "" ) alert(errormessage); homecoming false; } else { homecoming true; } }

so why first work sec doesn't?

i see missing left brace after condition. code should be:

if( errormessage !== "" ){ alert(errormessage); homecoming false; } else { homecoming true; }

javascript html forms html-form

WCF consume by dotnet winfom client and config entry -



WCF consume by dotnet winfom client and config entry -

i new in wcf bit familiar web service (asmx file)

i have couple of question on wcf client config entry

when create web service (asmx) proxy nil add together in config file below entry in case of wcf below entry adds. need know important of below entry.

1) if delete these below entry happen....can't phone call service client side?

2) tell me when phone call web service client side how endpoint address service utilize phone call service if there more 1 endpoint address added in client side ?

3) how explicitly mention web service url cient side when create service call?

<system.servicemodel> <bindings> <wsdualhttpbinding> <binding name="wsdualhttpbinding_icommservice" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:00:05" bypassproxyonlocal="false" transactionflow="false" hostnamecomparisonmode="strongwildcard" maxbufferpoolsize="524288" maxreceivedmessagesize="65536" messageencoding="text" textencoding="utf-8" usedefaultwebproxy="true"> <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384" /> <reliablesession ordered="true" inactivitytimeout="00:10:00" /> <security mode="message"> <message clientcredentialtype="windows" negotiateservicecredential="true" algorithmsuite="default" /> </security> </binding> </wsdualhttpbinding> </bindings> <client> <endpoint address="http://localhost/commservice/" binding="wsdualhttpbinding" bindingconfiguration="wsdualhttpbinding_icommservice" contract="services.icommservice" name="wsdualhttpbinding_icommservice"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> </system.servicemodel>

yes these of import configuration required wcf. either provide through config file or code.

1) need provide where. if take them fro config . should doing in code.

2) wcf has basic rule of abc . address , binding , contract. 1 time again don't have if in config file.

for multiple clients . can mention endpoint name config file. forexample

myclient someclientobject = new myclient("wsdualhttpbinding_icommservice");

3) default, when add together service reference operation, wcf runtime gets client side proxy .

you can in simple way. parameterless.

mysvcclient svcproxy = new mysvcclient ();

you need have entry service contract . can utilize follows constructor ... using endpoint adddress , bidning etc.

basichttpbinding mybinding= new basichttpbinding(securitymode.none); endpointaddress endpointadd= new endpointaddress("http://localhost/commservice/"); mysvcclient svcproxy = new mysvcclient (mybinding, endpointadd);

since defining in code here. don't need in config file.

wcf

ios - UILabel height inside UITableViewCell -



ios - UILabel height inside UITableViewCell -

i'm trying create tableview height of cells dynamic.

so far manage set height of cells depending on custom uilabel i've added inside.

with regular cell.textlabel works fine, when utilize own label goes wrong. see half label, when scroll , down, label extends , shows text... can see label should end in image.

image

this text within cellforrowatindexpath:

static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } // configure cell. auto *carforcell = [cars objectatindex:indexpath.row]; uilabel *namelabel = [[uilabel alloc] init]; namelabel = (uilabel *)[cell viewwithtag:100]; namelabel.numberoflines = 0; namelabel.text = carforcell.directions; [namelabel sizetofit]; [namelabel setbackgroundcolor:[uicolor greencolor]]; homecoming cell;

unless have typos in code posted, don't seem adding label cell @ all. seem creating new label every time, , replacing contents of namelabel pointer cell's view (which nil).

try doing first , see how looks:

static nsstring *cellidentifier = @"cell"; uilabel *namelabel; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; namelabel = [[uilabel alloc] init]; namelabel.tag = 100; namelabel.numberoflines = 0; [namelabel setbackgroundcolor:[uicolor greencolor]]; [cell.contentview addsubview:namelabel]; } else { namelabel = (uilabel *)[cell viewwithtag:100]; } // configure cell. auto *carforcell = [cars objectatindex:indexpath.row]; namelabel.text = carforcell.directions; [namelabel sizetofit]; homecoming cell;

you need tell tableview size each cell needs using tableview:heightforrowatindexpath: delegate method. mean getting relevant car object 1 time again , calculating height using sizewithfont:sizewithfont:forwidth:linebreakmode:

ios objective-c xcode uitableview

Tree menu using PHP and XML -



Tree menu using PHP and XML -

i trying create tree menu using php , xml.

<market> <weapons> <class title="bagi warrior" div="bagi"> <weapon name="gauntlet" div="gauntlet"> </weapon> </class> <class title="segita hunter" div="hunter"> <weapon name="bow" div="bow"> </weapon> <weapon name="crossbow" div="xbow"> </weapon> <weapon name="dagger" div="dagger"> </weapon> </class> <class title="incar magician" div="mage"> <weapon name="wand" div="wand"> </weapon> <weapon name="staff" div="staff"> </weapon> </class> <class title="azure knight" div="ak"> <weapon name="1h axe" div="1ha"> </weapon> <weapon name="2h axe" div="2ha"> </weapon> <weapon name="1h mace" div="1hm"> </weapon> <weapon name="2h mace" div="1hm"> </weapon> <weapon name="1h sword" div="1hs"> </weapon> <weapon name="2h sword" div="1hs"> </weapon> <weapon name="shield" div="shield"> </weapon> </class> <class title="vicious summoner" div="summy"> <weapon name="twin blades" div="tb"> </weapon> <weapon name="staff" div="staff"> </weapon> </class> <class title="segnale" div="seg"> <weapon name="whip" div="whip"> </weapon> </class> <class title="aloken" div="alo"> <weapon name="spear" div="spear"> </weapon> </class> <class title="seguriper" div="ripper"> <weapon name="scythe" div="scythe"> </weapon> </class> <class title="concerra summoner" div="concerra"> <weapon name="duel blades" div="db"> </weapon> <weapon name="staff" div="staff"> </weapon> </class> <class title="black wizard" div="wizard"> <weapon name="orb" div="orb"> </weapon> </class> <class title="half bagi" div="hb"> <weapon name="great falchion" div="gf"> </weapon> <weapon name="katar" div="katar"> </weapon> </class> </weapons> </market>

and php trying use:

<?php $xml = simplexml_load_file('market.xml'); ?> <ul> <?php foreach ($xml->weapons->class $classes) { $class = $classes["title"]; $div = $classes["div"]; ?> <li><a onclick="document.getelementbyid('<?=$div ?>').style.display=(document.getelementbyid('<?=$div ?>').style.display =='none')?'':'none'"><?=$class?></a></li> <div id="<?=$div ?>" class="tree" style="display:none"> <ul> <?php foreach ($xml->weapons->$classes->weapon $cl_weapon) { $weapon = $cl_weapon["name"]; $weap_div = $cl_weapon["div"]; ?> <li><a onclick="document.getelementbyid('<?=$weapon ?>').style.display=(document.getelementbyid('<?=$weapon ?>').style.display =='none')?'':'none'"><?=$weapon ?></a></li> <li> <div id="<?=$weap_div ?>" style="display:none"> <ul> <?php foreach ($xml->weapons->$classes->$cl_weapon->item $item) { $name = $item->name; $level = $item->level; echo "<li><a name='".$name."' level='".$level."'>".$name." (".$level.")</a></li>"; } ?> </ul> </div> </li> <? } ?> </ul> </div> <? } ?> </ul>

the expected outcome should be:

bagi warrior ->gauntlet --->item (not in xml yet) --->item segita hunter ->bow --->item (not in xml yet) --->item ->crossbow --->item --->item

so far, giving me main items (bagi, hunter, etc) when click show children of item (gauntlets, bow, crossbow, etc), gives me error: warning: invalid argument supplied foreach() in test.php on line 14.

i know has $classes in

foreach ($xml->weapons->$classes->weapon $cl_weapon) {`

i cant think of way children in section though (if makes sense).

i got it. needed start $classes , move on there. right coding:

<?php $xml = simplexml_load_file('market.xml'); ?> <ul> <?php foreach ($xml->weapons->class $classes) { $class = $classes["title"]; $div = $classes["div"]; ?> <li><a onclick="document.getelementbyid('<?=$div ?>').style.display=(document.getelementbyid('<?=$div ?>').style.display =='none')?'':'none'"><?=$class?></a></li> <div id="<?=$div ?>" class="tree" style="display:none"> <ul> <?php foreach ($classes->weapon $cl_weapon) { $weapon = $cl_weapon["name"]; $weap_div = $cl_weapon["div"]; ?> <li><a onclick="document.getelementbyid('<?=$weapon ?>').style.display=(document.getelementbyid('<?=$weapon ?>').style.display =='none')?'':'none'"><?=$weapon ?></a></li> <li> <div id="<?=$weap_div ?>" style="display:none"> <ul> <?php foreach ($cl_weapon->item $item) { $name = $item->name; $level = $item->level; echo "<li><a name='".$name."' level='".$level."'>".$name." (".$level.")</a></li>"; } ?> </ul> </div> </li> <? } ?> </ul> </div> <? } ?> </ul>

php xml

.net - Bind the foreground color of a TextBlock to local variable -



.net - Bind the foreground color of a TextBlock to local variable -

i want bind foreground color of textblock local variable. if variable has no value (=null) foreground color should black, if variable not null, foreground color should black or whatever. ist possible solve via binding?

you can utilize value converter first define converter this

[valueconversion (typeof(object), typeof(solidcolorbrush))] public class objecttobrushconverter : ivalueconverter { public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { if (value == null) homecoming new solidcolorbrush(colors.black); homecoming new solidcolorbrush(colors.red); } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { throw new notimplementedexception(); } }

then in xaml file define converter resource

<window.resources> <local:objecttobrushconverter x:key="objecttobrushconverter"/> </window.resources>

then bind property , provide converter

<textbox name="textb" text="hello" foreground="{binding path=myobject, converter={staticresource resourcekey=objecttobrushconverter}}">

check out msdn on value converter http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx

of course of study assuming defined variable public property , of type object in example

.net wpf binding

android - Moving imageview with touch event -



android - Moving imageview with touch event -

i want simple thing hava imageview , can move touch

this code, im sorry if wrong because seek myself

img.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view arg0, motionevent arg1) { // todo auto-generated method stub if(arg1.getaction()==motionevent.action_down) { status=startdrag; } else if(arg1.getaction()==motionevent.action_up) { status=stopdrag; } homecoming false; } }); @override public boolean ontouchevent(motionevent event) { // todo auto-generated method stub if( status==startdrag) { params.leftmargin = (int)event.getx(); params.topmargin = (int)event.gety(); img.setlayoutparams(params); } homecoming super.ontouchevent(event);

}

can u show me right way please? :d

ontouch events dragging views works perfect kid views of relativelayout , framelayout.

here example:

@override public boolean ontouch(view v, motionevent event){ switch(event.getaction()) { case motionevent.action_down : { x = event.getx(); y = event.gety(); dx = x-myview.getx(); dy = y-myview.gety(); } break; case motionevent.action_move : { myview.setx(event.getx()-dx); myview.sety(event.gety()-dy); } break; case motionevent.action_up : { //your stuff } homecoming true; }

now dx , dy is, on action_down records have touched on view, , gets difference left (x) , top (y) of view, maintain margins during action_move.

return of touch event has true if attending it.

update : api 8

in case of api 8, getx() , gety() methods not giving right results, can utilize getrawx() , getrawy() methods.

example :

relativelayout.layoutparams parms; linearlayout.layoutparams par; float dx=0,dy=0,x=0,y=0; @override public boolean ontouch(view v, motionevent event) { switch(event.getaction()) { case motionevent.action_down : { parms = (layoutparams) myview.getlayoutparams(); par = (linearlayout.layoutparams) getwindow().findviewbyid(window.id_android_content).getlayoutparams(); dx = event.getrawx() - parms.leftmargin; dy = event.getrawy() - parms.topmargin; } break; case motionevent.action_move : { x = event.getrawx(); y = event.getrawy(); parms.leftmargin = (int) (x-dx); parms.topmargin = (int) (y - dy); myview.setlayoutparams(parms); } break; case motionevent.action_up : { } break; } homecoming true; }

android layout touch imageview

vb.net - dynamically creating buttons in code in vb2010 -



vb.net - dynamically creating buttons in code in vb2010 -

i'm working in vb2010 , think can create button array in code; however, i'm struggling refer created buttons individually code click events work @ runtime.

any help appreciated. i'm new vb programmimg go easy on me!!

give try:

' many buttons want dim numbuttons integer = 5 dim buttonarray(numbuttons) button dim integer = 0 each b button in buttonarray b = new button addhandler b.click, addressof me.buttonsclick b.tag = "b" & ' can set things button text in here. += 1 next private sub buttonsclick(sender object, e system.eventargs) ' sender button has been clicked. can ' you'd it, including cast button. dim currbutton button = ctype (sender, button) select case currbutton.tag case "b0": ' first button in array. things! case "b1": ' sec button in array. things! case "b2": ' notice pattern? '... end select end sub

vb.net button addhandler

c# - can form Contain another form in winforms application? -



c# - can form Contain another form in winforms application? -

i want create 1 form contain form ; sake of browsing different sub-forms in same parent form using parent controls .

you can utilize tabcontrol grouping different controls together, if need have subform, can utilize mdi forms.

this tabcontrol:

it has groupbox each individual tab, can add together , remove please.

from docs tabcontrol:

a tabcontrol contains tab pages, represented tabpage objects add together through tabpages property. order of tab pages in collection reflects order tabs appear in control. user can alter current tabpage clicking 1 of tabs in control.

and mdi:

multiple-document interface (mdi) applications allow display multiple documents @ same time, each document displayed in own window. mdi applications have window menu item submenus switching between windows or documents.

c# winforms forms

c++ - Qt ActiveX dynamicCall: bad parameter count -



c++ - Qt ActiveX dynamicCall: bad parameter count -

i trying utilize activex command in program.

qaxwidget* max = new qaxwidget(); max->setcontrol("{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}");

i know there function:

put_channeltype(long newvalue)

but when seek execute it:

max->dynamiccall("put_channeltype(long)",2); max->dynamiccall("put_channeltype(int)",2); max->dynamiccall("put_channeltype(long)",qvariant(2)); max->dynamiccall("put_channeltype(int)",qvariant(2));

i get:

qaxbase: error calling idispatch fellow member put_channeltype: bad parameter count

any thought going wrong ?

edit:

weird thing if call

max->dynamiccall("put_channeltype()");

i not error message...

edit 2:

this fails (as constantin suggested)

qlist<qvariant> varlist; varlist << (int)1; max->dynamiccall("put_channeltype(int)",varlist);

got solved using generatedocumentation() function.

i using activex command in application, mfc one.

it seems function names referring (which in machine generated idispatch wrapper class created vs) not same ones qt listed.

i.e. put_channeltype setchanneltype...

maybe version issue ?

anyways, of import part knowing generatedocumentation() can list functions can phone call dynamiccall.

c++ qt activex

php - How to pass values via href to new popup window -



php - How to pass values via href to new popup window -

i want have variable want pass parent page popup window.

trying below not getting required output on popup window.

parent page:

<a href=cancellation_policy.php?d=",urlencode($vendor_id)," onclick="window.open('cancellation_policy.php','newwindow', 'width=700, height=450'); homecoming false; "><?php echo "<h10>(cancellation policy)</h10>";}?></a>

on popup window:

<?php echo $vendor_id = $_get['$d']; ?>

during javascript phone call popub, utilize cancellation_policy.php without parameters. echo $vendor_id = $_get['$d']; not echo anything. called parameter in url 'd' , not '$d'.

you either have possibility add together them javascript call:

window.open('cancellation_policy.php?d=[...]'...

or having javascript function uses href attribute of tag build finish url , utilize window.open(...). first thought faster solution.

edit: improve explanation: window.open method not utilize href attribute of a-element. there configured parameter 'd' not used here.

php popup href

cross domain - jQuery ajax call not working in IE -



cross domain - jQuery ajax call not working in IE -

i'm trying json remote server using jquery's ajax-function.

var self = $(this); $.ajax({ cache: false, url: *external url*, data: {param: self.val()}, type: 'get', datatype: 'application/json', crossdomain: true, success: function(data, status) { console.log(status); console.log(data); } });

this works fine in chrome, info gets output. in firefox, request sent, no info written console. in ie, phone call not seem sent @ all.

what doing wrong? know cross-domain-blocking, puts me off works in chrome not in other browser.

thanks in advance!

i know cross-domain-blocking, puts me off works in chrome not in other browser.

it sounds server you're requesting info supports cors, maintain in mind different browsers may send different headers along requests, , cors requests fail if browser sends header server doesn't okay. it's exclusively possible chrome sending headers server has approved, , request works, firefox sending header server doesn't approve, , request doesn't work.

unless you're using ie10, ie isn't working because cross-domain requests don't work in ie unless utilize xdomainrequest object instead of xmlhttprequest object, , jquery doesn't that. there patches create that, jquery library not. ie10 finally enables cors via standard xmlhttprequest object.

jquery cross-domain

javascript - CKEDITOR 4.0 detach toolbar dynamically -



javascript - CKEDITOR 4.0 detach toolbar dynamically -

i trying figure out how create ckeditor instance toolbar attached seperate div div creating instance on. see in config array can set config.sharedspaces = { top: 'divid' } (at to the lowest degree in older versions could), can't on config page, needs done on page creating instances on. know how this?

here how creating instance:

ckeditor.replace( 'editor', { toolbargroups: [ { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, { name: 'colors' }, { name: 'styles'}, { name: 'paragraph', groups: [ 'list', 'align' ], items: [ 'numberedlist', 'bulletedlist', '-', 'outdent', 'indent', '-', 'blockquote' ] }, { items: [ 'image', 'table', 'horizontalrule', 'specialchar' ] }, { name: 'links' }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] }, { name: 'tools'} ] });

yes know can utilize clone() , not hoping more clean solution.

for ckeditor 4.1+ can utilize optional shared space plugin (needs added ckeditor build).

<div id="top"> <!-- div handle toolbars. --> </div> <div> <textarea id="editor1" name="editor1">my editor content</textarea> </div> <script> ckeditor.replace( 'editor1', { // configure ckeditor utilize shared space plugin. extraplugins: 'sharedspace', // resize plugin not create sense in context. removeplugins: 'resize', sharedspaces: { // configure editor instance place toolbar in div id='top'. top: 'top' } } ); </script>

see "shared toolbar , bottom bar" documentation code examples , working demo source code re-create & download.

javascript jquery ckeditor toolbar

android - multiple dates are selected on calendar view htc 4.1 -



android - multiple dates are selected on calendar view htc 4.1 -

i have problem calendar view . while alright in 2.3.3 phone , in htc 4.1 can select multiple days in calendar. have searched , not find useful , came here hope may encounter issue before , know how solve multiple selection ?

android calendar multipleselection calendarview

sql - MySQL : How to join another table with the same table but different condition -



sql - MySQL : How to join another table with the same table but different condition -

i want display school pupil graduated from. have table of school name , table of pupil profile. here's code:

school_db

shc_id shc_title 1 school 2 school b 3 school c 4 school d 5 school e

student_db

stu_id stu_school1 stu_school2 stu_school3 1 1 2 2 2 1 2 4 3 2 2 4

so write:

select school_db.sch_title school school_db inner bring together student_db on student_db.stu_school1=school_db.shc_id inner bring together student_db on student_db.stu_school2=school_db.shc_id inner bring together student_db on student_db.stu_school3=school_db.shc_id student_db.stu_id='1'

but failed right result. guys please suggest how utilize proper bring together in case.

i expect result like:

stu_id stu_school1 stu_school2 stu_school3 1 school school b school b 2 school school b school d 3 school b school b school d

regards,

you should joining table school_db thrice on table student_db can values each column on table student_db.

one more thing, should unique define alias on table school_db server can identify tables , columns has been joined.

select a.stu_id, b.shc_title sc1, c.shc_title sc2, d.shc_title sc3 student_db inner bring together school_db b on a.stu_school1 = b.shc_id inner bring together school_db c on a.stu_school2 = c.shc_id inner bring together school_db d on a.stu_school3 = d.shc_id a.stu_id = '1' sqlfiddle demo

to farther gain more knowledge joins, kindly visit link below:

visual representation of sql joins

mysql sql table inner-join

c++ - How to use templates with OpenCL? -



c++ - How to use templates with OpenCL? -

according this document page 6 (released amd) (and topics ?), there ways utilize templates opencl. however, first document reports done using options clbuildprogramwithsource doesn't seem exist... anyway, assuming clbuildprogram rather previous one, attempted utilize called "-x" alternative "clc++", still, not recognized :

warning: ignoring build option: "-x"

in fact, according documentation stemming khronos, alternative not available! document may deprecated somehow, there other ways utilize templates within opencl code?

the -x alternative available on latest amd opencl runtimes back upwards opencl 1.2 , static c++ language extension. won't find word in official khronos docs because amd initiative, and, ultimately, vendor extension.

i assume have right runtime, kernel needs built these options:

-x clc++

if able build kernels classes using this, should able utilize templates.

if doesn't work, means either runtime installation botched, e.g. you're using wrong compiler somehow, or means not have right runtime. if so, please give platform info.

i've messed static c++ extension while ago , can testify -x clc++ work.

also beware using extension render code not portable , locked in amd-compliant devices, unlikely other vendors introduce exact same extension (if ever).

also, note on khronos docs - ones returned google typically opencl 1.0 versions can irritating. recommend downloading 1.1 or 1.2 standard getting local re-create of relevant html documentation quick access, if utilize opencl lot. helps.

c++ templates opencl

javascript - Click event on DIV button -



javascript - Click event on DIV button -

i have div element using javascript button. works fine unless click on area, click event not triggered @ all. seems issue in chrome.

html

<div class="button">close</div>

javascript

$('.button').on('click', function(e) { var currentdate = new date(); $debug.html('clicked: ' + currentdate.getminutes() + ':' + currentdate.getseconds() + ':' + currentdate.getmilliseconds()); });

http://jsfiddle.net/cellenburg/uwgk4/

clicking anywhere on button works fine unless click text begins on left. in case of fiddle, click on left side of letter "c". you'll see event doesn't fire. although little area, seems click every time.

i have tried everything. i'm guessing it's problem text node accepting click , it's not propagating it's parent? ideas how might work around issue?

the problem appears "attempt" select text.

add css:

body { -moz-user-select: -moz-none; -webkit-user-select: none; }

fiddle update worked in chrome me:

http://jsfiddle.net/uwgk4/1/

also thought. can alter body ever prevent "button" text beingness selectable.

updated:

tell me if can break this! haven't been able too. basicly removed padding, declared hieght , width, wrapped close in <div> class called .label , set margins.

http://jsfiddle.net/uwgk4/5/

new js:

.label{ margin: 5px; }

new html:

<div class="button"><div class="label">close</div></div>

removed padding css .button , .button:active.

javascript jquery css

ios - Why my code crash only in release and after upgrade to Xcode 4.6? -



ios - Why my code crash only in release and after upgrade to Xcode 4.6? -

i got crash due deallocating of variable holds reference block beingness executed. here code example:

this wrong in release, in debug on same device runs ok, must run add-hoc crash.

- (void)test { _test = [self dolater:^{ _count++; [self test]; } :3]; }

this defined in nsobject category:

- (dolaterprocess *)dolater:(void (^)())method :(double)delay { homecoming [[dolaterprocess new] from:method :delay]; }

end implementation of used class:

@implementation dolaterprocess { id _method; bool _stop; } - (void)methodtoperform:(void (^)())methodtoinvoke { if (_stop)return; if (nsthread.ismainthread) methodtoinvoke(); else [self performselectoronmainthread:@selector(methodtoperform:) withobject:methodtoinvoke waituntildone:no]; } - (dolaterprocess *)from:(void (^)())method:(nstimeinterval)delay { [self performselector:@selector(methodtoperform:) withobject:method afterdelay:delay]; _method = method; homecoming self; } - (void)stop { _stop = yes; [nsobject cancelpreviousperformrequestswithtarget:self selector:@selector(methodtoperform:) object:_method]; } @end

so understand _test variable deallocated , block while in deallocated? why crashes? why doesn't crash in debug, can forcefulness somehow compiler crash on in debug? give thanks you.

blocks capture local state. in case block capturing _count , self. in order efficiently, when create block lives on stack, effect safe used long method doesn't return. can pass blocks downward can't maintain them or pass them upward without moving them heap. accomplish copying them (and copy defined deed retain if block on heap, don't pay over-copying).

in case, right thing dolater:: re-create block (though, record, unnamed parameters considered extremely poor practice).

i'm bit confused why both assign method instance variable , schedule later pass forward, quickest prepare be:

- (dolaterprocess *)from:(void (^)())method:(nstimeinterval)delay { method = [method copy]; [self performselector:@selector(methodtoperform:) withobject:method afterdelay:delay]; _method = method; homecoming self; }

as why appears have become broken under 4.6: relying on undocumented behaviour (albeit undocumented behaviour feels should natural) alter in toolset or os (or indeed, no alter whatsoever) permitted impact that.

(aside: seem reimplementing lot of built gcd; straight replace from:: dispatch_after , methodtoperform: dispatch_async, in both cases supplying dispatch_get_main_queue() queue).

ios objective-c xcode4.6

c# - Can't change sql server file database size -



c# - Can't change sql server file database size -

this question has reply here:

how utilize variable database name in t-sql? 4 answers

i can't alter database file size c# query. reason exception: "incorrect syntax near '@databasename'.

this code executed query:

command = connection.createcommand(); command.commandtext = @" alter database @databasename modify file (name = @databasefile, size = @newsize) "; dbparam = command.createparameter(); dbparam.parametername = "databasefile"; dbparam.value = dbfilename; command.parameters.add(dbparam); dbparam = command.createparameter(); dbparam.parametername = "newsize"; dbparam.value = newsize; command.parameters.add(dbparam); dbparam = command.createparameter(); dbparam.parametername = "databasename"; dbparam.value = databasename; command.parameters.add(dbparam); command.executenonquery();

now there might several problems. firstly database on different machine wouldn't db file path different?

some things cannot parameterized. includes things table , column names in dml, includes most of ddl. not expecting, , cannot process, parameters in scenario.

to check this; run in ssms, declaring variables ahead of time , giving them values. find error message same. if doesn't work in ssms unlikely work ado.net.

c# sql-server

Is there a "Rails Way" include a jQuery plugin in the Asset Pipeline? -



Is there a "Rails Way" include a jQuery plugin in the Asset Pipeline? -

many jquery plugins have next directory structures:

/<plugin name> ../css ../images ../js

the css files have relative links images in them. want include these plugins in rails way under asset pipeline, , doesn't involve having renamed file references remove relative links. there such rails way?

could it's overkill include already-minified jquery plugin in asset pipeline?

you should seek add together assets load path recommended way, far know. if application you're running has assets-pipeline activated, should find assets after expanding path in application.rb

config.assets.paths << rails.root.join("plugins/plugin_name/assets/")

not shure, if asked if not, should check: http://guides.rubyonrails.org/asset_pipeline.html#asset-organization

remeber restart server

ruby-on-rails-3 jquery-plugins ruby-on-rails-3.2 asset-pipeline

spring - what is the "default applicationContext" in Jersey? -



spring - what is the "default applicationContext" in Jersey? -

i using bailiwick of jersey perform acceptance tests on restful web services. appears though applicationcontext.xml not beingness loaded when client loads. see next log output:

info: using default applicationcontext

is "default" file soemthing bailiwick of jersey loads when cannot find file? or indicate file found?

@contextconfiguration(locations={"/applicationcontext.xml", "/applicationcontexttest.xml"}) public class baseresourcetest extends jerseytest { final static uri baseuri = uribuilder.fromuri( "http://localhost" ).port( 9998 ).build(); public baseresourcetest() throws exception { super(new webappdescriptor.builder("xxx.yyy.zzz").contextpath(baseuri.getpath()) .contextparam( springservlet.context_config_location, "classpath:applicationcontexttest.xml" ) .servletclass(springservlet.class ) .contextlistenerclass( contextloaderlistener.class ) .build()); } ....... tests ....... }

my web.xml:

<context-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:applicationcontext.xml</param-value> </context-param> <listener> <listener-class>xxx.yyy.loggingassurancelistener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <servlet> <servlet-name>jersey-servlet</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.springservlet</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>xxx.yyy.zzzz</param-value> </init-param> <init-param> <param-name>com.sun.jersey.api.json.pojomappingfeature</param-name> <param-value>true</param-value> </init-param> <init-param> <param-name>com.sun.jersey.config.property.wadlgeneratorconfig</param-name> <param-value>xxx.yyy.zzz.broadsoftwadlgeneratorconfig</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>jersey-servlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping>

spring jersey

python - Scrapy crawl from script always blocks script execution after scraping -



python - Scrapy crawl from script always blocks script execution after scraping -

i next guide http://doc.scrapy.org/en/0.16/topics/practices.html#run-scrapy-from-a-script run scrapy script. here part of script:

crawler = crawler(settings(settings)) crawler.configure() spider = crawler.spiders.create(spider_name) crawler.crawl(spider) crawler.start() log.start() reactor.run() print "it can't printed out!"

it works @ should: visits pages, scrape needed info , stores output json told it(via feed_uri). when spider finishing work(i can see number in output json) execution of script wouldn't resume. isn't scrapy problem. , reply should somewhere in twisted's reactor. how release thread execution?

you need stop reactor when spider finishes. can accomplish listening spider_closed signal:

from twisted.internet import reactor scrapy import log, signals scrapy.crawler import crawler scrapy.settings import settings scrapy.xlib.pydispatch import dispatcher testspiders.spiders.followall import followallspider def stop_reactor(): reactor.stop() dispatcher.connect(stop_reactor, signal=signals.spider_closed) spider = followallspider(domain='scrapinghub.com') crawler = crawler(settings()) crawler.configure() crawler.crawl(spider) crawler.start() log.start() log.msg('running reactor...') reactor.run() # script block here until spider closed log.msg('reactor stopped.')

and command line log output might like:

stav@maia:/srv/scrapy/testspiders$ ./api 2013-02-10 14:49:38-0600 [scrapy] info: running reactor... 2013-02-10 14:49:47-0600 [followall] info: closing spider (finished) 2013-02-10 14:49:47-0600 [followall] info: dumping scrapy stats: {'downloader/request_bytes': 23934,...} 2013-02-10 14:49:47-0600 [followall] info: spider closed (finished) 2013-02-10 14:49:47-0600 [scrapy] info: reactor stopped. stav@maia:/srv/scrapy/testspiders$

python twisted scrapy

c# - Returning specific values with Jquery-Ajax request -



c# - Returning specific values with Jquery-Ajax request -

i working on webform knockout.js. @ 1 point, value based on selected value in select list. have next code within viewmodel:

self.discoveryforms = ko.observablearray([]); self.selectedtemplate = ko.observable(); self.selecteddiscoveryform = ko.observable(); //behaviors self.selectedtemplate.subscribe(function (newvalue) { console.log(newvalue.discoveryformid()); self.getdiscoveryforms(newvalue.discoveryformid()); }); self.getdiscoveryforms = function (discoveryformid) { console.log(discoveryformid); $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", data: "{id: '" + discoveryformid + "'}", url: ("default.aspx/getdiscoveryforms"), datatype: "json", success: function (response) { self.finddiscoveryforms(response), console.log(response)} }); } self.finddiscoveryforms = function (response) { ko.mapping.fromjs(response.d, null, viewmodel.discoveryforms); ko.applybindings(viewmodel); }

the c# gets info entity this:

[webmethod] public static list<discoveryform> getdiscoveryforms(){ list<discoveryform> discoveryforms = new list<discoveryform>(); using (intranetcontainer db = new intranetcontainer()) { discoveryforms = db.discoveryforms.select(x => new discoveryform() { id = x.id, name = x.name, welcome = x.welcome, welcomenote = x.welcomenote, welcomeback = x.welcomeback, welcomebacknote = x.welcomebacknote }).tolist(); } homecoming discoveryforms; } public class discoveryform { public long id { get; set; } public string name { get; set; } public string welcome { get; set; } public string welcomenote { get; set; } public string welcomeback { get; set; } public string welcomebacknote { get; set; } }

the problem while want ajax request homecoming discovery forms id selected selectedtemplate, presently returns of values array. thought data: "{id: '" + discoveryformid + "'}", that. can explain me why , how prepare it? should doing on c# side? i'm new javascript, ajax, , knockout.js.

to right problem, query had like:

data: "{'id':"+discoveryformid + "}",

and c# method changed according reply below.

your service must like

public static list<discoveryform> getdiscoveryforms(int[] ids){

and parameter must used query.

right don't have narrow set.

c# ajax jquery data-binding knockout.js

php - post message on facebook wall not working -



php - post message on facebook wall not working -

i want post message on facebook wall our site. first getting error

uncaught oauthexception: (#200), when trying post on wall

now not getting error code not working.

$facebook = new facebook(array( 'appid' => app_id, 'secret' => app_secret, 'cookie' => true, 'req_perms' => 'email,read_stream,read_friendlists,publish_stream,offline_access,manage_pages', )); $user = $facebook->getuser(); $token = $facebook->getaccesstoken(); if ($user) { seek { $user_profile = $facebook->api('/me'); } grab (facebookapiexception $e) { error_log($e); $user = null; } } if (!empty($user_profile )) { $username = $user_profile['name']; $uid = $user_profile['id']; seek { $post=$facebook->api("/".$uid."/feed", "post", array( 'access_token' => $token, 'message' => 'test', )); } grab (facebookapiexception $e) { error_log($e); $user = null; } }

but no message coming do? there problem while creating application?

here's wild guess, since our comment q&a wasn't going work well.

if authorize app set of permissions, , subsequently alter permissions app requests (at app admin page), existing authorization not update include new permissions. app still function, actions require new permissions fail.

you can test if causing error removing app personal business relationship app settings page, , re-approving app new permissions. if problem vanishes, congratulations. if not, you'll need more detective work. code appears fine.

php facebook-graph-api

c# - Serializing a dynamic property to JSON -



c# - Serializing a dynamic property to JSON -

i have web api project hydrates object defined next json. attempting insert object ravendb database, finding dynamic property 'content' not beingness serialized (note empty arrays).

i have tried several serializers produce json strins: system.helpers.json.encode(), system.web.script.serialization.javascriptserializer. both suffers same problem.

ravenjobject.fromobject(obj) suffers same problem.

is there way accomplish aim in spite of apparent limitation in clr reflection?

public class sampletype { public guid? id { get; private set; } public dynamic content { get; set; } public string message { get; set; } public string actor { get; set; } public logentry() { id = guid.newguid(); } } json submitted api: { "content": { "somenumber": 5, "adate": "/date(1360640329155)/", "maybeaboolean": true, "emptyguid": "00000000-0000-0000-0000-000000000000" }, "message": "hey there", "actor": "john dow" } hydrated object: id: {b75d9134-2fd9-4c89-90f7-a814fa2f244d} content: { "somenumber": 5, "adate": "2013-02-12t04:37:44.029z", "maybeaboolean": true, "emptyguid": "00000000-0000-0000-0000-000000000000" } message: "hey there", actor: "john dow" json 3 methods: { "id": "b75d9134-2fd9-4c89-90f7-a814fa2f244d", "content": [ [ [] ], [ [] ], [ [] ], [ [] ] ], "message": "hey there", "actor": "john dow" }

your dynamic object has implement getdynamicfieldnames() method dynamic serialization work.

c# json serialization ravendb square-bracket

javascript - Extend the time duration in my jquery popup window -



javascript - Extend the time duration in my jquery popup window -

i have jquery pop plugin, when submit form close automatically. need set time limit pop window.

html:

<div class='popbox'> <a class='open' href='#'> <img src='plus.png' style='width:14px;position:relative;'> click here! </a> <div class='collapse'> <div class='box'> <div class='arrow'></div> <div class='arrow-border'></div> <form action="" method="post" id="subform"> <div class="input"> <input type="text" name="cm-name" id="name" placeholder="name" /> </div> <div class="input"> <input type="text" name="cm-nklki-nklki" id="nklki-nklki" placeholder="email" /> </div> <div class="input"> <textarea name="cm-f-tlhll" id="message" placeholder="comments"></textarea> </div> <input type="submit" value="get in touch" /> <a href="#" class="close">cancel</a> <input type="button" name="closebutton" id="closebutton" value="closebutton" > </form> </div> </div>

jquery:

(function () { $.fn.popbox = function (options) { var settings = $.extend({ selector: this.selector, open: '.open', box: '.box', arrow: '.arrow', arrow_border: '.arrow-border', close: '.close' }, options); var methods = { open: function (event) { event.preventdefault(); var pop = $(this); var box = $(this).parent().find(settings['box']); if (box.css('display') == 'block') { methods.delay(1500).close(); } else { box.css({ 'display': 'block', 'top': 10, 'left': ((pop.parent().width() / 2) - box.width() / 2) }); } }, close: function () { $(settings['box']).fadeout("fast"); } }; $(document).bind('keyup', function (event) { if (event.keycode == 27) { methods.delay(1500).close(); } }); homecoming this.each(function () { //$(this).css({'width': $(settings['box']).width()}); // width needs set otherwise popbox not move when window resized. $(settings['open'], this).bind('click', methods.open); $(settings['open'], this).parent().find(settings['close']).bind('click', function (event) { event.preventdefault(); methods.close(); }); }); } }).call(this);

increase delay(1500) higher value. 1500 in milliseconds, means current popup close in 1.5 seconds.

javascript jquery

c# 4.0 - get current process name with file extension in c# -



c# 4.0 - get current process name with file extension in c# -

getallproccess function homecoming runing proccesses in windows. want current proccess name extension ".avi", ".mkv", ".mpg", ".mp4", ".wmv" e.g. if play video file in windows media player homecoming (wmplayer.exe) or if play video file in km player returns(kmplayer.exe) here code code working slow reference http://vmccontroller.codeplex.com/sourcecontrol/changeset/view/47386#195318

string filename; process[] procs = process.getprocesses() ; foreach (process prc in procs) {

if (procs.length > 0) { int id = prc.id; ienumerator<filesysteminfo> fie = detectopenfiles.getopenfilesenumerator(id); while (fie.movenext()) { if (fie.current.extension.tolower(cultureinfo.invariantculture) == ".mp3") { filename = fie.current.fullname; break; // todo: might not correct. : exit while } } } }

you start taking @ handle mark russinovich. run administrator , homecoming files used processes.

you utilize next syntax set results text file:

handle.exe > log.txt

afterwards, may utilize powershell extract info processes using info files:

get-content log.txt | where{$_.readcount -gt 6} | foreach{ if($_.substring(0,1) -ne " " -and $_.substring(0,1) -ne "-") {$process = $_.tostring()} elseif($_.tolower() -like "*.avi" ` -or $_.tolower() -like "*.mkv" ` -or $_.tolower() -like "*.mpg" ` -or $_.tolower() -like "*.mp4" ` -or $_.tolower() -like "*.wmv" ` ) {$process.tostring()} }

here's same approach c# (you need run application administrator):

class programme { static void main(string[] args) { var processes = getprocesses(); // enumerate processes foreach (tuple<int,string> mediafile in processes.distinct()) { var process = process.getprocesses().where(i => i.id == mediafile.item1).firstordefault(); console.writeline("{0} ({1}) uses {2}", process.processname, process.id, mediafile.item2); } console.readline(); } private static list<tuple<int,string>> getprocesses() { string line = ""; int counter = 0; string currentprocess = ""; list<tuple<int, string>> mediafiles = new list<tuple<int, string>>(); process compiler = new process(); compiler.startinfo.filename = @"c:\yourpath\handle.exe"; compiler.startinfo.createnowindow = true; compiler.startinfo.useshellexecute = false; compiler.startinfo.redirectstandardoutput = true; compiler.start(); while ((line = compiler.standardoutput.readline()) != null) { // skipping applicaion info if (++counter > 6) { if (!" -".contains(char.parse(line.substring(0, 1)))) { currentprocess = line; } else if ((new[] { ".avi", ".mkv", ".mpg", ".mp4", ".wmv" }) .contains(line.tolower().substring(line.length - 4))) { int pos = currentprocess.indexof("pid:") + 5; string pid = currentprocess.substring(pos, currentprocess.indexof(" ", pos) - pos); mediafiles.add(new tuple<int, string>(int32.parse(pid),line.substring(21))); } } } compiler.waitforexit(); homecoming mediafiles; } }

c# c#-4.0

wpfdatagrid - Why are there strange backspace characters in my WPF datagrid? -



wpfdatagrid - Why are there strange backspace characters in my WPF datagrid? -

our software uses datagrid throughout user interface displaying editable lists. while editing metadata, wanted remove text in particular column many rows. pretty quick if beat of f2-backspace-enter, f2-backspace-enter, f2-backspace-enter….

things don’t go quite if miss f2 part of pattern , press backspace-enter on cell. wpf datagrid replace contents of cell backspace character. depending on how @ string, might show 0×08, , \u0008, or \b.

what on earth?

this codeplex post confirms bug in datagrid , includes workarounds. on our end, current prepare ignore strings have backspace character in them. way don’t end in xml, because in xml 1.0 backspace illegal character.

see microsoft connect issue.

wpf wpfdatagrid

android - Dynamic VideoView Height Based on Parent Width -



android - Dynamic VideoView Height Based on Parent Width -

i'm trying size videoview parent container width , set height maintain 4:3 aspect ratio. i've seen answers recommend extending videoview class , overriding onmeasure, don't understand parameters i'm getting or how utilize them:

package com.example; import android.content.context; import android.util.attributeset; import android.util.log; import android.widget.videoview; public class myvideoview extends videoview { public myvideoview(context context) { super(context); } public myvideoview (context context, attributeset attrs) { super(context, attrs); } public myvideoview (context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } @override protected void onmeasure (int widthmeasurespec, int heightmeasurespec) { log.i("myvideoview", "width="+widthmeasurespec); log.i("myvideoview", "height="+heightmeasurespec); super.onmeasure(widthmeasurespec, heightmeasurespec); } }

result (on nexus 7 tablet):

02-13 21:33:42.515: i/myvideoview(12667): width=1073742463 02-13 21:33:42.515: i/myvideoview(12667): height=1073742303

i'm trying accomplish next layout:

tablet (portrait):

videoview width - total or total screen. videoview height - maintain 4:3 aspect ratio given width listview - appears below videoview select video play.

tablet (landscape):

listview - appears on left of screen, used select video play. videoview - appears on right of screen , should fill remaining width , set height maintain 4:3 aspect ratio.

try this:

@override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) { int width = getdefaultsize(mvideowidth, widthmeasurespec); int height = getdefaultsize(mvideoheight, heightmeasurespec); /**adjust according desired ratio*/ if (mvideowidth > 0 && mvideoheight > 0) { if (mvideowidth * height > width * mvideoheight) { // log.i("@@@", "image tall, correcting"); height = (width * mvideoheight / mvideowidth); } else if (mvideowidth * height < width * mvideoheight) { // log.i("@@@", "image wide, correcting"); width = (height * mvideowidth / mvideoheight); } else { // log.i("@@@", "aspect ratio correct: " + // width+"/"+height+"="+ // mvideowidth+"/"+mvideoheight); } } setmeasureddimension(width, height); }

where mvideowidth , mvideoheight current dimension of video. hope helps. :)

android android-layout android-widget

asp.net mvc - File upload for jqGrid in MVC architecture -



asp.net mvc - File upload for jqGrid in MVC architecture -

can 1 point me demo of file upload in jqgrid using mvc architecture. had been looking posts file upload, of posts php.

this colmodel had added

[ colmodel: [{ name: 'expensedate', index: 'expensedate', align: "center", sorttype: "date" }, { name: 'customerproject', index: 'customerproject', align: "center", sorttype: "string" }, { name: 'accounttype', index: 'accounttype', align: "center"}, { name: 'expensedetails', index: 'expensedetails', align: "left" }, { name: 'expenseamount', index: 'expenseamount', align: "right" }, { name: 'reimbursibleexpense', index: 'reimbursibleexpense', align: "center" }, { name: 'billableexpense', index: 'billableexpense', align: "center" }, **{ name: 'receipt', index: 'receipt', align: 'left', editable: true, edittype: 'file' , editoptions: { enctype: "multipart/form-data" } , align: 'center', search: false, width: 500} },** { name: 'clas', index: 'clas', editable: true, hidden: true, editrules: { edithidden: true } }, { name: 'merchant', index: 'merchant', editable: true, hidden: true, editrules: { edithidden: true } }, { name: 'id', index: 'id', editable: true, hidden: true, editrules: { edithidden: true } }, { name: 'expid', index: 'expid', editable: true, hidden: true, editrules: { edithidden: true } }

but not getting how post image after selected. 1 time click on browse popup select file. after file selected can physical path beingness displayed in input tag. how post image controller?

asp.net-mvc file-upload jqgrid

Python says: "IndexError: string index out of range." -



Python says: "IndexError: string index out of range." -

i making practice code game similar board game, mastermind-- , keeps coming out error, , can't figure out why it's doin it. here's code:

def guess_almost (guess, answer): = ''.join([str(v) v in answer]) g = str(guess) n = 0 = 0 while n < 5: if g[n] == a[0]: = + 1 if g[n] == a[2]: = + 1 if g[n] == a[3]: = + 1 if g[n] == a[3]: = + 1 n = n + 1 return(am)

okay, guess specified 4 integers, , reply list containing 4 numbers. both have same 'len' after code, don't have clue.

the point of code turn reply string of 4 numbers, , see if of numbers match thoise of guess, , homecoming how many total matches there are.

see if helps

def guess_almost (guess, answer): = ''.join([str(v) v in answer]) g = str(guess) n = 0 = 0 if len(g) >= 5 , len(a) >=4: while n < 5: if g[n] == a[0]: = + 1 if g[n] == a[2]: = + 1 if g[n] == a[3]: = + 1 if g[n] == a[3]: = + 1 n = n + 1 return(am)

python python-3.3

javascript - Combining Google Directions and Google Places -



javascript - Combining Google Directions and Google Places -

i seek create search bar on site, utilize 2 google apis.

basing on google api documentation i've written code.

function calcroute() { //setting variables google places api request var start = 'starting point'; var end = 'destination point'; var service; var moscow = new google.maps.latlng(55.749646,37.62368); var places = []; var request1 = { location: moscow, radius: '50000', query: start }; var request2 = { location: moscow, radius: '50000', query: end }; //setting variables google directions api var directionsdisplay; var directionsservice = new google.maps.directionsservice(); //executing google places request service = new google.maps.places.placesservice(); service.textsearch(request1, callback1); service.textsearch(request2, callback2); function callback1(results, status) { if (status == google.maps.places.placesservicestatus.ok) { places[0] = results[0].formatted_address; } else { document.getelementbyid("directionspanel").innerhtml = "<br/><b>sorry, directions not found.</b><br/><br/>"; return; } } function callback2(results, status) { if (status == google.maps.places.placesservicestatus.ok) { places[1] = results[1].formatted_address; //executing google directions request var request = { origin:places[0], destination:places[1], travelmode: google.maps.directionstravelmode.driving }; directionsservice.route(request, function(response, status) { if (status == google.maps.directionsstatus.ok) { var myoptions = { zoom: 8, streetviewcontrol: false, maptypeid: google.maps.maptypeid.roadmap }; directionsdisplay = new google.maps.directionsrenderer(); map = new google.maps.map(document.getelementbyid("map_canvas2"), myoptions); directionsdisplay.setmap(map); directionsdisplay.setdirections(response); directionsdisplay.setpanel(document.getelementbyid("directionspanel")); } else { document.getelementbyid("directionspanel").innerhtml = "<br/><b>sorry, directions not found.</b><br/><br/>"; }; }); //end of google directions request } else { document.getelementbyid("directionspanel").innerhtml = "<br/><b>sorry, directions not found.</b><br/><br/>"; return; } } //closing calcroute() function }

here's html

<html> <head> <link href="../images/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places"></script> <script src="../scripts/map.js" type="text/javascript"></script> </head> <body onload="calcroute();"> <form name="joe"> <input type="hidden" name="burns" /> </form> <div id="external"> <div id="wrap"> <div id="header" align="center"><img src="../images/illustrations/header.gif" alt="air moscow" /> </div> <div style="background:#ccdbe3; margin:0px 5px; float:left; width:736px; margin-bottom:10px;"> <div style="background:#fff; margin:15px; border:1px #999 solid;"> <div id="directionspanel"></div> <div style="float:right; width:370px; height:600px; border:2px solid #306b8e; margin:30px 10px 0px 10px;" id="map_canvas2"> </div> <div style="clear:both; margin-bottom:50px;"></div> </div> </div> </div> <div id="footer"> </div> </div> </body> </html>

when test it, chrome js console throws "uncaught typeerror: cannot read property 'innerhtml' of undefined". however, both 2 divs defined , there no typo errors in id's.

i think need api key google places work.

besides that, there else need code work properly?

this works me. think has way initializing things:

<script> var map; var places = []; var service; var bounds = new google.maps.latlngbounds(); var directionsdisplay; var directionsservice = new google.maps.directionsservice(); var moscow = new google.maps.latlng(55.749646,37.62368); var start = 'kremlin'; var end = 'hotel peter'; var request1 = { location: moscow, radius: '50000', query: start }; var request2 = { location: moscow, radius: '50000', query: end }; function initialize() { directionsdisplay = new google.maps.directionsrenderer(); var myoptions = { center: moscow, zoom: 15, streetviewcontrol: false, maptypeid: google.maps.maptypeid.roadmap }; map = new google.maps.map(document.getelementbyid("map_canvas"), myoptions); directionsdisplay.setmap(map); service = new google.maps.places.placesservice(map); directionsservice = new google.maps.directionsservice(); directionsdisplay.setmap(map); calcroute(); } function calcroute() { //executing google places request service.textsearch(request1, callback1); } function callback1(results, status) { if (status == google.maps.places.placesservicestatus.ok) { places[0] = results[0].geometry.location; map.setcenter(places[0]); var marker1= new google.maps.marker({position: places[0], map:map}); bounds.extend(places[0]); service.textsearch(request2, callback2); } else { document.getelementbyid("directionspanel").innerhtml = "<br/><b>sorry, directions not found.</b><br/>"+start+"<br/>"; return; } } function callback2(results, status) { if (status == google.maps.places.placesservicestatus.ok) { places[1] = results[0].geometry.location; bounds.extend(places[1]); map.fitbounds(bounds); var marker2= new google.maps.marker({position: places[0], map:map}); //executing google directions request var request = { origin:places[0], destination:places[1], travelmode: google.maps.directionstravelmode.driving }; directionsservice.route(request, function(response, status) { if (status == google.maps.directionsstatus.ok) { directionsdisplay = new google.maps.directionsrenderer(); directionsdisplay.setmap(map); directionsdisplay.setpanel(document.getelementbyid("directionspanel")); directionsdisplay.setdirections(response); } else { document.getelementbyid("directionspanel").innerhtml = "<br/><b>sorry, directions not found.</b><br/><br/>"; }; }); //end of google directions request } else { document.getelementbyid("directionspanel").innerhtml = "<br/><b>sorry, directions not found.</b><br/>"+end+"<br/>"; return; } } google.maps.event.adddomlistener(window,'load',initialize); </script>

working example

javascript google-maps-api-3

java - Filling in a blank space in relation to surrounding pixels -



java - Filling in a blank space in relation to surrounding pixels -

i working on programme preforms techniques such image segmentation along few others. have task ahead of me of filling segmented area (this blank area) based on surrounding pixels.

this lot photoshop likes phone call content aware fill, me beingness 1 person wondering best way approach type task. how should start think getting something, not technical , robust, similar in sense work.

i not aware of classes may help help on appreciated.

you after inpainting. there many ways it, , inpainting survey bertalmío, caselles, masnou, sapiro - 2011, presents lots of results , references them.

around here find sample results using technique, instance @ http://stackoverflow.com/a/13666082/1832154 see 1 http://www.cc.gatech.edu/~sooraj/inpainting/ gives finish implementation. @ http://stackoverflow.com/a/14295915/1832154 can see sample result, simplistic reference different inpainting method.

java image-processing coordinates bufferedimage