Posts

Showing posts from January, 2010

c# - How do I upload a large file (~4mb) over https from winforms with a progress bar? -

easy way how upload large file winforms c# asp.net https (web service or asp.net page), progress bar? as you've found out, webclient doesn't great job of uploading large files. i've got source code on codeplex can at. project called bizark , class file webhelper . based on httpwebrequest , can used upload multiple files progress number of other things. feel free use library as-is if like, though intended reference code, not production code. use version of particular class in production application don't remember if i've updated source code bugs might have discovered after publishing codeplex. note: link specific change set if looking @ in far future, might want make sure looking @ latest version.

wpf - Inserting data to XML file notify ObservableCollection -

i have parent window has listview bound observablecollection gets it's data xml file. on parent window, have add button opens opens modal window (form2.showdialog(), think modal window). in child window have few text fields , add button, user enters data new record , clicks add button , xml file updated new record. what seeking when child window closed listview in parent window refreshed show new record. when updating xml file child window, doing directly xml file, should adding data file in other manner raise event on observablecollection? i heading down path of adding event handler add button on parent window , attempt force re-read of xml file, cannot figure out how achieve this, below have done far. form1.xaml.vb: private sub button1_click(byval sender system.object, byval e system.windows.routedeventargs) handles button1.click dim frm new newemergencycontact addhandler frm.closed, addressof refresh_emcontacts frm.showdialog() end su...

java - file.createNewFile() creates files with last-modified time before actual creation time -

i'm using jpoller detect changes files in specific directory, it's missing files because end timestamp earlier actual creation time. here's how test: public static void main(string [] files) { (string file : files) { file f = new file(file); if (f.exists()) { system.err.println(file + " exists"); continue; } try { // find out current time, hope assume last-modified // time on file later system.out.println("-----------------------------------------"); long time = system.currenttimemillis(); // create file system.out.println("creating " + file + " @ " + time); f.createnewfile(); // let's see timestamp (i've seen <time) system.out.println(file + " last modified at: " + f.lastmodified()); // well, ok, if expli...

SQL Server VARBINARY(max) to c# byte[] -

i querying table (one of columns varbinary(max) ) returns records. then save .dat.csv parse through .dat file , varbinary value string splitting file based on commas. need convert varbinary byte array. how can that? good question. technically, can first converting character array, converting bytes. however, strings in .net unicode-encoded default (instead of ascii), gets tricky. if @ possible, should try pull varbinary out of file byte array, using filestream you're reading instead of streamreader performs encoding conversions , file encoding type. the problem byte-to-string-to-byte babelfishing bytecodes have special meaning in each unicode encoding, giving information decoder number of bytes should pull decode next character. when converting between various unicode encodings , .net-native utf-8 encoding strings, bytes gained, lost, , changed. when it's string, no biggie; encoding information stays string. when it's binary data, encoding , decoding can ...

c++ - unresolved external symbol _D3D10CreateDeviceAndSwapChain@32 referenced in function "public: bool -

having trouble creating swap chain. receive following error. dx3dapp.obj : error lnk2019: unresolved external symbol _d3d10createdeviceandswapchain@32 referenced in function "public: bool __thiscall dx3dapp::initdirect3d(void)" (?initdirect3d@dx3dapp@@qae_nxz) below code ive done far. #include "dx3dapp.h" bool dx3dapp::init(hinstance hinstance, int width, int height) { mhinst = hinstance; mwidth = width; mheight = height; if(!windowsinit()) { return false; } if(!initdirect3d()) { return false; } } int dx3dapp::run() { msg msg = {0}; while (wm_quit != msg.message) { while (peekmessage(&msg, null, 0, 0, pm_remove) == true) { translatemessage(&msg); dispatchmessage(&msg); } render(); } return (int) msg.wparam; } bool dx3dapp::windowsinit() { wndclassex wcex; wcex.cbsize = sizeof(wndclassex); wcex....

parsing - running Sax parser -

am new using sax parser .can tell me how run .and required run (jdk )..can have sax parser can parse both android xml , normal xml sax parsers implemented creating contenthandler object implements callback functions correspond events happen while parsing xml document. example, startdocument method called when parser begins parsing document, , startelement called when discovers new tag; similarly, endelement , enddocument , , error called when parser finds end of tag or document, or when invalid sequence discovered. this example shows how use sax parser. key myhandler class extends defaulthandler class (which implements contenthandler interface) , overrides empty implementations of each callback method. think of way: java saxparser class knows how parse xml documents when discovers things of interest relies on handler class know them. defaulthandler class helper implementation can extend pay attention interesting things.

symbian - Not able to get response back on java code while http get with S60 -

i using net beans developing application on s60. made 1 page user authentication , using .net wcf service authenticate user. able send data on .net service httpget method not able response on java page. i have tested on fiddler url working fine , returning response code 200, not getting response code java code. following code using. thing wrong here ? httpconn = (httpconnection)connector.open(url); httpconn.setrequestmethod(httpconnection.get); httpconn.setrequestproperty("user-agent", "profile/midp-2.1 confirguration/cldc-1.1"); int respcode = httpconn.getresponsecode(); try user agent "profile/midp-2.1 configuration/cldc-1.1"

c++ - Char* vs std::string -

possible duplicate: c++ char* vs std::string is there advantage using char*'s instead of std::string? i know char*'s defined on stack, know how memory we'll use, argument use? or std::string better in every way? if you're writing in c++ std::string better in cases you'll encounter. instead, few cases when might want use char*'s: -compatibility old c code (although std::string's c_str() method handles of this) -to conserve memory (std::string have more overhead) -cases want make sure know memory at, such network code or shared memory

java - looking to scan documents directly to be uploaded to a webpage -

i hoping flash plugin, kind of how flash accesses microphone or webcam doesn't seem possible. going possible using java, or activex, or other strategy haven't looked @ yet? idea without client install, or @ least lightweight , browser , platform independent, (and possibly moon on stick welll ;-)) your real hope activex, both flash , java applets run in security sand box prevents access resources scanners. need activex controls signed trusted ca , full access local machine in theory can ever want. activex of course not browser or platform independent, might not suitable choice. you may milage java webstart or .net's click once deployment, both easy local install that'll keep it's self date, there half way house, aren't hosted in browser. sorry can't more helpful, luck

python - Categorize book authors as fiction vs non-fiction -

for own personal purposes, have ~300 authors (full name) of various books. want partition list "fiction authors" , "non-fiction authors". if author writes both, majority gets vote. i looked @ amazon product search api: can search author ( in python ), there no way find book category (fiction vs rest): >>> node = api.item_search('books', author='richard dawkins') >>> book in node.items.item: ... print book.itemattributes.title what options? prefer in python. well, can try service - google book search api . use python can have @ gdata-python-api . in protocol, in result feed there node <dc:subject> - that's need: <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/atom" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gbs="http://schemas.google.com/books/2008" xmlns:dc="http://p...

.net - Indexing .PDF, .XLS, .DOC, .PPT using Lucene.NET -

i've heard of lucene.net , i've heard of apache tika . question - how index these documents using c# vs java? think issue there no .net equivalent of tika extracts relevant text these document types. update - feb 05 2011 based on given responses, seems not native .net equivalent of tika. 2 interesting projects mentioned each interesting in own right: xapian project ( http://xapian.org/ ) - alternative lucene written in unmanaged code. project claims support "swig" allows c# bindings. within xapian project there out-of-the-box search engine called omega. omega uses variety of open source components extract text various document types. ikvm.net ( http://www.ikvm.net/ ) - allows java run .net. example of using ikvm run tika can found here . given above 2 projects, see couple of options. extract text, either a) use same components omega using or b) use ikvm run tika. me, option b) seems cleaner there 2 dependencies. the interesting part there...

PHP PostgreSQL pg_exec doesn't work -

hey, can tell me why php doesen't execute sql code in pgsql.. connection working fine, send query's p_send_query pg_execute doesen't work .. pg_send_query($pg_con, "insert 'frontend_usermessage' (opened, created, text, to_user_id, from_user_id, administrative, subject) values ('null','$created','$text','$to_user', '$cookie','$admin','$fromuserr')") or die(pg_error()); $credits_new = $credits - 1; pg_send_query($pg_con, "update users_mfuser set song_credits='$credits_new' user_ptr_id='$cookie'") or die(pg_error()); u can use in way executing pg_execute(), $query = pg_query("your query here...."). pg_execute($query); it work definitely..... , please post entire code can explain clearly..

java - Format a period with DurationFormatUtils in a nice way -

this works well: out.println(durationformatutils.formatperiod( new date().gettime(), match.getstartingtime().gettime(), "d h")); but have nicer format out.println(durationformatutils.formatperiod( new date().gettime(), match.getstartingtime().gettime(), "d days h hours left")); but aspected gives output as 45 a01101 4 hour1101 left is there simple solution problem? it appear base formatting on simpledateformatter , escape character there ' so code this: "d 'days' h 'hours left'"

How to specify main-class in SCons Java build? -

i have following sconscript file: java(target='classes', source='.'); jar(target='test.jar', source='classes') the problem i'm unsure how set main-class attribute , it's not covered in scons documentation. know how this? i figured out. here's updated sconscript file: jar(target='observer', source=['observer.java', 'manifest.txt']) note manifest.txt file can have name, first line in must be: manifest-version:

objective c - Data definition has no type or storage class with float array definition -

i'll find answer enough blind experimentation or better google search, but.. might benefit others. this not inside class definition, in .m objective-c file. i've got declaration of float array giving me following 2 warnings in xcode. errors show on declaration line, not assignment line. data declaration has no type or storage class. type defaults 'int' in declaration then assignment fails - if variable defaulting int, happen. here's code. first declaration (static const float array initializer) doesn't give error, nor second (simple float). third , forth (float arrays) do. static const float offset3d[4] = { 0.0, 0.0, -2.0, 0.0 }; float boxv; float boxv0[3]; float boxv1[3]; boxv0[0] = -0.5; // gives error of trying assign float (default) int you need put boxv0[0] = -05.; inside method somewhere. each of declarations should work, , assignment should fail. first assignment works because assign declared array- acceptable because com...

javascript - Showing selected tabs differently with JQuery ajax tabs -

i had tabs preloaded content this: $(function () { $('div.tabs ul.tabnavigation a').click(function () { $('div.tabs ul.tabnavigation a').removeclass('selected'); $(this).addclass('selected'); return false; }).filter(':first').click(); }); this added class="selected" links , css made selected tab different <div class="tabs"> <ul class="tabnavigation"> <li><a href="#content1">c1</a></li> <li><a href="#content2">c2</a></li> <li><a href="#content3">c3</a></li> </ul> <div id="content1"> content 1 </div> <div id="content2"> content 2 </div> <div id="content3"> content 3 </div> now i`m trying ajax work...

Running .NET 4 program under lower .NET version -

is possible .net 4 application run when example .net 3 framework installed on computer? no, isn't possible. they use different runtimes , can't run assembly targeting 1 runtime on different runtime. .net 2.0, 3.0 , 3.5 run on 2.0 runtime. .net 4.0 has new runtime.

python - pygtk image grid -

i'm looking easy way implement this: http://www.dinointeractive.com/?p=117 . , guessing if here had idea. i want arrange images in grid view. , additionally images should arrange position automaticly you might find gtk.iconview useful. might want gtk.layout depending on might want do. some sample code can found here , related question here .

css - What is the use of firebug's "Open With Editor" function? -

what use of firebug's "open editor" function? i'd it'll allow visualize file / feed editor -- means better searching features, syntax-highlighting, better-ability copy code... but means have configure editors, firebug knows how call 1 -- especially, knows how pass data. edit after comment : no, don't see allows see modifications website -- it's, think, easier go through html code way, editor you're using in every-day life developer. for example, can check what's said in article : check edit html code firebug -- check editing firebug section. , use it, have : select " open editor > configure editors ", and, in dialog box, set path editor and, then, edit html page, select " open editor > name of editor " (the labels may not : i'm using french version...)

python - Am I correctly extracting JPEG binary data from this mysqldump? -

i have old .sql backup of vbulletin site ran around 8 years ago. trying see file attachments stored in db. script below extracts them , verified jpeg hex dumping , checking soi (start of image) , eoi (end of image) bytes (ffd8 , ffd9, respectively) according jpeg wiki page . but when try open them evince, message "error interpreting jpeg image file (jpeg datastream contains no image)" what going on here? some background info: sqldump around 8 years old vbulletin 2.x software stored info most php 4 used most mysql 4.0, possibly 3.x the column datatype these attachments stored in mediumtext my python 3.1 script: #!/usr/bin/env python3.1 import re trim_l = re.compile(b"""^insert attachment values\('\d+', '\d+', '\d+', '(.+)""") trim_r = re.compile(b"""(.+)', '\d+', '\d+'\);$""") extractor = re.compile(b"""^(.*(?:\.jpe?g|\.gif|\.bmp))...

indexing - MySQL returns zero rows(Empty set) without limit because of broken/outdated index -

i work on large table around 1.5k entries, create table `crawler` ( `id` int(11) not null auto_increment, ... `provider_id` int(11) default null, primary key (`id`), key `crawler_provider_id` (`provider_id`), ... ) engine=myisam ... provider_id used link table table 'providers, cleared , repopulated new data. trying recreate connections 'crawler' 'providers' (which should not matter in case of myisam), reason in script mysql returns 0 rows if don't provide limit. mysql> select `crawler`.`id` `crawler` `crawler`.`provider_id` > 1371; empty set (0.40 sec) but mysql> select count(*) `crawler` `crawler`.`provider_id` > 1371; | 346999 | and mysql> select `crawler`.`id` `crawler` `crawler`.`provider_id` > 1371 limit 10; 10 rows in set (0.01 sec) if select data table , check myself can see values greater 1371. i able fix deleting indexes (and recreating later), extremely confused. i've never seen indexes going out of sync ...

c# - Need help for a complex linq query -

ok i've got datatable here's schema datatable dt = new datatable(); dt.columns.add("word", typeof(string)); dt.columns.add("pronunciation", typeof(string)); the table filled , i'm trying make linq query can output console or anywhere : pronunciation : akses9~r => (list of words) i want output pronunciations common , words use it. something should give want: var results = dt.groupby(dr => dr.pronunciation); foreach(var result in results) { console.write("pronunciation : {0} =>", result.key); foreach(var word in result) { console.write("{0} ", word); } console.writeline(); } the groupby gives igrouping key property contain pronunciation , collection contain words.

Are all Google Chrome extensions open source by default? -

i want know if write google chrome extension, able use code? it looks people able see code. if can see code, can potentially use it. windows: c:\documents , settings\%username%\local settings\application data\google\chrome\user data\default\extensions linux , mac: ~/library/application support/google/chrome/default/extensions/ or ~/.config/google-chrome/default/extensions/ the source code available inspection/debugging/experimenting & whatever people might want do. may try use javascript obfuscator .

http - how Ajax request is sent by browser -

i want ask how browser sends ajax request mean format of ajax request. actual format of ajax request sent browser. thanks in advance if install firefox , firebug can see yourself: http://codeclimber.net.nz/archive/2007/08/01/how-to-debug-xmlhttprequest-with-firebug.aspx

SQL Server Indexing -

i trying understand going on create index internally. when create nonclustered index shows insert in execution plan when query test. declare @sqltext varbinary(128) select @sqltext = sql_handle sys.sysprocesses s spid = 73 --73 process creating index select text sys.dm_exec_sql_text(@sqltext) go show: insert [dbo].[tbl] select * [dbo].[tbl] option (maxdop 1) this consistent in execution plan. info appreciated. this lack of knowledge on indexes, difference 4 months of experience makes! :) the index creation cause writes index insert leafs needed.

hosting - How to host your own JavaScript scripts files (other than Jquery) on a fast & free CDN like google? -

dave ward inspired me host javascript jquery externally on google cdn: //ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js //ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js now, can host other/own (non-jquery) javascripts on free cdns google? possible? or jquery/famous used scripts only? thanks suggestions. i'm using http://yourjavascript.com 3 years , happy ther free service

Lock-Free Data Structures in C++ Compare and Swap Routine -

in paper: lock-free data structures ( pdf ) following "compare , swap" fundamental shown: template <class t> bool cas(t* addr, t exp, t val) { if (*addr == exp) { *addr = val; return true; } return false; } and says the entire procedure atomic but how so? not possible other actor change value of addr between if , assignment? in case, assuming code using cas fundamental, found next time "expected" way, , wasn't. however, doesn't change fact happen, in case, still atomic? other actor returning true, when it's changes overwritten actor? if can't possibly happen, why? i want believe author, missing here? thinking must obvious. apologies in advance if seems trivial. he describing atomic operation given implementation, "somehow." pseudo-code implemented in hardware.

visual studio - How to create a drop down menu in MFC for WINCE -

i have following code in win32 app shows drop down menu on clicking button. however, not work in wince menuinfo not defined. there way can around this? need view drop down menu on clicking button, , name appearing on button changes depending on option on menu. void ctestdlg::onbnclickedbtnmenu() { if( null == m_popupmenu.m_hmenu ) { m_popupmenu.setmenudimension( 120 ); m_popupmenu.createpopupmenu(); m_popupmenu.appendmenu( mf_string | mf_enabled | mf_ownerdraw, 697, _t("a") ); m_popupmenu.appendmenu( mf_string | mf_enabled | mf_ownerdraw, 697, _t("b") ); m_popupmenu.appendmenu( mf_string | mf_enabled | mf_ownerdraw, 697, _t("c") ); m_popupmenu.appendmenu( mf_string | mf_enabled | mf_ownerdraw, 697, _t("d") ); menuinfo menuinfo; memset( &menuinfo, 0, sizeof(menuinfo) ); menuinfo.cbsize = sizeof(menuinfo); menuinfo.fmask = mim_style; m...

iphone - Dynamic VariableFromString in objective C -

i want dynamically create variable string in objective c. like nsclassfromstring thats way. in want access variable. any idea this? if want dynamically access property of object, that's easy using key value coding . if class kvc-compliant (most apple classes are), use valueforkey: , or valueforkeypath: method access property string. consider example. // shoe.h @interface shoe { nsstring *brand; nsnumber *size; } @property (nonatomic, copy) nsstring *brand; @property (nonatomic, retain) nsnumber *size; @end // shoe.m @implementation @synthesize brand, size; @end let's create , initialize shoe object first. shoe *someshoe = [[shoe alloc] init]; someshoe.brand = @"adidas"; someshoe.size = [nsnumber numberwithfloat:9.5]; considering example someshoe object, brand or size can accessed via string. nsstring *brandname = [someshoe valueforkey:@"brand"];

objective c - Also found '-(void) init' -

i built custom class named game: .h -(void) init; here have found '-(void) init' .m -(void) init { [super init]; score = 0; lives = 3; elements = [[nsmutablearray alloc] initwithcapacity:1000]; } when try initialize object with: mygame = [[game alloc] init]; i got "multiple methods named '-init' found don't know error is... init should return (id). change function following: .h -(id) init; .m -(id) init { if((self = [super init])) { score = 0; lives = 3; elements = [[nsmutablearray alloc] initwithcapacity:1000]; } return self; }

multiple monitors - Android dual screen display -

is android supports dual screen display?. if how this?. please help the current android sdk doesn't natively support dual screens. there's new dual-screen android phone announced, uses proprietary api access both screens. http://www.sprintusers.com/the-big-announcement/ that doesn't mean won't officially supported eventually, it's not yet.

cocoa - Re-format an NSArray as a typical NSString -

does know of easy way re-format nsarray typical nsstring? i'm building array of objects (that have been converted nsstring , aded nsarray) , if nslog array this... nslog(@"sock out array: %@", sockout); sock out array: ( sock, " -i /users/username/sock/main.sock", " -r 960", " -as 2", " -g 2.2", " -il", " -id" ) but need deconstruct array if nslog this... nslog(@"sock out array: %@%@%@%@%@%@%@", arg1, arg2, arg3, arg4, arg5, arg6, arg7); which produce: "sock out array: sock -i /users/username/sock/main.sock -r 960 -as 2 -g 2.2 -il -id" assuming first element ( sock ) nsstring, want -[nsarray componentsjoinedbystring:] , returns string containing elements of array given separator between elements: nsstring *strsockout = [sockout componentsjoinedbystring:@" "]; nslog(@"sock out array: %@", strsockout);

scala - When are singleton objects constructed? -

in object o { // construction code , member initialization } construct, when code going run? the code called when o accessed first time (some method or property). example following program object o { println("hello o") def dosome() {} } object app extends application { println("before o") o.dosome() println("after o") } will yield before o hello o after o it's not enough define o . won't work to call class.forname("o") since compiled object's name o$ , calling class.forname("o$") do.

encoding - Python BOM error in Ascii file -

i have weird, annoying problem python 2.6. i'm trying run file (and other), on embedded linux arm board. http://svn.tuxisalive.com/software_suite_v3/smart-core/smart-server/trunk/tdsservice.py i error: file "tuxhttpserver.py", line 1 syntaxerror: encoding problem: bom i know error bom bytes etc etc. but, there no bom bytes, it's plain ascii. checked hexeditor, , linux file command says ascii. im freaking out here... code worked fine on sheevaplug (also arm based system). don't hung on "with bom" remark. it's not relevant. error means python trying run in not support encoding declare. observe: % head -1 tmp.py # -*- coding: asdfasdfasdf -*- % python tmp.py file "tmp.py", line 1 syntaxerror: encoding problem: bom the python installation running on embedded linux arm board lacks 'latin-1' encoding. since don't have non-ascii characters in source file, declare encoding 'ascii', or leave ou...

jquery - How to drop larger object on a smaller one when near edge of the containment? -

i'm trying drop large box onto smaller box. large box seems 'over' box when center inside smaller box. can change part of big box needs on smaller one? why? because works fine until add containment. when small box near edge of containment center of large box can't 'inside' small 1 because hits edge of area. not code show. like: $(bigbox).draggable({ containment: $("#container") }) $(smallbox).droppable({ drop: dropped-function }) if understand correctly, want @ droppable method's options , tolerance . default intersect means big box has overlap small box @ least 50%. setting tolerance touch allow big box dropped on smaller box when overlaps smaller box amount. i hope helps.

c# - Formatting ASP.NET ReportViewer with CSS classes and online specific rules? -

how can assign classes online/asp.net (not desktop app) version of reportviewer? i'm intersted in using web specific formatting, e.g. ems versus reportviewer desktop defaults such points , inches. nevermind, found out solution. default reportviewer generates classes tables - they're still pretty cryptic - "a15" , "r11" not idea of identifying rows/columns/tables. guess it's better nothing.

how to randomize a Facebook friend in PHP? -

i trying randomize facebook friend firend list. since new php, can assist me , let me know how so? $friends_json = file_get_contents('https://graph.facebook.com/me/friends?access_token='.$session["access_token"]); $friends = json_decode($friends_json, true); $friend_rand = array_rand($friends, 1); // <-- right? how can print on screen? array_rand returns array of keys. since you're extracting 1 element code print is echo($friend_rand[0]); andrea's answer works well, print array (not element).

php - A good way to release fixtures -

hey, problem follows, trying create code set of sporting fixtures created dates on. have 8 teams, 7 rounds of fixtures. i have generated fixtures, want add date generation on them. if had 7 rounds, put 28 days , make each round 4 days now, 8 days now, etc. what best way go doing this? thanks this should want , allows uneven number of teams. dates might not perfect because of rounding down: $teams = array("team a","team b","team c","team d","team e", "team f","team g","team h","team i"); $days = 28; $rounds = count($teams) -1; //number of days between fixtures $daysbetweenfixtures = floor($days / $rounds); $fixtures = array(); for($i =0; $i < count($teams); $i++) { //calculate date of round of fixtures $date = date("d d m y",mktime(0, 0, 0, date("m") , date("d")+ ($i * $daysbetweenfixtures) , date...

vba - Assigning values to a user defined data type -

i assign values of range user defined data type. i have dataset of measurements taken @ mutliple times on course of week stored in excel sheet. have created variable range of data set. created user defined data type date , single types. assign values of range user defined data type. data set: 02/11/2011 3.8 02/11/2011 2.4 02/11/2011 8.9 02/12/2011 5.7 02/12/2011 4.6 02/12/2011 2.6 i've made user define data type: type phdata dy date ph single end type and created variable of phdata type , matched size range: dim dailydata() tradedata dim nrec integer nrec = datarng.rows.count redim dailydata(nrec) and defined range of dataset on excel spreadsheet: dim datarng range set datarng = range("a2", range("a2").end(xldown).end(xltoright)) and assign values in range phdata type. can assign 1 value @ time using: dailydata(1).dy= datarng(1).value but need more efficient have 4,000 records. try this: dim rngdata rang...

internet explorer - Why is the image not showing in IE7? -

i have image on page in blue bar area. shows fine in ff, safari, ie8 & chrome, not show in ie7. here html: <div id="featuredimage"> <img src="images/website_design_charlotte.jpg" width="960" height="159" alt="" /> </div> here css: #featuredimage { position: absolute; z-index: 9; top: 129px; left: 0; } #featuredimage img { width: 986px; height: 159px; position: relative; z-index: 10; } would appreciate getting show in ie7. thanks! a few lines down in html have this: <!--[if ie]> <link rel="stylesheet" type="text/css" href="styles/style-ie.css" /> <![endif]--> ... means other browsers using water.css stylesheet, ie using style-ie.css . since is working ie8, problem may in code determines browser version.

matlab - the easiest way to convert matrix to one row vector -

possible duplicate: how concatenate rows of matrix vector in matlab? hi, does know best way create 1 row matrix (vector) m x n matrix putting rows, 1 m, of original matrix first row of new matrix following way: a = [row1; row2; ...; rowm] b = [row1, row2, ..., rowm] example: a = [1 1 0 0; 0 1 0 1] b = [1 1 0 0 0 1 0 1] is there simple method or perhaps built-in function generate matrix b a? try this: b = ( : ) , or try reshape function. http://www.mathworks.com/access/helpdesk/help/techdoc/ref/reshape.html

How should I implement the C# server side portion of long-polling for ajax requests? -

i've got architecture involves browsers polling via ajax every 3 seconds updates , i'd change long-polling . i'd have 1, 2.. {n} clients long-polling, waiting updates , have happen on server signal waiting clients return. first thought use eventwaithandle , , can if want support 1 client. i'd have autoresetevent waithandle waitone block client, maybe timeout, maybe not. either way, autoresetevent allow me support 1 client (since wakes 1 waiting thread) , want n clients. i'm pretty sure need use manualresetevent waithandle , i'm not sure when call reset after set (when waking threads). should thread.sleep arbitrary amount in between set , reset ? in psuedo code, waking logic get manualreseteventwaithandle call set ensure waiting clients have woken, while preventing new requests blowing through call reset waiting clients have received updates its 3rd line i'm having hard time with. tossing around idea of having lasttxid clien...

Define C++ function at runtime -

i'm trying adjust mathematical code i've written allow arbitrary functions, seem able pre-defining them @ compile time, seems clunky. i'm using function pointers, far can see same problem arise functors. provide simplistic example, forward-difference differentiation code used is: double xsquared(double x) { return x*x; } double expx(double x) { return exp(x); } double forward(double x, double h, double (*af)(double)) { double answer = (af(x+h)-af(x))/h; return answer; } where either of first 2 functions can passed third argument. do, however, pass user input (in valid c++) rather having set functions beforehand. appreciated! historically kind of functionality you're asking has not been available in c++. usual workaround embed interpreter language other c++ (lua , python example designed being integrated c/c++ apps allow scripting of them), or create new language specific application own parser, compiler, etc. however, that's cha...

Smooth mousover images inside scaled Flex App? -

i have flex app scaling using systemmanager.stage.scalemode=stagescalemode.no_border; part works except bitmap data (mostly png's designers). i can set mx:image tags smoothbitmapcontent=true , works great except mouseover objects. when mouseover, source being changed 1 embedded image embedded image. have tried several (many) online "smoothimage" classes, , tried write own, have tried reset smoothbitmapcontent every chance still no dice. seems mee because scaling @ app level, flopped out bitmap not getting smoothed when renders. does have suggestions on how keep things smooth (perhaps there flag tell flex smooth stuff when scales it?). josh so easy answer (that works me) instead of changing image.source 1 embedded png another, use 2 images , flip flop image.visible between two... granted adds 2 objects screen, reason stay smoothed , scaled way, before switching sources going smooth jaggidy , un-readable. josh

ruby - How to create a private class method? -

how come approach of creating private class method works: class person def self.get_name persons_name end class << self private def persons_name "sam" end end end puts "hey, " + person.get_name puts "hey, " + person.persons_name #=> raises "private method `persons_name' called person:class (nomethoderror)" but not: class person def self.get_name persons_name end private def self.persons_name "sam" end end puts "hey, " + person.get_name puts "hey, " + person.persons_name private doesn't seem work if defining method on explicit object (in case self ). can use private_class_method define class methods private (or described). class person def self.get_name persons_name end def self.persons_name "sam" end private_class_method :persons_name end puts "hey, " + person.get_name puts ...

Testing for NaN in VBA/VB6 -

using vba loading 8-byte floating point number array of bytes double. numbers ieee 754 nan (i.e. if try print debug.print see 1.#qnan). question is, how can test whether data contained in double nan opposed regular number? thanks. nan's have pattern in exponent can identify while they're still in byte array. specifically, nan have exponent of 1's, infinity, should trap. in double, exponent in highest-order 2 bytes: seeeeeee eeeemmmm mmm.... assume b(0) , b(1): is_a_nan = ((b(0) , &h7f) = &h7f) , ((b(1) , &hf0) = &hf0) that's air code, idea. if need distinguish between snan, qnan, , infinity you'll need deeper, doesn't sound that's issue you.

c# - How pass null from code behind with textboxes -

i have 2 textboxes , drop down.user has option should select drop down , enter value in 1 of texbox . my procedure accepts null values . problem how pass tht code behind tht text box value submitted shud return data. can 1 me on . thanks smartdev have checked int.parse or int.tryparse methods along nullbale int some thing similar work int? couldbenullint; couldbenullint = int.parse(sometextbox.text); if value returned null, pass null procedure otherwise pass non null value such as if(couldbenullint.hasvalue && couldbenullint.value !=null)

jquery - Can't get .show() to work on ajax success -

below code having problems with. issue 2 specific lines transversing dom , attempting execute .show() on .cell-toolbar a[href$="#edit"] , .cell-toolbar a[href$="#delete"]' respectively. , shown below, have attempted execute .show in 2 different places, neither success. console.log in code below return appropriate jquery object selector. worth noting on jquery 1.2 $('.bstory-page-preview .cell').droppable({ scope: 'cells', hoverclass: 'cellhover', drop: function(event, ui) { var container = $(this); container.find('.cell-toolbar a[href$="#edit"]').show(); // not work container.find('.cell-toolbar a[href$="#delete"]').show(); // not work var toolbar = container.find('.cell-toolbar').clone(); container.html(toolbar); var nid = getnid($(ui.draggable)); var did = getdid($(this)); var region = $(this).attr(...

c# - Cannot resolve Dictionary in Unity container -

i've stumbled upon this: within unity container, want register idictionary<tk, tv> ; assume it's idictionary<string, int> _unitycontainer = new unitycontainer() .registertype<idictionary<string, int>, dictionary<string, int>>(); but if try var d = _unitycontainer.resolve<idictionary<string, int>>(); it fails resolve... i get... microsoft.practices.unity.resolutionfailedexception: microsoft.practices.unity.resolutionfailedexception: resolution of dependency failed, type = "system.collections.generic.idictionary`2[system.string,system.int32]", name = "(none)". exception occurred while: while resolving. exception is: invalidoperationexception - type dictionary`2 has multiple constructors of length 2. unable disambiguate. at time of exception, container was: resolving system.collections.generic.dictionary 2[system.string,system.int32],(none) (mapped system.collections.generic.idictionary 2[...

sql - database design, question about implementation -

question regarding sql database design project working on. i receiving data every few seconds , going need store data database. using mysql dbms. data needs stored in database userid attached each piece of data. handling 1 user per application. so, each instance of application handling 1 users data. remote database storing users data though. so, why need userid's know data whose. my idea wait until receive 50 data packets , create delimited string of 50 data packets. (maybe separated commas) push string database along userid. , store data that. question is, way it? there better way? bad practice? tips please! =) i receiving lot of data. 1 data packet every second, faster. let me know think. the dbms running on remote machine. application running on android phone. thanks in advance! i not suggest concatenating bunch of values send delimited string database. creates additional work on database parse string. any reasonable framework interacting database let c...

How to replace a block of HTML with another block of HTML using jQuery -

would appreciate based on condition, replace following html block: <table class="t12pagebody" cellpadding="0" cellspacing="0" width="100%" summary=""> <tr><td colspan="2">#region_position_01#</td></tr> </table> <table width="100%" summary=""> <tr> <td class="t12contentbody" valign="top"> #success_message# #notification_message# #box_body# #region_position_04##region_position_05##region_position_06##region_position_07##region_position_08#</td> <td align="right" valign="top" class="t12contentbody">#region_position_03#<br /></td> </tr> </table> with block: <div id = "banner"> <div class="logo"></div> <img src="http://www.abc.com/home/images/spacer.gif" height="35" width="180" bo...

ASP.Net MVC Futures Refresh For MVC2 -

with release of mvc2, noteworthy features included in refresh of mvc futures library? there 2 versions of mvc futures sit alongside mvc 2 rtm. 1 version targets .net 3.5; other targets .net 4. (the .net 4 version not superset of .net 3.5 version; must include both of them in application if want entire range of functionality.) download http://aspnet.codeplex.com/releases/view/41742 . a non-exhaustive feature list (.net 3.5+): a diagnostics page can diagnose runtime , assembly loading errors (see documentation ). a new, more powerful model binding , validation system . detailed documentation , tutorial available @ above link. improved support building restful services (see microsoft.web.mvc.resources namespace). strongly-typed actionlink<t>() . a slew of other filters , helpers , such html.serialize() (see blog post ), html.script(), etc. a slew of other value providers , such jsonvalueproviderfactory. the ability turn off session state individual con...

android - Application Publisher -

i finish android application. provide lite version , more complete paid pro version. unfortunately, google not allow australian developers sell applications , don't have friends in or uk. does know of person/company publish pro application on behalf? google search did not bring results. thanks. do not use androidpublisher.com. publish many pirated apps , flood market absolutely horrible applications. developer, "android publisher" 1 of last things want associated application.

Synchronizing Eclipse project on Thumbdrive with PC -

i have thumb drive (memory stick, flash drive, etc.) on use projects when away home pc. accessing eclipse project directly thumb drive when connected pc. i copy files pc, develop on pc, "synchronize" thumb drive (update files on thumb drive). need reverse process too: synchronize thumb drive files files on pc. i have looked @ filesync plugin, says one-way. how can synchronize eclipse project both directions (pc thumb drive , thumb drive pc) on demand (i don't need done automagically)? use dvcs (git, hg), make sure sync repositories when you're changing work location. let work on same file in multiple places , merge result. use unison

mysql - Data Structure -

i building online form, 20 multiple choice checkboxes. i can nested data command. raise params.to_yaml i need store these data , call them again later. want sort out user chose specific checkbox, i.e. chose checkbox no.2? what's best way store these data in database? the easiest way run reports on collected data going storing in structured fashion. something along lines of: question has_many answers answer belongs user creating question, answer , user models corresponding tables. the alternative brute force through yaml data. might work smaller data sets, won't pretty. fetch of responses, iterate through responses find , collate results specific questions. think structured approach, although little more legwork initially, going easier in long run.

.net - what's the UNC path for local computer from a remote machine? -

i writing small utility program in ironpython install applications on remote machine using managementclass uses wmi. now, script install application on machine_b machine_a, works fine long have msi file on local drive of target machine (machine_b, in case). want able same thing .msi file being on host (machine_a) machine. network_scope = r"\\%machine_b\root\cimv2" scope = managementscope(network_scope, options) scope.connect() mp = managementpath("win32_product") ogo = objectgetoptions() mc = managementclass(scope, mp, ogo) inparams = mc.getmethodparameters ("install") inparams["packagelocation"] = r"c:\installs\python-3.1.1.msi" inparams["allusers"] = true retval = mc.invokemethod ("install", inparams, none) print retval ["returnvalue"].tostring() problem : [machine a] --- running script, , want host .msi file [machine b] --- want install application so, how can define unc path local ma...

objective c - NSTextFieldCell or just NSCell with vertical text (and colored tinting) -

i'm struggling trying find elegant way of displaying column headers table view in vertical fashion (rotated 90 deg counter clockwise traditional). i'm not married doing actual nstableheadercell, figured might easier overriding nstextfieldcell or nscell. the cells contain noneditable text, it's 2 lines of it, , it's tinted rest of column depending on context. i can't seem find cocoa apps this, less open source example. thoughts? #import "verticaltextcell.h" @implementation verticaltextcell - (void)drawinteriorwithframe:(nsrect)cellframe inview:(nsview *)controlview { nsmutabledictionary *atr = [nsmutabledictionary dictionary]; nsfont *font = [nsfont fontwithname:@"lucida grande" size:12]; [atr setobject:font forkey:nsfontattributename]; [[[self backgroundcolor] colorwithalphacomponent:0.7] set]; nsrectfillusingoperation(cellframe, nscompositesourceover); nsgraphicscontext *currentcontext = [nsgraphic...

php - What's method for checking user fan of a page in GRAPH API? -

in graph api, pages.isfan method not working, what's method checking user fan of page in graph api? thanks. update 2: check if current user fan of facebook page on landing @ tab check answer . update: can use likes connection check if user fan of page: https://graph.facebook.com/me/likes/page_id &access_token=access_token this return either empty data array: array ( [data] => array ( ) ) or if fan: array ( [data] => array ( [0] => array ( [name] => real madrid c.f. [category] => professional sports team [id] => 19034719952 [created_time] => 2011-05-03t20:53:26+0000 ) ) ) so how check using php-sdk: <?php require '../src/facebook.php'; // create our application instance (replace appid , secret). $facebook = new facebook(array( 'appid...

What is functional programming? -

possible duplicates: functional programming , non-functional programming what (functional) reactive programming? what difference between procedural programming , functional programming? what functional programming? i'm familiar procedural programming, not understand concept of functional programming.

android - heap size warning when uploading a file using url connection -

i trying upload file amazon s3 using httpurlconnection , put method. outputstream = new dataoutputstream( connection.getoutputstream() ); bytesavailable = fileinputstream.available(); int current = 0; buffersize = math.min(bytesavailable, maxbuffersize); buffer = new byte[buffersize]; // read file bytesread = fileinputstream.read(buffer, 0, buffersize); while (bytesread > 0) { outputstream.write(buffer, 0, buffersize); bytesavailable = fileinputstream.available(); buffersize = math.min(bytesavailable, maxbuffersize); bytesread = fileinputstream.read(buffer, 0, buffersize); current+=bytesread; } is proper way use buffer output data? works great smaller files when try upload larger says 02-11 19:04:38.718: info/dalvikvm-heap(15385): grow heap (frag case) 9.204mb 3143696-byte allocation what doing wrong? highly appreciated, thank you. ...