Posts

Showing posts from April, 2015

Is .NET DateTime buggy using ToString("U")? -

i have next simple code... console.writeline(default(datetime).date.tostring("u")); the, emitted text (i have spanish language installation): "lunes, 01 de enero de 0001 3:00:00" why starts @ 3 hours, instead of 0? bug? well unless you've got time machine or datetime really buggy, that's not output of code posted, uses datetime.now . i suspect code really using datetime.minvalue (or new datetime() ), , reason you're seeing 3am (as per documentation ): the pattern same "f" pattern. however, datetime value automatically converted utc before formatted. so suspect you're in time zone midnight on january 1st 0001 local time 3am utc. ( datetimezone.minvalue has "kind" of unspecified , treated local when asked convert utc. datetime bit of mess around area.)

css - jquery menu error displays block rather than inline on click -

i've created dropdown menu using jquery, displays inline how want display , once clicked display other options. once click on link appears put li tag blocks. anyone have ideas why doing this?? html <!-- navigation bar start --> <div id="navbar"> <!-- england nav bar start --> <li id="engmainnav"><a href="#">england</a> <ul id="engsubnav"> <li class="engli"><? echo $this->html->link('news', array('controller'=>'premiership', 'action' =>'news')); ?></li> <li class="engli"><? echo $this->html->link('results/fixtures', array('controller'=>'premiership', 'action' =>'resultsfixtures')); ?></li> <li class="engli"><? echo $this->html->link('teams', array('controller'=>'premiership', 'action...

windows 8 - Semantic zoom with grouped items for the zoomed-out view in a Javascript Metro application -

i'm adding semantic zoom application , i'm having issues data binding in zoomed out listview. in normal (zoomed in) listview i'm binding grouped data , renders fine. zoomed out listview render same grouped data (same itemdatasource , groupdatasource) , different itemtemplate , grouptemplate (the same normal view smaller). the problem i'm having when zoom out error @ ui.js line 2117 saying "0x800a138f - javascript runtime error: object.defineproperty: argument not object". i've tryed binding zoomed out listview itemdatasource property groups.datasource collection , not set groupdatasource property (like examples found on web) , works fine. why zoomed out view not rendering grouped items normal view? edit: seems zoomed out view behaves in different way normal (zoomed in) listview. while zoomed in view accepts both itemdatasource , groupdatasource, zoomed out view accepts itemdatasource. edited microsoft official semantic zoom sample (scenario2.html) ,...

perl - "Connection refused" error on socket_connect in php -

i trying convert code perl php. perl code looks below: my $handle = connect($port, $host); and trying use socket same thing in php. have tried socket_create , socket_connect, socket_create , socket_bind, , fsocketopen. as result, i'm stuck error messages saying "connection refused" or "permission denied": socket_connect() [function.socket-connect]: unable connect [111]: connection refused in i not sure if problem need solve, or problem of permission because code in perl works fine (i did not write code). my php code looks below: $socket = socket_create(af_inet, sock_stream, sol_tcp); if(!$socket){ die('error: socket_create()'); } if(!socket_connect($socket,$host,$port)) { die('error: socket_connect()'); } i'm not 1 manages server, need ask else access if permission issue. should ask specifically? or should use other function connect server? new perl, not sure if socket_connect equivalent function use or not. thanks. if perl ...

javascript - Why popstate doesn't fire in Firefox -

i have html page. on chrome, if click several time in button2 , click on navigator button <html> <head> <script> function button_onclick(){ var stateobj = { foo: "bar" }; history.pushstate(stateobj, "page 2", "bar.html"); } function onpopstate(){ console.log("location: " + document.location + ", state: " + json.stringify(event.state)); } window.addeventlistener('popstate', onpopstate, false); </script> </head> <body> <button type="button" onclick="button_onclick()">button 2</button> </body> </html> i can see in console: location: http://somedomain:8080/examples/bar.html, state: {"foo":"bar"} if try firefox don't see nothing? tested firefow 13.0.1 pretty annoying if want manage history using html5 history api found on question , helped me : popstate isn't supposed called when click link. it's called when user...

xcode - Adding Google Objective-C API 'GTL' to iPhone project -

Image
how add google drive api iphone project can use it? so far, have dragged gtl project current app project (so nested under app project). then, under app target's build phases, added gtl.framework, , added gtl.framework 'link binary libraries' (see attached pic). throws following error: clang: error: no such file or directory: '/users/xxx/library/developer/xcode/deriveddata/golf-hfbczyaemhyzgvbrtgdxqnlzeuaa/build/products/debug-iphonesimulator/gtl/gtl' how fix this? i struggled error message well. how solved it: make sure have added folder service using under gtlsource/common/ (e.g., add drive folder googledrive). under gtl.xcodeproj (that have added workspace) find gtlsource folder , drag main project (golf in case). done! now can remove references gtl.xcodeproj have added workspace. with approach, don't need add libraries (so remove them list of linked libraries if have added them). the google api documentation nothing apple's documentation (it...

excel - Macro to insert 19 rows every nth row? -

i want insert 19 rows every 58 rows. macro inserts 1 single row , can't seem insert 19. sub insert58() dim rng range set rng = range("a3") while rng.value <> "" rng.offset(58).entirerow.insert set rng = rng.offset(59) wend end sub use rng.offset(58).resize(19).entirerow.insert

eclipse cdt juno c++ -

i'm having problem eclipse juno c++. if choose 'build on save', keeps building on , on though files had changed. is bug encounter too, or configuration not proper ? this configuration, don't have behavior, @ least following eclipse on mac: eclipse ide c/c++ developers version: juno release build id: 20120614-1722

python - Finding if a plist contains a key with a specific string -

below have xml/plist file (you may recognize .tmtheme): <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple computer//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict> <key>settings</key> <array> <dict> <key>name</key> <string>comment</string> <key>scope</key> <string>comment</string> <key>settings</key> <dict> <key>foreground</key> <string>#75715e</string> </dict> </dict> <dict> <key>name</key> <string>string</string> <key>scope</key> <string>string</string> <key>settings</key> <dict> <key>foreground</key> <string>#e6db74</string> </dict> </dict> </array> </dict> </plist> i'm trying find if ...

javascript - Tracking facebooklike button on my website -

i have video in site before playing video, visitor must facebook page. problem when come website not see video again because button in inactive. i'm using javascript. thank understanding , i'm waiting help function setcookie(c_name, value, expiredays) { var exdate = new date(); exdate.setdate(exdate.getdate() + expiredays); document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.togmtstring()); } function getcookie(c_name) { if(document.cookie.length > 0) { c_start = document.cookie.indexof(c_name + "="); if(c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexof(";", c_start); if(c_end == -1) c_end = document.cookie.length; return unescape(document.cookie.substring(c_start, c_end)); } } return ""; } function lecture_vid() { var cc = '<iframe class="youtube-player" type="text/html" width="640" height=...

php - Joomla URL redirect -

i've got question here joomla redirection. . got joomla site has bug. each time visit site, redirects other site. . when put www.site.com/index.php , it's ok. on >ndex.html## there's meta: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="refresh" content="0;url=http://redirectto.com/"> but if removed or change meta, site got error. . anyone can helpe problem?? joomla not use index.html anywhere - though there such file in every folder, it's supposed empty security reasons. can't sure if you've installed puts code in index.html reason, i've never seen before. re-reading, looks apache config defaulting index.html, when should defaulting index.php. check apache config, or put htaccess file in joomla folder this, or joomla isn't work anyways - needs default index.php

html - Change :hover CSS properties with JavaScript -

i need find way change css :hover properties using javascript. for example, suppose have html code: <table> <tr> <td>hover 1</td> <td>hover 2</td> </tr> </table> and following css code: table td:hover { background:#ff0000; } i use javascript change <td> hover properties to, say, background:#00ff00. know access style background property using javascript as: document.getelementsbytagname("td").style.background="#00ff00"; but don't know of javascript equivalent :hover. how change these <td>'s :hover background using javascript? your appreciated! pseudo classes :hover never refer element, element satisfies conditions of stylesheet rule. need edit stylesheet rule , append new rule , or add new stylesheet includes new :hover rule. var css = 'table td:hover{ background-color: #00ff00 }'; var style = document.createelement('style'); if (style.stylesheet) { style.stylesheet.cs...

asp.net - Use a DDL to select records in a gridview VB.NET -

i've got simple ddl values 1, 2, 3. i have gridview boundfield datafield="cycle" i want pick value drop down list , want update gridview show records cycle = picked value. i'm doing instead of using textbox submit button. when have connection string setup, can test query , works, can't selected/updated value of drop down list change gridview. thanks, bill you need handle ddl aka combobox selectedindexchanged event. in event query db fetching data based on selecteditem value.

PHP- Typo on tutorial? -

i followed phpacademy tutorial on youtube , can't keywords print via echo. instead get: `keywords` '%keyword%' wth? code has been copied verbatim. platform problem? is there issue on statement -> $where .= " keywords like '%keyword%'"; ? <?php include 'db.inc.php'; function search_results($keywords) { $returned_results=array(); $where=""; $keywords=preg_split('/[\s]+/', $keywords); $total_keywords = count($keywords); foreach($keywords $key=>$keyword){ $where .= "`keywords` '%keyword%'"; // where's issue? if($key != ($total_keywords-1)){ $where .= " , "; } } echo $where; } ?> i did bit of refactoring on code, it's more clear. see comments in code. include 'db.inc.php'; function search_results($keywords) { $where = array(); // skip empty results preg_split_no_empty flag $keywords = preg_split('/[\s]+/', $keywords, -1, preg_split_no_empty); foreach ($keywords ...

c# - Problems with accents on page -

i've asp.net not displaying accents correctly. instead of direção hidráulica\elétrica i'm getting: direção hidráulica\elétrica . i've tried unsuccessfully: by using html on head tag: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> by using c#.net : response.charset = "utf-8"; and on top of .aspx page: <%@ page codepage="65001" language="c#" .. i've no idea how fix this. appreciated. in advance. the problem here using invalid encoding. convert text html entities you can use utf-8 in html converting characters html entities . online converter located here: http://konieczny.be/unicode.html this resulting string (remove spaces between &, stackoverflow automatically converts it): dire& #231;& #227;o hidr& #225;ulica\el& #233;trica save file utf-8 the reason why getting strange characters because saving file ansi. assuming using notepad, go file -...

crash - How do I use addr2line for Android? -

my code (a game using andengine physicsbox2dextension on android) crashing , has been suggested use addr2line, have absolutely not idea how , many "tutorials" i've looked @ extraordinarily vague. perhaps give me step step instructions? i'm using windows 7 , eclipse indigo. i've downloaded android ndk r8 , saved c:\program files (x86)\android ndk\android-ndk-r8. project saved c:\users\reese\workspace\testgfx5. the stacktrace: 07-06 13:25:27.469: i/debug(19582): #00 pc 00011f74 /system/lib/libc.so 07-06 13:25:27.473: i/debug(19582): #01 pc 0001921e /system/lib/libc.so 07-06 13:25:27.473: i/debug(19582): #02 pc 00026558 /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so 07-06 13:25:27.473: i/debug(19582): #03 pc 00013e7c /data/data/com.prattia.webs.testgfx5/lib/libandenginephysicsbox2dextension.so 07-06 13:25:27.473: i/debug(19582): #04 pc 00016e34 /system/lib/libdvm.so beyond that, i'm lost. please? use ndk-stack instead. sav...

c# - How to display login form again after invalid login? -

how can redirect login form in win form application after invalid login write trying in program.cs application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); // application.run(new frmlogin()); frmlogin fm = new frmlogin(); fm.showdialog(); if (fm.dialogresult == dialogresult.ok && global.login) application.run(new mdiparent1()); else if(fm.dialogresult==dialogresult.cancel) { messagebox.show("wrong username or password"); application.run(new frmlogin()); //fm.showdialog(); } on frmlogin implementation check validity , show message box: // in frmlogin.cs if(/* loginn valid*/) { this.dialogresult = dialogresult.ok; this.close(); } else { messagebox.show("wrong username or password"); }

c# - Tables from second schema are not visible in Entities Wizard -

i want add ado.net entity data model project. using oracle database , oracle odp.net connect database. i need query 2 schemas. configured connection use 2 different schemas (using information found in another question ). the tables visible in server explorer. not visible in ado.net entity data model adding wizard. shows tables first schema , have schema name in front: tablename(schemaname). what must see tables both schemas? this known bug. suffer , @ 1 point went away, has returned me. oracle aware of , fix next odac release. see here thread concerning it: https://forums.oracle.com/forums/thread.jspa?messageid=10396897 reply oracle employee: posted: may 2, 2012 3:53 pm we've been able reproduce bug @ oracle , investigating solution. hope include bug fix in next release.

php - Uploading image part by part -

is there way upload image part part via php ? mean virtually drawing grid on image , uploading our desired sell of image . you can try sending in chunks via converting bytearray , reassembling them @ other end

vb.net - Crystal reports error in asp.net vb where no crystal reports needed -

i getting following 7 errors in asp.net(vb) website.they occurred after added reference microsoft office 12.0 object library per this post in attempt read individual excel sheet cells. whole website fails build. surprising thing why getting error related crystal report when not need in project? here 7 errors: error unknown server tag 'cr:crystalreportviewer'. c:\users\ssaa\documents\visual studio 2010\websites\dpp2012\aspnet_client\system_web\4_0_30319\crystalreportviewers13\preview.aspx 130 error not load file or assembly 'crystaldecisions.web, version=12.0.2000.0, culture=neutral, publickeytoken=692fbea5521e1304' or 1 of dependencies. system cannot find file specified. c:\users\ssaa\documents\visual studio 2010\websites\dpp2012\aspnet_client\system_web\4_0_30319\crystalreportviewers13\preview.aspx 3 error not load file or assembly 'crystaldecisions.reportsource, version=12.0.2000.0, culture=neutral, publickeytoken=692fbea5521e1304' or 1 of dependencies. sy...

Recieve real-time Asterisk AMI events on rails app Outside of Adhearsion -

i have rails application i'am trying real time events asterisk through ami. i created script originate calls adhearsion source code without creating new adhearsion project. i created class extending adhearsion's managerinterface class , overriding event_message_received method. rails cli if calls , press enter 2 or 3 times event have intervene it. here code : class astercall < adhearsion::voip::asterisk::manager::managerinterface def initialize super(:host => "host", :username => "username", :password => "password", :events => true) connect! end def self.click_call(number, exten, name) # asterisk = connect() originate(:channel => "sip/#{exten}", :context => "from-internal", :exten => number, :priority => "1", :caller_id => "calling #{name}") end def event_message_received(event) if(event.kind_of? adhearsion::voip::asterisk::manager::managerinterfaceevent ) puts event.inspec...

php - Why is $x a undefined variable for switch statement? -

it display $x undefined. wrong switch statement? http://localhost/add.php?price_error=1 switch(isset($_get['price_error']) && $_get['price_error'] == $x){ case 1: echo '<span class="error_msg">discount price cannot greater original price</span><br/>'; break; case 2: echo '<span class="error_msg">discount cannot less 30% of original price</span><br/>'; break; case 3: echo '<span class="error_msg">discount price , original price cannot greater $30000 hkd</span><br/>'; break; default: false; break; } switches typically have variable parameters. try: if(isset($_get['price_error']) && $_get['price_error'] == $x){ switch($x){ //code } }

How can I split a big XML file into smallers with PHP? -

i have xml file on 300 000 entries script has parse each day.. the xml structure : <root> <item> <proper1></proper1> <proper2></proper2> </item> </root> i need split big xml file smaller files php can run them, cant proccess because uses memory. can 1 me ? please take @ article php xml parsing sax parsing xml reader xmlreader pull parser will best suited job read above article try code answer

java - Abstract class vs interface when sharing an attribute -

i have few classes same "level" in subtype hierarchy. need create id each instance , having parent class, containing static long , increment every instance of subclass. 75% of code subtypes same- made me prefer use abstract class (over interface) as: 1) can declare static variable id creator 2) can put code in parent class , share amongst subtypes is correct? seem use interfaces. should use interfaces when subtypes need same methods, different implementations , when not need initialize attribute shared across subtypes (like id creator)? i had been given impression colleagues interfaces preferred inheritance. if have more 1 group of classes need id generation, wouldn't advise using inheritance because constrains reuse. in case why not build separate abstraction provides service of unique id generation? you'd give key , give id unique across invocations using same key. public class idgenerator { private idgenerator() {} // no instantiation or subclassing priv...

ejb 3.0 - jsf secure tranport mechanism -

i have been working on simple jsf secure transport mechanism configured https constraints set confidential in web.xml.now, wanted select particular page secure transport. have login page takes me page.login page takes user name , password , should transport on secure layer ejb verifies authenticity before displays requested page.now when use url pattern /faces/pagetoview.xhtml requested page in web.xml, funny behaviour dont understand.first, when login, pagetoview.xhtml displays without https , when click go pagetoview2.xhtml first pagetoview.xhtml redisplays https. not other pages navigate displays https though had not configure them secure transport. need know right way configure secure transport behaviour particular page. in advance. the way seems when go https, , you're going on login page, stay on https. seemed me big overhead application limited security requirements on looking consensus big risk session hijacking. if had 2 secure pages login & shopping , other pages...

sockets - C sendfile and then other text -

this snippet of client code: while(((uint32_t)total_bytes_read != fsize) && ((nread = read(sockd, filebuffer, sizeof(filebuffer))) > 0)){ if(write(fd, filebuffer, nread) < 0){ perror("write"); close(sockd); exit(1); } total_bytes_read += nread; } memset(buffer, 0, sizeof(buffer)); if(recv(sockd, buffer, sizeof(buffer), 0) < 0){ perror("errore ricezione 226"); close(sockd); exit(1); } printf("%s", buffer); memset(buffer, 0, sizeof(buffer)); if(recv(sockd, buffer, sizeof(buffer), 0) < 0){ perror("errore ricezione 221"); close(sockd); exit(1); } printf("%s", buffer); close(fd); where first receives file , listen 2 server's messages. here snippet of server: offset = 0; rc = sendfile(newsockd, fd, &offset, filestat.st_size); if(rc == -1) { fprintf(stderr, "errore durante l'invio di: '%s'\n", strerror(errno)); onexit(newsockd, sockd, fd, 3); } if((uint32_t)rc != fsize) { fprintf(stderr, ...