Posts

Showing posts from February, 2011

gnu make - how Makefiles work exactly -

i'm writing code gtk application written in c, , have questions it. # compiler cc = gcc cflags = -wall -g -o rm = rm -f # additional header path gtkinc = `pkg-config --cflags gtk+-3.0` gtklib = `pkg-config --libs gtk+-3.0` inc = $(gtkinc) liblnk = $(gtklib) # sources, objects, executable srcs = hello.c objs = $(srcs:.c = .o) exec = hello .phony: clean all: $(exec) @echo compile complete $(exec): $(objs) $(cc) $(inc) $(cflags) $(exec) $(objs) $(liblnk) clean: $(rm) *.o *~ $(exec) previously, when wrote makefiles,i added lines each object files for example blah blah a.o: 1.h a.c b.c $(cc) blah blah blah blah and then, got little lazy , tried make more easy-to-modify file googling up, , product above code. 1. same thing did previously?(like in example) found out code compiles properly, i'm not sure if checks out-of-date object files.(which whole meaning of 'make') 2. have to use 'depend' on header files in order chec

Search for Youtube videos by town -

i'm using youtube api v3 , want search video city of origin. in documentation filter , covers how see videos specific country. how can narrow search? currently, filtering town not supported, hope have soon.

java - How the buffer byte array is continuously filling while streaming? -

the below piece of code using reading files int bytesread; byte[] bytes = new byte[1000]; //buffer fileinputstream fis = new fileinputstream(uploadedfile); while ((bytesread = fis.read(bytes)) != -1) { fis.read(bytes, 0, bytesread); } fis.close(); as per api of read() method reads b.length bytes of data input stream array of bytes. method blocks until input available. there no specified refills bytes array,but stream filling array until file read. . but how internally it's maintaining magic done ?? i saw source code or read method public int more ...read(byte b[]) throws ioexception { 214 return readbytes(b, 0, b.length); 215 } and readbytes 's source code 200 private native int more ...readbytes (byte b[], int off, int len) throws ioexception; there noting mentioned how bytes .. i uploaded 500mb file without problem,with allocation 1000 bytes array . if you're asking

c++ - how to read cmyk tiff image pixels and store it in separate buffers? -

i can read , load data fine bitmap image, not sure how can read data multiple channels. understand, read image header information , store entire image data (width*samplesperpixel) 1 large buffer, how divide buffer , load respective c,m,y,k data separate buffers? help? thanks.

jQuery: Limit the scope of a jQuery selector to avoid selecting other selectors that are not children -

i have made content shield (i.e. tabs) jquery. , works perfectly. i know want put second 1 on page , wrap them both within larger content shield. however, when click links of first 1 starts effecting second one. this overview of html <div class="taptabs pages"> <nav class="content-follower tapnav ui-ticklist cr-nav"> [ul navigation switch between content shield 1 & 2] </nav> <div class="taptabs page"> <nav class="content-follower tapnav ui-ticklist cr-nav"> [ul tabs content sheild 1] </ul> </nav> <div class="pages"> <div class="page"> content sheild 1 - section </div> <div class="page"> content sheild 1 - section b </div> </div> </div> <div class="taptabs page"> <nav class="content-follower tapnav ui-ticklist cr-nav">

how to get initial parameters during updating a form in Django with TemplateView -

i have following class based templateview, want templateview updateview.but not sure set form instance parameters. try in get_context_data didn't work. ideas ? class profileupdateview(generic.templateview): template_name = "profile/update_profile.html" def dispatch(self, *args, **kwargs): if self.request.user.is_authenticated(): return super(profileupdateview, self).dispatch(*args, **kwargs) else: return httpresponseredirect('/profiles/login') def get_context_data(self, *args, **kwargs): context = {} try: profile.objects.get(user__id=self.request.user.id) user = profile.objects.get(user__id=self.request.user.id) context['profile_form'] = profile_form(data=request.post, instance=user) except: context['profile_form'] = profileform(data=self.request.post) context['profile'] = profile.objects.filter(u

java - Checking equals for JAXB object considering some of the fields -

my autogenerated jaxb class public class employee { private int id; private string name; private string department; /* getters , setters */ } employee emp1 = new employee(); emp1.setid(1); emp1.setname("a"); emp1.setdepartment("d1"); employee emp2 = new employee(); emp2.setid(2); emp2.setname("b"); emp2.setdepartment("d1"); list<employee> emplist1 = new arraylist<employee>(); emplist1.add(emp1); emplist2.add(emp2); employee emp3 = new employee(); emp2.setid(3); emp2.setname("a"); emp2.setdepartment("d1"); list<employee> emplist2 = new arraylist<employee>(); emplist2.add(emp3); i want compare both list emplist1 , emplist2 , result list matches name , department fields of employee object. basically, need intersection of 2 list based on custom comparison of fields in 2 objects. i looking @ google guava , lambdaj not able find solution/sample doing intersection custom com

r - Creating a custom Stat object in ggplot2 -

i'd create custom stat object ggplot2. (specifically i'd create smoother works differently ones stat_smooth allows- instance, without y~x modeling function- there other custom stats i'd create if there workaround specific case). i found this suggested solution hadley wickham : statexpo <- proto(stat, { objname <- "expo" desc <- "exponential smoothing" default_geom <- function(.) geomline calculate_groups <- function(., data, scales, variable="x", ...) { data$y <- holtwinters(data$x, ...) } }) stat_expo <- statexpo$new however, when try get: error in proto(stat, { : object 'stat' not found upon looking around ggplot code , found where stat defined . however, stat object is, far can tell, never exported ggplot2 . i write new stat object within ggplot2/r folder , reinstall package, cumbersome , make solution difficult share others. how can create custom stat object outside of ggplot n

Dependency error with excel interop dll in .NET app -

i running .net app on local machine uses microsoft excel interop library. has been working until today when removed library , added project. until few weeks ago had been using trial version of excel application work , working after trial had expired. afraid since trial expired , removed library project , put in causing error. correct here? should re-installing excel fix problem? here error when try run application: parser error message: not load file or assembly 'microsoft.office.interop.excel, version=14.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040) and logs: === pre-bind state information === log: user = aaron-pc\aaron log: displayname = microsoft.office.interop.excel, version=14.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35 (fully-specified) log: appbase = file:///c:/users/aaron/documents/visual studio 2012/websites/

actionscript 3 - How to switch to another column when exporting to csv -

i need export data ms excel. laod data bytearray , print file. nevertheless wasn't able find out, how switch next column. tried '\t', "\t", char(9) , many others, in excel file unknown character symbol ... "\n" works fine... i'm programming app in as3, if have connection.. csv stands "comma separated values". default delimiter columns comma ( , ). also, can designate character want use column delimiter (tabs, example), when importing excel

Linux Mint 15 - Recieving DKPG error 127 when modifying packages -

*after operation, 44.1 mb of additional disk space used. want continue [y/n]? y extracting templates packages: 100% setting install-info (4.13a.dfsg.1-10ubuntu4) ... /etc/environment: line 5: java_home: command not found dpkg: error processing install-info (--configure): subprocess installed post-installation script returned error exit status 127 errors encountered while processing: install-info e: sub-process /usr/bin/dpkg returned error code (1)* this error running whenever try modify packages, in case trying install lxde. environment file looks : *path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" java_home=/usr/lib/jvm/jdk1.7.0_25/ to give more context, dkpg error began happening after went through long , arduous process setting android studio. feel solution simple, have been searching while , haven't been able resolve issue. appreciated, thank in advance export java_home before executing command expo

html - SVG : I need an SVG file that reads 'TEST' and auto-expands 100% -

this file have. <svg width="700" height="500"> <g id="layer1"> <text style="font-size:100%;font-family:bitstream vera sans" x="6" y="37" id="">test</text> </g> </svg> i want test automatically occupy whole thing somehow. 100% kind of thing. right text miss-alligned due x , y ordinates. try setting viewbox instead of specific width , height: <svg viewbox="0 0 240 70"> <g id="layer1"> <text style="font-size:100px;font-family:bitstream vera sans" x="0" y="70" id="">test</text> </g> </svg> note chrome has rendering inconsistencies svg no specific height .

resources - Visual Studio 2012 (C++) - Use included .png file -

i encountering yet problem directx 9 & c++. have been working on 2d games using lpd3dxsprite , lpdirect3dtexture9. can load in textures, when comes distributing finished game, need distribute resources (which can edited, deleted or something, not convenient). know possible import "resource file" visual studio, when refer using d3dxcreatetexturefromfile() not load it. have no idea how this. if possible, in advance. i'm not sure it's idea store game assets in windows resource file. if want try it: method 1. d3dxcreatetexturefromresource() , d3dxcreatetexturefromresourceex() functions looks want. use case: // suppose have resource `idb_sprite1` in resource file linked in current executable // , initialized g_pd3ddevice lpdirect3dtexture9 sprite1_texture = 0; hresult hr = d3dxcreatetexturefromresource( g_pd3ddevice, getmodulehandle(null), makeintresource( sprite1 ), &sprite1_texture ); if(failed(hr)) {

sql - Types don't match between the anchor and the recursive part in column of recursive query -

given category @categoryid , query should recursively navigate top super-category, has been accomplished. now i'd generate along string concatenation of categoryname in process. declare @categoryid int = 217; categories ( select parentcategoryid, categoryname, '' strcategory category categoryid = @categoryid union select c.parentcategoryid, c.categoryname, (c.categoryname + ': ' + cts.strcategory) strcategory category c join categories cts on c.categoryid = cts.parentcategoryid ) select top 1 categoryname, len(categoryname) strlength categories order strlength desc with above code i'm getting following error: types don't match between anchor , recursive part in column "strcategory" of recursive query "categories". thanks helping try changing query cast varchars varchar(max). something like declare @categoryid int = 217; categories ( select parentcategoryid, categoryname,

Forcing Jquery Mobile to reload in Rails app -

i working on mobile site uses rails , jquery mobile. problem have button when triggered suppose go link. link starts controller generates data shown in page , saved in database. problem works first time around , when try doing again, jqm loads cached data , uses ajax, page never reloaded again.. button: <div data-role="button" data-ajax="false"><%= link_to "get basket",basket_path%> you should place data-role="button" , data-ajax="false" inside anchor tag, this: <a href="..." data-role="button" data-ajax="false">...</a>

objective c - Resize a view when another is hidden -

i have 2 views on iphone screen, 1 above other (mediacontrols above devicewebview). when hide top view want bottom view take entire screen, , when reveal top view want bottom view resize again below top view. seems simple having trouble it. i've tried hiding view adjusting layout constraints show below. heres code: -(void)hidevideobuttons{ self.mediacontrols.hidden = yes; [self.view removeconstraint:self.devicelayoutconstraint]; [self.devicewebview setneedsdisplay]; } -(void)showvideobuttons{ self.mediacontrols.hidden=no; self.devicelayoutconstraint = [nslayoutconstraint constraintwithitem:self.devicewebview attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:self.mediacontrols attribute:nslayoutattributebottom multiplier:1 constant:0]; [self.view addconstraint:self.devicelayoutconstraint]; have tried uiview animatewithduration: animations: method? can animate uiview(s) whatever location you'd like, can resize them, , m

Is it possible to force case-sensitivity in MATLAB for file operations like LOAD? -

matlab case-sensitive calling functions, on windows: >> edit untitled >> untitled cannot find exact (case-sensitive) match 'untitled' is there way enforce case sensitivity on windows other functions, load? >> = 3; >> save a >> load the problem code run fine on windows, error if send friend on unix. one way enforce case-sensitivity functions dealing files, regardless of platform running, write wrapper such functions. for example, in case of load , came following drop-in replacement: function varargout = myload(fname, varargin) % make sure filename ends mat extension [~,~,ext] = fileparts(fname); if isempty(ext), fname = [fname '.mat']; end % open file (searching entire matlab path) fid = fopen(fname,'r'); if fid < 0, error('file not found'); end % fullpath opened file, , close file handle filename = fopen(fid); fclose(fid); % extract filename [~,name,e

java - How do we know threadPoolExecutor has finished execution -

i have parent thread sends messages mq , manages threadpoolexecutor worker threads listen mq , writes message output file. manage threadpool of size 5. when run program, have 5 files messages. works fine until here. need merge these 5 files in parent thread. how know threadpoolexecutor finished processing can start merging files. public class parentthread { private messagesender messagesender; private messagereciever messagereciever; private queue jmsqueue; private queue jmsreplyqueue; executorservice exec = executors.newfixedthreadpool(5); public void sendmessages() { system.out.println("sending"); file xmlfile = new file("c:/filename.txt"); list<string> lines = null; try { lines = fileutils.readlines(xmlfile, null); } catch (ioexception e) { e.printstacktrace(); } (string line : lines){ messagesender.sendmessage(line, this.jmsqueue, th

How to change color of bar in column chart with different level of percentage in highcharts -

i want change color of bar column @ different percentage. suppose there 10 columns represented in column graph. out of 3 below 60% , 5 above 60% , 2 above 80%. columns below 60% should pick color green, column above 60% should pick color amber , above 80% should pick red. please me... <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>highcharts example</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> <script> $(function () { var chart; var input = [34.4, 62.5, 80.1, 70, 69.6, 69.5, 89.1, 68.4, 18, 17.3], data = [], categories = ['orcl1 ','orcl2 ','orcl3 ','orcl4 ','orcl5 ','orcl6 ','orcl7 ','orcl8 ','orcl9 ','orcl10 &

html - Struts tags substitution -

i wondering if replace struts tags html, when output data. projects in company still using struts tags seems it's not easy use compared html. of course can, long duplicate: whatever html emitted tag, and... ...whatever java logic tag implements. for example, custom form tags is: emit form elements (possibly embedded in other markup depending on s2 theme) set form element value action property display error messages relating form element (depending on s2 theme) some tags don't emit html of own, example, <s:iterator> loops on collection, pushes each object onto value stack, , processes tag body other jsp custom tag. should reproduce existing framework logic , write either: a lot more html, or... ...your own complete suite of custom tags? i doubt it, there valid usecases doing so–i can't think of them.

Using PHP and Javascript in onblur function -

so have form: <form enctype="multipart/form-data" action="cgi-bin/upload.cgi?upload_id=" method="post" onsubmit="return startupload(this);" target="xupload"> <table> <tr> <td class="first"><span class="right">upload file: </span></td> <td class="second"><input name="file_1" type="file" onchange="checkext(this.value)" accept=".mp4, .avi, .wmv, .mov, .camrec, .flv, .zip, .rar"></td> <td class="third"><span class="left">(required)</span></td> </tr> <tr></tr> <tr><center><h2>video information</h2></center></tr> <tr></tr> <tr> <td class="first"><span class="right">your name: </span></td>

asp.net mvc - Issue with paging when deleting object when using DeletObject (Entity Framework) -

i'm having issue paging when delete object using deleteobject method (entity framework). deletion works fine, supposed to, page number updated next page. mean, if i'm deleting record on page 3 of search results, after deletion completed, page number updated "page 4", though search results still correspond page 3! i have checked think of, can't figure out wrong. has had problem before? (i'm pretty new mvc, razor, etc). thank you! thanks reply, gert arnold , moeri; posted in hurry going meeting , didn't add enough details. as went grab code post here, found solution: function deleterecord(subscriptionid){ var url = "@url.content("~")pubsub/deletesubscriber/" + subscriptionid; if(confirm("are sure want delete record?")){ $.get(url, function (data) { if(data=="true") { $("#subscriptioncontainer"+subscriptionid).show(); $("#subscripti

php - Inserting large CSV with multiple SQL calls too slow -

at company, use program read csv files , insert data database. having trouble because needs able insert large amount of data ( 10,000 rows ) of time. @ first had looping through , inserting each record 1 @ time. slow because calls insert function 10,000 times... next tried group inserted 50 rows @ time concatenating sql call. have tried grouping sql calls 1,000 rows @ time, still slow. another thing have change data. client gives spreadsheet data such username , password, usernames same, change them adding number @ end. i.e. jodoe, jodoe1. case there no password or username, have generate one. reason bring read using load data infile reads file fast , puts table, need edit before going table. it time out after 120 seconds, , doesn't finished in time inserted 0's. need speed doesn't take long. not want change time limit because company thing. efficient way insert many rows of csv file database? load data infile can perform numerous preprocessing operations

Access Combobox selectedText in WPF Datagrid column header? -

Image
i have wpf datagrid pretty standard, except headers not text, combobox control. here screenshot demonstrate: goes without saying there multiple columns. columns created programatically. what traverse column headers, , selectedtext each combobox. how done? edit: the code expect writing along these lines: foreach (datagridcolumnheader columnheader in columnheaders) { var combobox = (combobox) columnheader.controls[0]; var thedroidiamlookingfor = combobox.text; } i don´t know how combobox in columnheader assume via columnheaderstyle, approach binding selectedvalueproperty property in codebehind or viewmodel <combobox x:name="headercombobox" itemssource="{binding path=headersource}"> <combobox.selectedvalue> <binding path="headerselectedvalue" mode="twoway" /> </combobox.selectedvalue> edit: c# solution (not tested) foreach (var column in mygrid.columns) { var colheader

c# - http url for local files asp.net -

i have treeview folder under application folder. provide links files in folder. folder might have sub folders , on. how can provide http urls in links. when physical location of file instead of http url. path.combine(file.directoryname, file.name) thanks. first root of application. var root = server.mappath("~"); now, need, iterate on files/directories. can combine paths so: foreach (var file in system.io.directory .getfiles(system.io.path.combine(root, "images"))) { // give relative url of each file. var fileurl = resolveurl(file.replace(root, string.empty).replace("\\", "/")); }

objective c - Two buttons, one click -

i have 2 buttons on top of each other in nib. need both of them pressed when tapped, top button carries out function. there way top button tell bottom button activate when top 1 gets pressed. not think can merge buttons 1 , use 1 -(ibaction)buttonname function because 1 button bigger other not need both activate when 1 of them pressed. thanks! is there way top button tell bottom button activate when top 1 gets pressed. not really, can have action top button call action bottom button. here's 1 way: - (ibaction)actiontop:(id)sender { nslog(@"the top button activated."); [self actionbottom:self]; } - (ibaction)actionbottom:(id)sender { nslog(@"the bottom button activated."); } another way use same action both, , figure out based on button triggered action: - (ibaction)action:(id)sender { // if top button tapped, part if (sender == self.topbutton) { nslog(@"the top button activated."); }

php - submit value of radio button with jquery with onClick event -

i have simple toggle button on page uses 2 radio inputs: foo: <input type='radio' name='foo' value='bar'> bar <br> <input type='radio' name='foo' value='fru'> fru is there short , easy way (preferably jquery) of asynchronously submitting value of foo each time clicked? the radio buttons above form elements on page. something maybe? <script> $(document).ready(function() { $("input:radio").change(function(){ $.post('ajaxscriptlocation.php', { "foo": $(this).val() }, function(data) { // whatever data result. }); }); }); </script>

android - Achartengine Line Graph -

Image
i'm using achartengine create line graph. current month showing second line, last month, isn't showing it. here's lass , logcat: can see logcat dates correct , count previous month. why not showing beyond me. log cat: 08-07 16:13:43.969: i/projectcaruso(11734): debug startdate: 2013-07-01 enddate: 2013-07-31 08-07 16:13:43.969: i/projectcaruso(11734): count: 9 08-07 16:13:43.979: i/projectcaruso(11734): debug startdate: 2013-08-01 enddate: 2013-08-31 class: public class temphistoryfragment extends fragment{ private graphicalview mchartview; simpledateformat format = new simpledateformat("yyyy-mm-dd"); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { if (container == null) { return null; } calendar cal = calendar.getins

html - padding or margin wrong or both -

i tried divs in html, , isn't problem. encountered problem , don't find mistake. the menu div supposed in center of header div , there should no margin @ top. here example error: http://jsfiddle.net/j83eb/ here html: <div id="header"> <div id="menu"> <ul> <li><a class="nav-element" href="#">news</a></li> <li><a class="nav-element" href="#">turnier</a></li> <li><a class="nav-element" href="#">ergebnisse</a></li> <li><a class="nav-element" href="#">impressionen</a></li> <li><a class="nav-element" href="#">anmeldung</a></li> <li><a class="nav-element" href="#">impressum

Merging PHP Arrays for JSON output -

i'm having difficult time trying single array, can return json. the model: class coveragelimit extends eloquent { protected $table = 'webapp_limit_tbl'; public static function index($code,$plan_type,$income_tier){ $data = coveragelimit::where('limitcode', $code) ->where('plantypecode', $plan_type) ->where('incometiercode', $income_tier) ->get(array('limitcode','limit_desc')); return print_r($data->toarray()); } } the controller: $limits = array(); foreach($pieces $coverage_limit) { $limits = array_merge($limits, coveragelimit::index($coverage_limit,$plan_type,$income_tier)); //this works suggestion below } return $limits; returns: array ( [0] => array ( [limitcode] => l0001 [limit_desc] => $1m per claim / $2m annual aggregate ) ) array ( [0] => array ( [limitc

delphi - Fast Report displaying incorrect data from ADOQuery -

i have problem fast report displaying incorrect data adoquery. use following sql.text select * job_data inner join customer on job_data.cust_code = customer.cust_code job_data.ship_date between [date1] , [date2] order ship_date fast report shows data ship_date = null. if throw tdbgrid , attach data source attached same adoquery, dbgrid shows correct information. i'm out of ideas, suggestions? to answer questions dates come from: var date1:string; date2:string; sql_str:string; begin date1:=inputbox('date range','enter beginning date',''); try strtodate(date1); except on econverterror begin messagedlg('please enter valid date. format xx/xx/xx', mterror, [mbok], 0); //showmessage('please enter valid date. format `enter code here`xx/xx/xx'); exit; end; end; date2:=inputbox('date range','enter ending date',''); try strtodate(date2); ex

javascript - I am trying to implement a form within a bootstrap popover but the alignment gets off? Help needed -

i trying implement form within bootstrap popover; cannot seem able align them both. form elements move out side popover ; solution should make popover adjust according size of form elements. please help. html: <br> <br> <br> <div class="popover-markup"><a href="#" class="trigger">popover link</a> <div class="head hide"> events </div> <div class="content hide"> <form class="form-horizontal"> <div class="control-group"> <label class="control-label" for="inputemail">email</label> <div class="controls"> <input type="text" id="inputemail" placeholder="email"> </div> </div>

TypeError: Cannot read property '#' of undefined In simple JavaScript Game -

i'm making small battleship game friend of mine. thought practice learned. have 2 dimensional array 10x10 filled zeros. change zeros ones in places our ships go. made function place 1x5 ship down. function prompts user 2 coordinates , assigns variables outside of function. gets coordinates of start point , asks direction player wants rest wrest of ship go. if there no obstacles ship should placed. if there function should restart. thing error. # replaced number in prompt asking vertical coordinate position. here error. typeerror: cannot read property '#' of undefined in battleship game here function function firstship(){ window.alert("we placing 1 5 length ship. take note playing on 10 10 board."); userx = parseint(prompt("horizontal coordinate position first unit of ship")-1); usery = parseint(prompt("vertical coordinate position first unit of ship")-1); direction = prompt("now choose direction want res

powershell - RegEx Match whole line with first occurrence from the bottom of the file, upwards -

i'm trying parse file error codes. first occurrence bottom of file returned. so far, i've got regex searching error code numbers, , returns whole line multiline option, returns lines in file, not last one. ^.*?\b(639|640|460|458|664|148)\b.*$ i'm using powershell, if have example using powershell - great. thank you. assuming regex correct matching on line should able this: $pattern = '^.*?\b(639|640|460|458|664|148)\b.*$' $content = get-content c:\somefile.txt ($i = $content.length - 1; $i -ge 0; $i--) { if ($content[$i] -match $pattern) { $matches[1] break } }

How do I execute a large SQL Script with many GO statements from within Delphi? -

we have updater application executes sql scripts of on 30,000 lines of code on sql server database. in script large number of go statements. ado components i'm used using not support go statement. we've used osql command-line when updating server, tricky catch problems (outputs text file have parse errors , results). more ideal if in delphi able find go statements , execute each block @ time. i understand go statement specific ms tools able execute them. again script on 30,000 lines of code, @ least 500 go statements. use same script in sql management studio , osql updater. osql isn't giving results need - it's sloppy way of executing such script. is there existing sql server compatible tool delphi recognizes go statements? i'm not talking parser (although i'm sure parsing involved), i'm talking ready-made utility execute sql scripts contain go statements , return results of each script block. for example, 1 block might create table, , go ,

html - Automatically begin lazy loading images without waiting for user to scroll down page -

websites lazy load images user scrolls down page allow initial viewed top portion of page load faster. instead of waiting until user decides scroll down page, possible detect when top images have been downloaded client (or accessed via cached images), , start downloading next set of images? if so, how? see demo in jsfiddle . implementation quite straightforward: listen window.onload first time, wait until complete page has been loaded. once fires, load next image , listen onload event. repeat that, until no more images need preloading: function loadnext() { var img = findnextimagetopreload(); img.load(function () { loadnext(); }); setimgsrconimagesoitstartspreloading(img); } $(window).load(function () { loadnext(); }); this basic idea , not working loadnext function. 1 implemented in jsfiddle loads 1 image after another. if want able load multiple images @ once need call loadnext multiple times. in case, need additional check if i

jquery - Random background colour picker for tumblr -

i've got in code, should select random background colour every refresh, can't see what's wrong document.write var bgcolorlist=new array("#ff871b", "#15efa1", "#51ddff", "#ff1b6c", "#000000") document.write('<meta name="color:background" content='+background=bgcolorlist[math.floor(math.random()*bgcolorlist.length)] + '>') cheers! you need semicolons after each line. additionally, why seeing background color meta tag? use line instead: document.body.style.backgroundcolor = bgcolorlist[math.floor(math.random()*bgcolorlist.length)];

Private & Public declarations in C# -

this question has answer here: labeling group of members private/public in c# 3 answers is there way in c# declare group of variables , methods private or public in c++ (example below). trying avoid typing million "public"s , "private"s. class foo { private: int alpha; string dog; public: bool bites; bool bad; } i keep getting error in c# , have exhausted internet search abilities. thanks no. need specify visibility each member. private default members, safe omit (unless coding guidelines tell must specify). more details/links - default visibility c# classes , members (fields, methods, etc)?

.net - Cancellation of a long running task in C# -

i working on project have lots of separate components running , agenda cancel component process in between based on user input. for example: have 6 windows service work , 1 windows service responsible distribution of work. once work send worker windows service there no control on it. worker windows service time consuming task, calling several function, interect database etc. want cancel task in between of working. the traditional approch use cancelation no longer work here as... 1. not iterating loop can continuosly check cancel flag. 2. since component totally separate , once start working, new instance created of component , not able pass value component. thanks in advance.

css - Why would you use Transform-style: preserve-3d over z-index? -

Image
in example in website website link show frog rotated on green background. 1 transform-style: flat; covered other element, transform-style: preserve-3d; goes above other elements. the same effect accomplished z-index. why use 1 on other? here's example of cube that's transformed. can see transform because has 100px border. if turn set flat, looks this:

javascript - Looping over attributes in validation fails to stop set of attribute -

normally in backbone validation, have crazy amount of if() statements, i've seen in many other code samples well. validation pretty crap shoot in backbone; however, if() way seems work. want clean code bit , wrote code return error should stop backbone saving attribute, doesn't! old code works validate : function(attr){ if(attr.firstname){ var defaultvalue = 'first name', value = attr.firstname.tolowercase(); if(value == defaultvalue){ return 'error'; } } } new code doesn't work //my default strings place myapp.strings.defaults = { firstname : 'first name' } //model validate function validate : function(attr){ jquery.each(attr, function(key, value){ var defaultvalue = myapp.strings.defaults[key]; if(defaultvalue){ defaultvalue = jquery.trim(defaultvalue.tolowercase()); if(value == defaultvalue){ console.log(value,

javascript - Pause Youtube embed when playing Soundcloud embed -

i have music blog contains various embedded soundcloud , youtube players. what want prevent audio playing simultaneously. in other words while playing youtube video, if click play soundcloud embed want youtube player pause , vice versa. i have developed code pauses streaming youtube player if click play youtube player (soundcloud inherently). need make cross compatible. appreciate help, thanks. var playercurrentlyplaying = null; var players = {} yt_ready(function() { $(".youtube_embed").each(function() { var identifier = this.id; var frameid = getframeid(identifier); if (frameid) { players[frameid] = new yt.player(frameid, { events: { "onstatechange": function(event){ if (event.data == yt.playerstate.playing) { if(playercurrentlyplaying != null && playercurrentlyplaying !=

UltraEdit scripting using JavaScript and wildcards -

i have program using combination of javascript , ultraedit scripting. program has array of strings search in file/tab. if found, moves corresponding lines new file/tab. when using exact match works great. however, source values not exact matches. values in file ######-## values after dash vary. have value dash. attempted build wildcard array values, , i've attempted concatenate .find function no success. thoughts appreciated. here code i'm executing script within ultraedit. i've truncated array 50 values contained purpose of demonstration. // start @ beginning of file ultraedit.activedocument.top(); // search string variable used copying of lines //dd011881 - building array of values var delstring = new array() delstring[0] = "'99999999'"; delstring[1] = "'169-*'"; delstring[2] = "'5482-*'"; delstring[3] = "'5998-*'"; delstring[4] = "'36226-*'"; delstring[5] = "'21

c# - Generated Interop Assembly from a C++ COM dll gives build reference error -

i trying migrate 32 bit application x64bit, in application have c++ com dll have build in x64 configuration. generating interop assembly of com c++ dll using command tlbimp faacom.dll /out:interop.faacomlib.dll i have c# project (configuration - cpu) in adding reference of above interop dll. when try build c# project gives build error when pointing correct path: error 1 type or namespace name 'faacomlib' not found (are missing using directive or assembly reference?) but when use same interop dll in c# project generated 32bit compiled version of c++ com dll not build error. i have tried generating interop dll using x64 tlbimp.exe not works. any suggestions. please help...!!! thanks in advance

android - ListView with multiple kinds of layouts -

my situation following. have 2 layouts first: <relativelayout ... > <textview id="@+id/textview1" .../> <textview id="@+id/textview2" .../> <imageview .../> </relativelayout> second: <relativelayout ... > <textview id="@+id/textview3" .../> <textview id="@+id/textview4" .../> <imageview .../> </relativelayout> now i'm gonna make listview these 2 layouts. arrayadapter ready. need create new instance of adapter , i'm stuck here. cause constructor is: public arrayadapter (context context, int resource, int textviewresourceid, list<t> objects) context current context. resource resource id layout file containing layout use when instantiating views. textviewresourceid id of textview within layout resource populated objects objects represent in listview. problem & question : don't know how deal second