Posts

Showing posts from January, 2014

asp.net - ASP/HTML/CSS - Design View Different from Browser Preview -

asp.net - ASP/HTML/CSS - Design View Different from Browser Preview - i'm getting difference in design view , actual preview displays. i'm pretty sure code correctly reflecting appears in design view, incorrectly in browser preview. suggestions on how can prepare , why happening? black content area should below header , buttons. master page design view: http://imageshack.us/photo/my-images/30/designview.jpg/ browser preview: http://imageshack.us/photo/my-images/638/browserpreviewz.jpg/ ie , chrome both display same behavior. here code of master page: (because of '<' i'm having getting asp code in here...how come in in code sample?) personally, find can never trust web preview in visual studio, while not reply specific question recommend utilize actual browser preview. :) asp.net html css

php - CRUD'ing Zend_Db_Adapter_Abstract - a smart move? -

php - CRUD'ing Zend_Db_Adapter_Abstract - a smart move? - in code i've created object returns active link database. object beingness inherited crud object i've created have create/retrieve/update/delete functions zend_db_adapter_abstract functionality. next in chain table specific manager object such illustration user table or links table is cruding zend_db object smart move i've described here sounds logically design ? if need improve mvc architecture separate models business logic layer , dao layer. suppose have user object hold users business logic methods getaccountinfo, resetpassword. utilize userdao deal database related methods insertuser, updateuser. php oop crud

How can I convert a docx document to html using php? -

How can I convert a docx document to html using php? - i want able upload ms word document , export page in site. is there way accomplish this? //function :: read docx file , homecoming string function readdocx($filepath) { // create new zip archive $zip = new ziparchive; $datafile = 'word/document.xml'; // open received archive file if (true === $zip->open($filepath)) { // if done, search info file in archive if (($index = $zip->locatename($datafile)) !== false) { // if found, read string $data = $zip->getfromindex($index); // close archive file $zip->close(); // load xml string // skip errors , warnings $xml = domdocument::loadxml($data, libxml_noent | libxml_xinclude | libxml_noerror | libxml_nowarning); // homecoming info without xml formatting tags $contents = explode('\n',strip_tags($xml-...

character encoding is lost when processing a .txt file of country names with with PHP -

character encoding is lost when processing a .txt file of country names with with PHP - i processing text file of country names iso-3166 extract country names array. problem when output array, special characters countries lost or changed: $country_1 = fopen("./country_names_iso_3166.txt", "r"); while( !feof($country_1) ) { // go through every line of file $country = fgets( $country_1 ); if( strstr($country, ",") ) // if country name contains comma $i = strpos( $country, "," ); // index position of comma else $i = strpos( $country, ";" ); // index position of semicolon $country = substr( $country, 0, $i ); // extract country name $countries[] = $country; } so when output array, example, sec country name should Åland islands, outputs land islands... please advise on how prepare this. try using multibyte-aware string functions instead. mb_strstr(), mb_strpos(), mb_substr() (basically prefix ...

c# - How can I make this generic interface more Typed? -

c# - How can I make this generic interface more Typed? - consider class uses role objects, maintaining collection so. there may constraints on whether given role can added, action should take place if can added. the irolespecication below designed separate responsibility add together decision , action away class maintaining collection, have working code (ie, useful) looks code sample below. but create irolespecification.preinsert handler utilize generic type (trole) instead of object uses. tried adding parameter trole, existing code wanted remain covariant while method needed invariant. how can that? cheers, berryl public interface irolespecification<in t> { bool canaddrolefor(t instance); /// <summary> /// called when newrole added instance's collection of roles. /// </summary> /// <param name="instance">the instance.</param> /// <param name="newrole">the new role.</param> ...

c - What guarantees about low order bits does malloc provide? -

c - What guarantees about low order bits does malloc provide? - when phone call c's malloc , there guarantee first few low order bits be? if you're writing compiler/interpreter dynamic language want have fixnums of form bbbbbbbb bbbbbbbb . . . bbbbbbb1 (where b bit) , pointers of form bbbbbbbb bbbbbbbb . . . bbbbbbb0 (or vice versa), there way guarantee malloc homecoming pointers fit such scheme? should allocate 2 more bytes need, increment homecoming value 1 if necessary fit bit scheme, , store actual pointer returned malloc in sec byte know free ? can assume malloc homecoming pointer 0 final bit? can assume x86 have 2 0 bits @ end , x64 have 4 0 bits @ end? c doesn't guarantee low order bits beingness 0 pointer aligned perchance types. in practice 2 or 3 of lowest bits zero, not count on it. you can ensure yourself, improve way utilize posix_memalign. if want need overallocate memory , maintain track of original pointer. (assuming want...

android - How to bind an Activity to a Service and control and manage the Service from the Activity -

android - How to bind an Activity to a Service and control and manage the Service from the Activity - i'm trying bind activity localservice interact it. in activity able create calls methods defined in localbinder , not in localservice. doing wrong? not starting scratch read question , have read little how code sample code , code resembles sample code. have been reading of service documentation convenience here little quote section of documentation: "a service "bound" when application component binds calling bindservice(). a bound service offers client-server interface allows components interact service, send requests, results, , across processes interprocess communication (ipc). bound service runs long application component bound it. multiple components can bind service @ once, when of them unbind, service destroyed." but can't that. mentioned above best can have activity phone call methods defined in localbinder. have achieved nil part highl...

java - Modifying / Setting a String returned from an Accessor Method -

java - Modifying / Setting a String returned from an Accessor Method - i'm using specific api has method "getname()". getname() returns string. possible modify string? there no modifier method included in api, , string getname() returns private. cannot modify api. contrary prevailing opinion, is possible alter contents of string object on jdk versions 1.5 , newer, (and else here) discourage many reasons. strings never meant changed, , they're not built it, meaning effort quite messy. said, if need absolute lastly resort or else world going end kind of thing, here's bare-bones way it: public static void main(string[] args) throws exception { string foo = "foo"; system.out.println("foo's hash value: " + foo.hashcode()); field stringvaluefield = string.class.getdeclaredfield("value"); stringvaluefield.setaccessible(true); stringvaluefield.set(foo, "bar".tochararray()); field stringh...

parsing - DateTime.TryParse() in Python? -

parsing - DateTime.TryParse() in Python? - is there equivalent c#'s datetime.tryparse() in python? edit: i'm referring fact avoids throwing exception, not fact guesses format. if don't want exception, grab exception. try: d = datetime.datetime.strptime(s, "%y-%m-%d %h:%m:%s") except valueerror: d = none in zen of python, explicit improve implicit. strptime always returns datetime parsed in exact format specified. makes sense, because have define behavior in case of failure, maybe want is. except valueerror: d = datetime.datetime.now() or except valueerror: d = datetime.datetime.fromtimestamp(0) or except valueerror: raise webframework.servererror(404, "invalid date") by making explicit, it's clear next person reads failover behavior is, , need be. or maybe you're confident date cannot invalid, it's coming database datetime, column, in case there wont' exception catch, , ...

c++ - How to read text file into deque -

c++ - How to read text file into deque - i trying build deque of strings (in c++) txt file putting new entry in deque each line in file. below effort @ function - know while loop beingness executed proper number of times, after calling function queue empty. i'm sure i'm missing little (very new c++ syntax , workings...), , help appreciated. void read_file(string file_name, deque<string> str_queue) { ifstream filestr; filestr.open(file_name); if (!filestr.is_open()){ perror ("error opening file."); } else { while (filestr) { string s; getline(filestr,s); str_queue.push_back(s); } } } you passing queue value, not reference. seek this: void read_file(const string &file_name, deque<string> &str_queue) { c++

jQuery show ax external PHP page in a DIV -

jQuery show ax external PHP page in a DIV - possible duplicate: how show page div jquery hello have div in page index.html: <div id="form"></div> now need way jquery show page within div. page need phone call , load there contact.php simple html + php contact form. there way load jquery contents of contact.php within index.html page div is? please remember contact.php page contains javascript codes must working. propably jquery.load function not work in case. thanks help! try this: $.get("contact.php", function(data){ $("#form").html(data); }); if contact.php total page (including <html> ), should consider loading in <iframe/> . edit if $.get not work above, seek this: $.get('example.html', function(data) { var $page = $(data); $page.filter('script').add($page.find('script')).each(function(){ $.globaleval(this.text || this.textconte...

android - onDraw() efficient design for a custom view -

android - onDraw() efficient design for a custom view - i have custom view represents simple gameboard several tiles. have 2-d array stores displayed image (0 no image) tile. currently within ondraw() method loop through array , display images tiles. time invoke invalidate() without args when reset board. in other places invoke invalidate(rect) required tile needs updated. is above implementation of ondraw() in-efficiently drawing view? if improve way this? (also invoking invalidate(rect) guarantee updating 'rect' part or recommendation android may ignored?). appreciate clarifications this. is above implementation of ondraw() in-efficiently drawing view? it enough. otherwise you'd larn opengl create utilize of hardware acceleration in drawings, of depends on if tiles changing every frame or how many tiles have. also invoking invalidate(rect) guarantee updating 'rect' part or recommendation android may ignored? it updates re...

c - When daemon will hog cpu? -

c - When daemon will hog cpu? - what possible status might occur daemon pig cpu , makes scheme slow or moved non-responsive state? daemons have few threads well. a tiny fraction of reasons include: infinite loops in general low memory in general race conditions dead locks starvation spawning many threads forking much super low process priority infinite recursion algorithms of bad algorithmic complexity really slow operations on numbers something repeated (e.g. variable improve calculated outside loop compiler unable move out) cache-unfriendliness using sleep-like functions invoking slow functions running daemon on slow machine your beingness dos-attacked your machine running out of electricity , tries slow down your cpu has bug your cpu has hardware defect your cpu running @ low voltage these list items not exclusive each other. can't tell more specific without more information. c linux debugging daemon daemons

broadcastreceiver - Android send data from different activities managed by a TabHost (that has custom TabWidgets) -

broadcastreceiver - Android send data from different activities managed by a TabHost (that has custom TabWidgets) - i'm having problem communicating between activities managed tabhost. problem this: there main class extends tabactivity; in tabhost 4 screens; the 4 screens 4 different activities, managed tabhost : private void setupscreen1{ intent.setclass(this, class1.class); tabhost.tabspec spec = tabhost.newtabspec("a1") .setindicator(getstring(r.string.week_view), getresources().getdrawable(r.drawable.icon1)) .setcontent(intent); tabhost.addtab(spec); } from screen1 need alter tabhost's currenttab screen2 , send info screen2. to have 2 broadcastreceivers. --> 1 sent intent main class switch tab (in onreceive() : setcurrenttab(intent.getintextra(data, -1)); --> other 1 sent info screen2 : screen2 uses info in oncreate() title; in screen2.oncreate() there broadcastreveiver listenes info used title the ...

use a href as a var in a jquery function -

use a href as a var in a jquery function - i have function requires vars beingness appended div. 1 of vars href link onclick. how format link work in var within function? below not working. what whole purpose of is evaluate block of text. count , limit display 200 characters insert ahref link onclick before remainder of text throw span around remainder of text after link insert ahref link within span, right before closing span tag and insert of modified content in div i've taken 2 snippets of code 1) trim text, , wrap in span jquery limit text length 2) show on click, hide on click http://girlswhogeek.com/tutorials/2007/show-and-hide-elements-with-javascript and trying mash them come need. each snippet works on own. this code have now: <script type="text/javascript"> function showstuff(id) { document.getelementbyid(id).style.display = 'block'; } function hidestuff(id) { document.getelementbyid(id).styl...

javascript - Google Map - Add a marker between 2 markers -

javascript - Google Map - Add a marker between 2 markers - for web application, need allow add together marker between 2 markers. i have array of markers, , force markers when create one. my problem, don't arrive have array working. add together marker on map right position, between previous 1 , next one, but, how can force in array in right index ? add together between marker 1 , 2, so, new marker must have index 2, then, old index 2 must have index 3.... ` function addmarkerafter(i) { var lat = (markers[i].getposition().lat() + markers[(i+1)].getposition().lat()) / 2; var lng = (markers[i].getposition().lng() + markers[(i+1)].getposition().lng()) / 2; var marker = new google.maps.marker({ position: new google.maps.latlng(lat, lng), map: map, title: 'number ' + (i+1), draggable: true }); var l = markers.length; (var j=i; j<l; j++) { markers[j+1] = markers[j]; } markers[i] = marker; }` ...

How to eager load lazy-loading properties/components with NHibernate Criteria API? -

How to eager load lazy-loading properties/components with NHibernate Criteria API? - i have lazy-loading property (component) in 1 of entity classes. in hql can write "fetch properties" eagerly load it. can same criteria api? tried criteria.setfetchmode("propertyname", fetchmode.eager) not working. using nhibernate 3.1 ga nhibernate nhibernate-criteria

.htaccess - 301 Redirects problem - urls with ? and = -

.htaccess - 301 Redirects problem - urls with ? and = - i'm new 301 redirects through .htacces. i can simple redirects redirect 301 /test.html http://www.domain.com/test2.html to work have urls this redirect 301 /test.asp?group=100 http://www.domain.com/test3.html and reason these don't work. thanks. here set of rules urls have provided: rewriteengine on rewritebase / rewritecond %{query_string} =group=113 [nc] rewriterule ^group\.asp$ http://domain.dk/til-born.htm? [nc,r=301,l] rewritecond %{query_string} =product=1136 [nc] rewriterule ^product\.asp$ http://www.domain.dk/til-born/bukser.html? [nc,r=301,l] as can see query string matched separately page name. .. each of such redirects need 2 lines: rewritecond & rewriterule. the rule above exact match, means /group.asp?group=113&param=value not redirected because query string group=113&param=value more group=113 . to have such redirect working (when there optional parameter...

javascript - What makes an argument into an event object? -

javascript - What makes an argument into an event object? - as noted in this question, in function function(e){ e.stoppropogation(); } e event object. why? first , argument assumed event? if there 2 arguments? how create sec refer event instead? or simple saying function(something,x){ x.stoppropogation(); } because assume x undefined, , wouldn't expect automatically become event object virtue of having event methods called on it. for dom events, first argument (and 1 usually) event object. for frameworks, depends on implementation, maintain consistency pass event in first parameter well.. you right assume x undefined.. have @ https://developer.mozilla.org/en/dom/event javascript

html - Firebug can't see display:block attribute of an element? -

html - Firebug can't see display:block attribute of an element? - i inspecting code on page firebug: http://www.phppennyauctiondemo.com/ on top right corner, there "register" button , link within it. when select link firebug, in "style" section of firebug, can't find display:block attribute though know it's there (it can found on "computed" part of firebug says, display: block). so if links have default inline display, , hasn't been changed css, how come element has display:block? missing here? if scroll downwards style section element, you'll notice sec rule: #header .top-menu li { color: #ffffff; float: left; font-weight: 700; padding: 0.35em 0; } the float declaration turns link block element, floated elements implicitly display: block (as computed). html css firebug

html - Internet Explorer hangs on a XHTML 1.0 Strict validated web page -

html - Internet Explorer hangs on a XHTML 1.0 Strict validated web page - i've developed web page displays huge tag cloud , works pretty smooth in chrome, firefox, safari , opera. internet explorer not seem digest page , horribly hangs. notes: the page xhtml 1.0 strict validated disabling javascripts not solve problem tested on net explorer 8.0.6001.18702 should css incompatibility? have hints solve problem? update: next recommendations of answerers have updated code: - removed padding-left on .counter class - removed tag_info class you can test here. the problem seems persist question is still open. it's css issue. more specifically, padding-left on .counter class of screen.css. perhaps internal reflowing of elements causing infinite loop in ie, design wrapping elements quite bit. html css internet-explorer

security - Generating CSR on iPhone -

security - Generating CSR on iPhone - could tell me how can generate csr on iphone using security.framework? possible? have looked through manuals security cannot find it. in advance. iphone security csr

mysql - Subquery is faster? -

mysql - Subquery is faster? - if need perform complex calculation based on row data, , alias it, in query might need operate on 10 of 10000 rows because of restrictive clauses, best utilize subquery in clause, instead of using single query? an illustration easier: select *,complex_calc(t1.c10) a1 t1 c2 > 5 , c3 < 10 , c6 = 4 , c7 > 50 having a1 > 100 limit 1000; or select *,complex_calc(ta1.c10) a1 (select * t1 c2 > 5 , c3 < 10 , c6 = 4 , c7 > 50 limit 1000) ta1 having a1 > 100; which query faster? guess real question - mysql apply clauses before performing complex_calc on rows? i guess real question - mysql apply clauses before performing complex_calc on rows? yes but if closely @ queries first 1 runs complex_calc on rows satisfying clause , taking 1000 of them on secon 1 takes 1000 rows, run complex_calc on , take having a1 > 100 less 1000 rows the botton line your queries not identical in output....

java - adding item to listView after passing info through an intent in Android -

java - adding item to listView after passing info through an intent in Android - i trying add together item, first using add together button, going different activity, coming original 1 , adding in listview. can't seem have more 1 item. addscreen.class (my first activity): bundle com.painlogger; **imports** public class addscreen extends activity implements onclicklistener, onitemclicklistener { /** called when activity first created. */ button addbutton; simpleadapter adapter; list<hashmap<string, string>> painitems = new arraylist<hashmap<string, string>>(); listview listthings; int[] to; string[] from; string painlevelstring, timeofpainstring, texttreatmentstring, painlocation, row1, row2; textview paintitle; boolean myfirsttime; int k; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.addscreen); // if it's first time opening app, ...

jquery - Checkbox click event not fired -

jquery - Checkbox click event not fired - i got js (also tried "change" same result) $("input[class='tag-checkbox']").live("click",function(){ var thischeck = $(this); if (thischeck.is (':checked')){ var tag = $(this).val(); $("#tag-field").val(tag); homecoming false; } }); which should set value of checkbox <input class="tag-checkbox" type="checkbox" name="tag[]" value="' . $value['name'] . '" /> into textfield <input id="tag-field" type="text" name="product-tag" /> but event not fired , textfield unchanged. have no error messages wrong script? try using straight $(this) : $("input[class='tag-checkbox']").live("click",function(){ if ($(this).is (':checked')){ var tag = $(this).val(); $("#tag-field...

gcc - Changing compiler in Qt -

gcc - Changing compiler in Qt - how alter compiler (gcc) in qt? i've installed gcc 4.4 , 4.6. @ momment qt uses 4.4 i'd utilize 4.6. how it? in build sequence may have qmake command qmake yourproject.pro -r -spec linux-g++-64 selection of tool chain done in spec file here linux-g++-64 . find file in path-to-the-sdk/qt/mkspecs/linux-g++-64 (you concept right?)... if open spec file see includes linux spec , g++ spec. one solution re-create g++ spec file , rename g++-4.6 illustration edit , alter : qmake_cc = gcc qmake_cxx = g++ to : qmake_cc = gcc-4.6 qmake_cxx = g++-4.6 idem linux-g++-64 can copied linux-g++-4.6-64 , modify include(...) command include new g++-4.6 file. finally build project qmake yourproject.pro -r -spec linux-g++-4.6-64 . i hope it's clear :) ... qt gcc

Rake task is not called in production mode for ruby on rails 3 -

Rake task is not called in production mode for ruby on rails 3 - from controller:- call_rake :parse_venue, :venue_list_id => venue_list.id def call_rake(task, options = {}) options[:rails_env] ||= rails.env args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" } scheme "rake #{task} #{args.join(' ')} --trace 2>&1 >> #{rails.root}/log/rake.log &" end in development mode rake task triggered.. in case of production mode not triggered. ps:- inspired rake in background, railscast. there nil in rake.log file in production mode try next scheme call: system "#{args.join(' ')} rake #{task} --trace 2>&1 >> #{rails.root}/log/rake.log &" ruby-on-rails ruby-on-rails-3 rake

C# Exception Catching using try..catch blocks -

C# Exception Catching using try..catch blocks - i new c# , wanted gain improve understanding of exception catching. these questions may stupid noob questions. of import me , apologize in advance. for example, in system.io path class, getfullpath, there 5 exceptions can thrown: argumentexception, securityexception, argumentnullexception, notsupportedexception, , pathtoolongexception. understand grab blocks must organized specific exception caught first , general exception caught last. question 1: when msdn provides info on possible exceptions thrown class, how know exception specific , to the lowest degree specific? in other words, how determine exception order specific to the lowest degree specific msdn gives me? question 2: need grab exceptions explicitly or using general exception grab other exceptions well? example, still using path class, need ... try { ... } catch(system.argumentnullexception ane) { ... } catch(system.notsupportedexception nse) { ... } catch(...

Android - doing backgroud work every few minutes -

Android - doing backgroud work every few minutes - i need write application background work every few minutes. question how can start work service. need create using threads , calculating time using scheme utils or maybe there improve solution? you can utilize handler , postdelayed method: handler handler = new handler(looper.getmainlooper()); handler.postdelayed(new runnable() public void run() { // work } }, minutes * 60 * 1000); if interval sufficiently long can consider using alarmmanager . android android-service

WxPython with Eclipse -

WxPython with Eclipse - i have installed wxpython , eclipse. configuration of pydev done in eclipse. importing wx bundle working, unable utilize of wx references. for illustration wx.app() throwing error message "undefined variable import". can 1 please help me? new wxpython , eclipse. did seek adding wxpython forced builtins? see http://pydev.org/manual_101_interpreter.html#id1 eclipse wxpython

c# - How to cancel create an cativity action on ms crm 4.0? -

c# - How to cancel create an cativity action on ms crm 4.0? - i have plugin activity. on pre create check few conditions , if true throw operationcanceledexception stop create execution. but record saved, why? how can cancel creation? tried throw invalidpluginexecutionexception, it's stil executed.. the code: public void execute(ipluginexecutioncontext context) { seek { switch (context.messagename) { case "create": if (context.stage == messageprocessingstage.beforemainoperationoutsidetransaction) { bool shouldnotcreateactivity = create(context, service); if (shouldnotcreateactivity) throw new operationcanceledexception(); } if (context.outputparameters.properties.contains("id")) { //continu...

opengl es - How can I call eglSwaptInterval using AndroidNDK? -

opengl es - How can I call eglSwaptInterval using AndroidNDK? - i need set interval in eglswapinterval 0 application, need know egldisplay this. phone call supported in android, , if how can phone call using glsurfaceview (or need phone call native code?) okay, have managed phone call native side, (i cannot find way phone call java): eglswapinterval(eglgetcurrentdisplay(), 0); i assuming don't need phone call eglswapbuffers myself, seems happening somewhere android system. opengl-es android-ndk swap

Unable to write xml file in iphone? -

Unable to write xml file in iphone? - i new iphone developer, in application can read info xml file unable add together node xml , unable modify existing node values,any 1 have thought adding nodes existing xml , modify existing xml values , save.please help me. ex: my xml file raj 20000 add nodes like: raj 20000 hyd //add new node name address or raj 20000 </employee> <employee> // add together employee existing xml file <name>rani</name> <sal>10000</sal> </employee> modify xml: sai //change name , save 20000 </employee> thanks in advance iphone

python 3.2 installed, but MAC didn't recognize it -

python 3.2 installed, but MAC didn't recognize it - i installed python 3.2 edition, when opened wingide, mac still show old edition phthon 2.6.1. tried utilize "configure python"-enter python3.2 in "python executable", found nil changed, python 2.6.1 still appeared in wingide. suggestion? i tried launch wingide 1 time again , time indicates python 3.2, newest edition installed. hmmmm, funny, didn't alter , recognized now! when utilize terminal, still recognize python 2.6. is python3.2 in path? seek typing "python3.2" @ command line , see if works. python3.2 located? it's /usr/bin/python3.2 seek using in wingide , see if works. python

displaying save file dialog in ASP.NET -

displaying save file dialog in ASP.NET - i'm going display save file dialog in asp.net web page, user clicks button , save file dialog appears allows user save study in csv format in hard disk, how can it? possible display save file dialog in asp.net? thanks to this, you'll want create whole new page (or, better, *.ashx handler) serve csv results. button should post request page. when receives request, in either processrequest() method (for handler) or page_load() method (for page), have code this: response.clear(); response.contenttype = "text/csv"; response.addheader( "content-disposition", "attachment;filename=\"report.csv\"" ); // write csv info response.outputstream here response.end(); asp.net

Strip Leading and Trailing Spaces From Java String -

Strip Leading and Trailing Spaces From Java String - possible duplicate: trim whitespace string? is there convenience method strip leading or trailing spaces java string? something like: string mystring = " maintain "; string stripppedstring = mystring.strip(); system.out.println("no spaces:" + strippedstring); result: no spaces:keep mystring.replace(" ","") replace space between maintain , this. thanks you can seek trim() method. string newstring = oldstring.trim(); take @ javadocs java string replace

encoding - C#/Why does Get html returns random junk characters? -

encoding - C#/Why does Get html returns random junk characters? - i have ex: link this code: const string nick = "alex"; const string log = "http://demonscity.combats.com/zayavka.pl?logs="; foreach (datetime cd in daterange) { string str = log + string.format("{0:mm_dd_yy}", cd.date) + "&filter=" + nick; string htmlcode = wc.downloadstring(str); } returns something...."‹\b\0\0\0\0\0\0я•xysЫЦ~зЇёѕ™d)bг.тbҐ$ЪrЖ’<2Уn&сh@р ’„\f\0j–—_Фџђ§¤нt¦г6ќѕУЄђ0’iqtТґcµо№x(jі-Щ/Ђі|g?`yҐ¶ц" other links works fine. think problem codepage, how can prepare it? or it's server problem? the issue response gzip-compressed (response has content-encoding: gzip header). need first decompress it, you'll able read it: public class stackoverflow_6660689 { public static void test() { webclient wc = new webclient(); encoding encoding = encoding.getencoding("windows-1251"); byte[] ...

php - How can I stop str_replace replacing only part of a filename? -

php - How can I stop str_replace replacing only part of a filename? - i'm going through html file replacing references external files new ones, however, results in errors. for example: want replace instances of styles.css 1.css , instances of iestyles.css 2.css in source code: <html> <link href="styles.css" /> <link href="iestyles.css" /> </html> once i've run str_replace("styles.css", "1.css", $html); source code looks this: <html> <link href="1.css" /> <link href="ie1.css" /> </html> so when run sec query, doesn't alter iestyles.css reference because no longer exists. there way around this? guess invent elaborate regular expression, there lot of variables consider because not code formed. cheers just alter order: first replace iestyles.css 2.css , replace styles.css 1.css . if sure filename thing within href -attr...

javascript - POST Request Issue in ExpressJS -

javascript - POST Request Issue in ExpressJS - i'm working nodejs , i'm working on letting users upload files. right though i'm having lot of problem trying simple post request. over in index.ejs file have code creates form , sends post request: <div id="uploaddiv">upload things here<br> <form action="/upload" enctype="multipart/form-data" method="post"> <input type="text" name="title"><br> <input type="file" name="upload" multiple="multiple"><br> <input type="submit" value="upload"> </form> </div> then in server.js, have code handles uploading. var server = express.createserver(); //bunch of stuff left out server.get('/upload', function(req, res) { console.log("uploading!"); if (req.method.tolowercase() == 'post') { res.write('lol'); } }); my problem...

regex - JavaScript match function seems to halt script -

regex - JavaScript match function seems to halt script - yesterday 'hnatt' kind plenty offer regex portion of script : <html> <body> <script type="text/javascript"> alert("hhhhhh yadad example.com/check?x=asdfasdf bsss ffhhh".match(/example.com\/check\?x\=([^\s]*)/)[1]); alert('alert 2'); </script> </body> </html> now have new question/problem/point_of_confusion. if alter 'example.com' not match, entire script stops. know solution other try/catch permits script go on forward. (although, hacked prepare try/catch, insertion of seek catch/breaks larger script... don't know why. why want solution not comprised of try/catch). seek understand why halsting happens when 'match' function not find match. <html> <body> <script type="text/javascript"> alert("hhhhhh yadad exampletwo.com/check?x=asdfasdf bsss ff...

machine learning - Ways to improve Image Pixel Classification -

machine learning - Ways to improve Image Pixel Classification - here problem trying solve: goal classify pixels of colored image 3 different classes. we have set of manually classified info training purposes pixels not correlate each other (each have individual behaviour) - classification on each individual pixel , based on it's individual features. 3 classes approximately can mapped colors of red, yellowish , black color families. we need have scheme semi-automatic, i.e. 3 parameters command probability of presence of 3 outcomes (for final well-tuning) having in mind: which classification technique choose? what pixel features utilize classification (rgb, ycc, hsv, etc) ? what modification functions take well-tuning between 3 outcomes. my first seek based on naive bayes classifier hsv (also tried rgb , ycc) (failed find proper functions well-tuning) any suggestion? thanks for each pixel in image seek using histogram of colors n x n window around...

c# - Using LInq to SQL to get all the user email from ASP.NET Membership -

c# - Using LInq to SQL to get all the user email from ASP.NET Membership - public actionresult downloadmembers() { membershipusercollection users = membership.getallusers(); var grid = new webcontrols.gridview(); grid.datasource = members in users // users gives error select new { name = members.firstname, // doesn't works email = members.email // doesn't works }; grid.databind(); response.clearcontent(); response.addheader("content-disposition", "attachment; filename=" + "members" + ".xls"); response.contenttype = "application/excel"; stringwriter sw = new stringwriter(); htmltextwriter htw = new htmltextwriter(sw); grid.rendercontrol(htw); response.write(sw.tostring()); response.end(); homecoming redirecttoaction("index"); } hi above ...

javascript - document.getElementById returning element in firefox but not chrome -

javascript - document.getElementById returning element in firefox but not chrome - i trying dynamically load coverflow type object (think itunes coverflow less fancy) on button click after webpage has loaded. dynamically creating list of images feed javascript coverflow loads them , it's magic create pretty. problem in firefox code working, in chrome , ie (surprise surprise) javascript throwing error , page going blank due error throw below. problem in block of code trying capture dom element id if (typeof(this.container) == 'string') { // no node var container = document.getelementbyid(this.container); if (container) { this.container = container; } else { throw ('contentflow error: no element id \''+this.container+'\' found!'); return; } } pretty much in chrome dome element not captured code above when available in page. typed out document.getelementbyid("container_name"); in console...

How can i remove a click event from an element in Javascript? -

How can i remove a click event from an element in Javascript? - i have div element has click event attatched using follwing code: var id = "someid"; var elem = document.getelementbyid("elemid"); elem.addeventlistener("click", function() { somefunction(id); }, false); at later point re-create element , add together part of dom, need first remove click event var elem = document.getelementbyid("elemid"); elem.removeeventlistener("click", ???? , false); i'm not sure how refernece listener , far nil have tried has removed event element. ideas? cheers stewart move anonymous click handler function out of addeventlistener call: var id = "someid"; var elem = document.getelementbyid("elemid"); var elemeventhandler = function() { somefunction(id); }; elem.addeventlistener("click", elemeventhandler , false); after should able to: var elem = document.getelementbyid("...

linux - How to disable graphical console after kernel boot? -

linux - How to disable graphical console after kernel boot? - i have linux kernel booting up. comes in native screen size graphical framebuffer mode due utilize of kernel mode setting. during kernel boot, screen shifts text graphical console mode , lots of kernel messages dumped. 1 time command handed first userland program, i'd programme able disable graphical console output. how do that? add vga=0 kernel options forcefulness text mode. linux kernel

MATLAB neural nets: trainbfg problems when using a custom performance function -

MATLAB neural nets: trainbfg problems when using a custom performance function - i have written own custom performance function, cross entropy function modifications, called augmented cross entropy function. my performance function itselft sum of 2 functions: cross entropy function f , penalty function p, formula given below: where b , vectors e1 , e2 constants , w weight matrix ( i hidden layer neurons, j input layer neurons). i've implemented dy , dx derivatives, not beingness sure dx derivative (where x result of getx function - holds weight , bias information). assumed dx derivative of performance function weight wij equal derivative of penalty function: then started training neural network trainbfg function , found out not larn anything. message "line search did not find new minimum". trainbfg description: each variable adjusted according following: x = x + a*dx; dx search direction. parameter selected minimize performance along...

hibernate - Spring form controller: unable to save relations in form controller -

hibernate - Spring form controller: unable to save relations in form controller - i have 3 tables user, role , userrolerelationships (many-to-many bring together table). in service have no problem editing user , saving relating roles, i'm not able in controller. expected behaviour in service: hibernate: update dbo.users set username=?, password=?, email=?, workphone=?, privatephone=?, fullname=? userid=? hibernate: update dbo.userroles set role=? roleid=? hibernate: update dbo.userroles set role=? roleid=? but behaviour in controller are: hibernate: update dbo.users set username=?, password=?, email=?, workphone=?, privatephone=?, fullname=? userid=? hibernate: delete userrolerelationships userid=? my controller looks like: @requestmapping(value = "/usermanagement/edit/{userid}") public modelandview initupdateform(@pathvariable string userid, modelmap model) { model.addattribute("user", iwusermanagementservice.getuser(integer.valueof(u...

What happens when my Java applet runs on older Java versions, but uses new classes? -

What happens when my Java applet runs on older Java versions, but uses new classes? - i creating applet embed in html page. applet uses grouplayout class, found in java se 6, not in 5. when computer runs java 5 or before opens html page, happen? applet not run properly? it throw classdefnotfounderror. avoid not utilize new api or utilize 3rd party api or "still" grouping layout: take class, alter package, include project , utilize it. can better. create instance dynamically using class.forname(). if succeeds utilize standard implementation, otherwise utilize stolen class. can because typically can utilize standard layoutmanager's api without using api of specific class loader. java applet compatibility grouplayout

jquery - Get Relative Loudness of Song, Javascript -

jquery - Get Relative Loudness of Song, Javascript - i'm trying build mp3 player site using javascript (and plugins/frameworks(jquery)/libraries relevant) & html5. built player (more accurately, implemented jplayer), and want create visualizer. ok maybe it's not visualizer (all names ways visualize sound confused me), guess want this: or graphs amplitude (loudness) of mp3. so start, know api can this? if don't that's ok; guess i'll build own. need know: does know way amplitude/loudness of mp3 @ given point using javascript? edit changed question php: visualization of mp3 - php you need able decode mp3 yourself. html5 sound element, , browsers's implementations of it, don't expose sort of data. example, @ firefox's exposed methods javascript. closest thing want "volumechange" event. in reference volume mixer on browser's rendered command (i.e. output volume). has nil actual db of sound source. i imagin...

Getting all the active jobs from Quartz.NET scheduler -

Getting all the active jobs from Quartz.NET scheduler - how can active jobs scheduled in quartz.net scheduler? tried getcurrentlyexecutingjobs() returning 0. that method doesn't seem work. solution had found loop through jobs: var groups = sched.jobgroupnames; (int = 0; < groups.length; i++) { string[] names = sched.getjobnames(groups[i]); (int j = 0; j < names.length; j++) { var currentjob = sched.getjobdetail(names[j], groups[i]); } } when job found means still active. if set job durable, though, never deleted if there no associated trigger. in situation code works better: var groups = sched.jobgroupnames; (int = 0; < groups.length; i++) { string[] names = sched.getjobnames(groups[i]); (int j = 0; j < names.length; j++) { var currentjob = sched.getjobdetail(names[j], groups[i]); if (sched.gettriggersofjob(names[j], groups[i]).count() > 0) ...

iphone - Unable to obtain content from website using Hpple -

iphone - Unable to obtain content from website using Hpple - i trying parse website using hpple. successful tag doesn't seem work on other tag. please advice. this code used. nsdata *htmldata = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:@"http://www.mywebsite.com/"]]; tfhpple *xpathparser = [[tfhpple alloc] initwithhtmldata:htmldata]; nsarray *elements = [xpathparser search:@"//tr/td"]; tfhppleelement *element = [elements objectatindex:0]; nsstring *mytitle = [element content]; nslog(mytitle); mlabel.text = mytitle; [xpathparser release]; [htmldata release]; this website source code trying parse from. <tr><td bgcolor="#f7f7f7" align="left" width="200" valign="middle" class="font1">title of speech</td><td bgcolor="#f7f7f7" align="left" width="150" valign="middle" class="font3">speaker name</td><td ...

c# - How to refactor highly repetitive reading sections from config files -

c# - How to refactor highly repetitive reading sections from config files - i need convert multiple sections of config file dictionaries. values of dictionaries have different types. next 2 classes work, identical: public class intconfigsection { private static readonly ilog log = logmanager.getlogger(typeof(intconfigsection)); public static dictionary<string, int> loadsection(string sectionname) { var ret = new dictionary<string, int>(); seek { var offsetshash = (hashtable)configurationmanager.getsection(sectionname); foreach (dictionaryentry entry in offsetshash) { ret.add((string)entry.key, int.parse((string)entry.value)); } } catch(exception e) { log.errorformat("loadsection:" + e); } homecoming ret; } } public class stringconfigsection { private static readonly ilog log = logmanager.getlogg...