Posts

Showing posts from June, 2010

matlab - "Translating" the parameters of a saved FANN network -

i training neural network using fann library , find library pretty impressive. problem when tried "export" (manually) weights , formation of network simulate in matlab going wrong... while fann tells me have mse of 4-5% when try simulate in matlab it's around 80%! i believe i'm missing when i'm trying translate/map attributes of network saved file. can have , please me? the saved .net file fann produces, .xls files put weights matlab scripts in case want test here : http://users.isc.tuc.gr/~spapagrigoriou/network/ .

html - How to add line feed in <s:textarea> -

hi using struts 2 ui. limit number of characters in row 16 , have restrict maxlength 32. tried row , column attirbute. not working.also have restrict resizing of textarea. possible solutions? perhaps had typo? attributes "rows" , "cols", not "row" , "column". the following should work: <s:textarea key="yourdatafield" cols="32" rows="16" resizable="false"/>

vim - Vimscript: How can I get the Operating System version? -

even though it's similar this , this question need know current version of operating system while vim running. previous questions don't me since describe feature set of executable; need function return os version either name or number (e.g. listed in widows version chart ). is there one? i don't know windows on mac os x can do: $ sw_vers -productversion and on ubuntu can do: $ lsb_release -rs this quick hack seems work, you'll have adapt needs: function! getsysversion() let os=substitute(system('uname'), '\n', '', '') if os == 'darwin' || os == 'mac' let sys_version=substitute(system('sw_vers -productversion'), '\n', '', '') elseif os == 'linux' let sys_version=substitute(system('lsb_release -rs'), '\n', '', '') endif echo sys_version endfunction

python - Create set of random JPGs -

here's scenario, want create set of random, small jpg's - anywhere between 50 bytes , 8k in size - actual visual content of jpeg irrelevant long they're valid. need generate thousand or so, , have unique - if they're different single pixel. can write jpeg header/footer , random bytes in there? i'm not able use existing photos or sets of photos web. the second issue set of images has different each run of program. i'd prefer in python, wrapping scripts in python. i've looked python code generate jpg's scratch, , didn't find anything, pointers libraries good. if images can random noise, generate array using numpy.random , save them using pil's image.save . this example might expanded, including ways avoid (very unlikely) repetition of patterns: import numpy, image n in xrange(10): = numpy.random.rand(30,30,3) * 255 im_out = image.fromarray(a.astype('uint8')).convert('rgba') im_out.save('out%0...

c# - File upload not triggering handler? -

i'm not sure why, handler isn't getting triggered. (i'm still new silverlight way.) following tutorial here . i'm not sure did wrong... thanks. [using silverlight 3.0, vs2008] mainpage.xaml <usercontrol x:class="multiselectfileuploader.mainpage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designwidth="640" d:designheight="480"> <grid x:name="layoutroot"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> <rowdefinition height="auto"/> </grid.rowdefinitions> <textbox x:name="tbul...

java - In JSF, a custom exception thrown by called EJB is seen as EJBTransactionRolledBackException or NullPointerException or ServletException -

Image
here's problem: ejb throws exception (from glassfish logs): severe: attempting confirm confirmed login using confirmation uuid: b90b33ca-dc69-41c1-9c60-99152810c89b com.extremelatitudesoftware.els_commons.exceptions.loginpreviouslyconfirmedexception: attempting confirm confirmed login using confirmation uuid: b90b33ca-dc69-41c1-9c60-99152810c89b @ com.extremelatitudesoftware.security.auth.credentialscontroller.checkforpreviousconfirmation(credentialscontroller.java:244) and on client side of exception stack (down @ bottom) see this: warning: standardwrappervalve[faces servlet]: pwc1406: servlet.service() servlet faces servlet threw exception java.lang.nullpointerexception @ com.extremelatitudesoftware.accesscontrol.registration.registrationconfirmationbean.setchallengequestion(registrationconfirmationbean.java:61) @ com.extremelatitudesoftware.accesscontrol.registration.registrationconfirmationbean.fetchchallengeresponse(registrationconfirmationbean.java:51) ...

MySQL - Meaning of "PRIMARY KEY", "UNIQUE KEY" and "KEY" when used together while creating a table -

can explain purpose of primary key , unique key , key if put in single create table statement in mysql ? create table if not exists `tmp` ( `id` int(11) not null auto_increment, `uid` varchar(255) not null, `name` varchar(255) not null, `tag` int(1) not null default '0', `description` varchar(255), primary key (`id`), unique key `uid` (`uid`), key `name` (`name`), key `tag` (`tag`) ) engine=innodb auto_increment=1 ; how convert query mysql? a key normal index. way on simplification think of card catalog @ library. points mysql in right direction. a unique key used improved searching speed, has constraint there can no duplicated items (there no 2 x , y x not y , x == y). the manual explains follows: a unique index creates constraint such values in index must distinct. error occurs if try add new row key value matches existing row. constraint not apply null values except bdb storage engine. other engines, unique index perm...

python - How to identify objects with broken reference properties in google app engine -

how correctly check broken reference properties in google app engine? example: class user (db.model): username = db.stringproperty(multiline=false) class foo (db.model): user = db.referenceproperty(user, collection_name="user_foo") a user object created. a foo object created. the corresponding reference property in user deleted. as suggested daniel roseman in comments: "iterate through foos , access item.user, , [check] if resolveerror raised" from google.appengine.api import datastore_errors all_foo = foo.all() bar in all_foo: try: user_refproperty = bar.user except datastore_errors.error, e: if e.args[0][0:40] == "referenceproperty failed resolved:": bar.delete() self.response.out.write('deleted due bad reference property') else: raise

google chrome extension - Javascript: How to check if a style is already injected -

in chrome plugin, through background script, inject style way: if(!styleleft){ var styleleft = document.createelement("style"); document.head.appendchild(styleleft); styleleft.innerhtml = "a, .left-hand { cursor: wait; }"; } but if doesn't work when style tag in page. how can specific style? thanks. check id. example: if ( !!document.getelementbyid( 'a-long-id-that-will-never-collide' ) ) { var styleleft = document.createelement("style"); // set id can check later styleleft.id = 'a-long-id-that-will-never-collide'; document.head.appendchild(styleleft); styleleft.innerhtml = "a, .left-hand { cursor: wait; }"; }

find a string with regex and javascript -

i trying match string 6c81748b9239e96e it's random each time. using following code below. problem matches entire string , need random string contains letters , numbers. string <a href="playgame.aspx?gid=4&tag=6c81748b9239e96e">play</a> javascript regex string.match(/\&tag\=[a-za-z0-9]+\"\>/i); here suggestion: add snippet provided @artem barger code: https://stackoverflow.com/a/901144/851498 need modify it, though (adding str argument): function getparameterbyname( name, str ) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regexs = "[\\?&]" + name + "=([^&#]*)"; var regex = new regexp(regexs); var results = regex.exec( str ); if(results == null) return ""; else return decodeuricomponent(results[1].replace(/\+/g, " ")); } use way: var str = getparameterbyname( 'tag', string ); js...

Create table on SQL Server from dynamic pivot results -

is there way directly store results of dynamic pivot query fixed table? result dynamic can't create table specifying columnnames , methods "create table mytable (pivot select statement)" seem fail on sql server ("incorrect syntax near keyword 'as'"). have tried format sql below select - - structure failed so. appreciated! the sql used pivot (build great website!): declare @pivot varchar(max), @sql varchar(max) create table pivot_columns (pivot_column varchar(100)) insert pivot_columns select distinct datefield mytable order 1 select @pivot=coalesce(@pivot+',','')+'['+pivot_column+']'from pivot_columns set @sql = 'select * (select datefield, refcode, sumfield mytable) p pivot (sum(sumfield) datefield in ( ' + @pivot + ') ) pvl' drop table pivot_columns exec (@sql) unless not following trying should able add into mynewtable sql going execute , should new table. declare @pivot varch...

javascript - jQuery submit() - form is still sent -

i have this $("#formnewsletter").submit(function(){ return false; }) it works expected - form not submited. when write this, seems returning true (the form being send) $("#formnewsletter").submit(function(){ if($("#newsletterselspec div").length() > 0) { alert("good"); } else { alert("please add @ least 1 speciality!"); } return false; }) i understand why happening , how can make work. thank you! the property length isn't method. use $("#newsletterselspec div").length > 0 . you can prevent default behavior of event using preventdefault() witch method in first argument. ( event ). $("#formnewslette...

php - Mysql_fetch_object() SQL Query (HOW TO: If no results found, display "message" )? -

i've spent hours trying make work. no solutions search have helped me, i'm asking. what i'm trying is: display message if no results found . this have, , not working dismay. $sql = mysql_query("select * cover match(keyword,description,categories) against('$search_key' in boolean mode) order id desc limit $from , $perpage"); $i=1; while($result = mysql_fetch_object($sql)) { $keyword = $result->keyword; $img = $result->img; $description = $result->description; if($img != null) { this; if($i==2) { require_once(dirname(__file__).'/page.php'); } $i++; } } if($img == null) { print "<center>no results found</center>"; } i don't know how use mysql_num_rows (which i've seen popular solution around site), returns error , i'm thinking doesn't work mysql_fetch_object($sql) ? , don't think this: $img = $result->img; work mysql_num_rows either. ...

java - Global transaction in Spring -

is there way imitate global transaction in spring if transaction spawns multiple threads. know not possible in spring, thinking perhaps there workarounds. spring doesn't provide transaction support; merely ties existing mechanisms (jta, local transactions, mock transactions). you're @ mercy of whatever underlying transaction you're using. if you're in application server, of them allow parallel processing performed within container. container-managed thread pool has advantage of propogating container resources (jndi contexts, transactions, etc.) other threads. websphere , weblogic, instance, use workmanager api: http://www.devx.com/java/article/28815/0 though seem recall java ee 6 has support thread pools (not sure this, though).

SharePoint custom security group is missing in Site Permissions -

i have written piece of code create custom security group in sharepoint app. code runs on feature activation @ site level , follows: public override void featureactivated(spfeaturereceiverproperties properties) { spsite site = (spsite)properties.feature.parent; using (spweb web = site.openweb()) { if (!groupexists(web.sitegroups, "test column administrators")) { web.sitegroups.add("test administrators", web.associatedownergroup, null, "contains users , groups can administer test column articles."); web.associatedgroups.add(web.sitegroups["tets column administrators"]); web.update(); } } } the code create group , adds sharepoint site when go site actions->site permissions (_layouts/user.aspx page), group missing. when manually go groups.aspx page (_layouts/groups.aspx) there. how can code create group in suc...

jquery - Getting Fancybox to work -

i must going blind here, i've been trying ages fancybox trigger! i've read , re-read documentation , have copied exact code have used, , yet fancybox refuses trigger... <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en:uk"> <head> <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <meta name="robots" content="index,follow" /> <link type="text/css" rel="stylesheet" href="styles/style.css" /> <link rel="stylesheet" href="http://fancyapps.com/fancybox/source/jquery.fancybox.css?v=2.0.6" type="text/css" media=...

jquery - Why are my POST variables showing up on URL string? -

i've implemented ajax post function based on button click. code is $.ajax({ type: "post", url: "includes/phpscripts?action=manage", data: {location: loc, lat: latitude, lon: longitude, heading: head, filename: file}, success: function(){ $("#panoinfo").html("<div id='message'></div>"); $("#message").html("valid submission"); } }); i specified post method since don't want variables visible via url. however, are. my test url before posting http://localhost/jmctour/buildtour.php afterwards http://localhost/jmctour/buildtour.php?filename=1-prefix_blended_fused.jpg&location=start+of+tour&lat=43.682211&long=-70.450705&heading=100&submit=save why? from docs jquery.ajax (emphasis mine): data data sent server. converted query string, if not string. it's appended url get-requests. see processdata option prevent auto...

postgresql - Postgres ENUM data type or CHECK CONSTRAINT? -

i have been migrating mysql db pg (9.1), , have been emulating mysql enum data types creating new data type in pg, , using column definition. question -- i, , better to, use check constraint instead? mysql enum types implemented enforce specific values entries in rows. done check constraint? and, if yes, better (or worse)? based on comments , answers here, , rudimentary research, have following summary offer comments postgres-erati. appreciate input. there 3 ways restrict entries in postgres database table column. consider table store "colors" want 'red', 'green', or 'blue' valid entries. enumerated data type create type valid_colors enum ('red', 'green', 'blue'); create table t ( color valid_colors ); advantages type can defined once , reused in many tables needed. standard query can list values enum type, , can used make application form widgets. select n.nspname enum_schema, t.typname e...

javascript - How do I insert the xml file data into a variable? -

i quite new javascript , xml. trying load external xml file can changed event handler (onclick). xml file loads ok. problem cannot retrieve xml data. variable xmldoc appears null. doing wrong? also can recommend online courses javascript, xml , php education? need trained , well. thanks code below: external js file: var xmlhttp; function getxmlhttpobject() { if(window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari return new xmlhttprequest(); } if (window.activexobject) { // code ie6, ie5 return new activexobject("microsoft.xmlhttp"); } return null; } function loadxmldoc(url) { xmlhttp=getxmlhttpobject(); if (xmlhttp==null) { alert ("your browser not support xmlhttp!"); return; } xmlhttp.open("get",url,true); alert (url); xmlhttp.send(); xmldoc=xmlhttp.responsexml; } function get_set_data () { var title=xmldoc.getelementsbytagname("title")[0].childnodes[0].nodevalue; document.getelementbyid("header...

css - Headings should only be defined once -

just ran decent amount of css through csslint, check errors. 80% of warnings defining same header element more once. wondering best way clean these kind of styles be... h4 { color: red; } .archive h4 { color: green; } keeping in mind i'm using h1 - h6 styles elsewhere in design. would better use classes , inherit styles mix-ins (i'm using stylus)? h4 { color: red; } .archive-header { color: green; } while i'm @ it, why csslint warn against this? there performance hits? to around it, sure... you're solution should work fine. css lint warns against because shouldn't style same headers differently. here's little excerpt article talking more subject : when styling headings (or anything) want 3 big goals met: dry – not repeat yourself. want set headings once , never (ok, rarely!) repeat font styles or selectors. make our site easier maintain. predictable – heading should same no matter on page placed. make...

ASP.NET Universal Providers - Do they automatically provide SQL Azure Retry Logic? -

regarding asp.net universal providers (system.web.providers), automatically offer retry logic when used sql azure? example in code call: membership.createuser if fails because of azure's transient error, library automatically handle situation , retry operation? or should manually handle exception + retry? the following question implies reply logic built-in, there place confirm this, home page of these providers or source code? i don't see anywhere retries again after fail. defaultmembershipprovider uses simple entity framework addobject, unless implement custommembershipprovider. internal static user createuser(membershipentities ctx, guid id, string username, guid appid, bool isanon) { user user = new user(); user.userid = id; user.applicationid = appid; user.lastactivitydate = datetime.utcnow; user.username = username; user.isanonymous = isanon; ctx.users.addobject(user); user user1 = user; return user1; }

Korean (and other Unicode) characters in SQL Server 2008 R2 not displaying correctly in query results -

i have database needs hold data in variety of languages , alphabets. using default latin collation, text fields of unicode variety (nchar, nvarchar). i can happily insert , retrieve unicode data database using front-end application, if view data using ssms see gibberish! i can insert this: 극단적으로 which looks in ssms: 극단ì ìœ¼ë¡œ but retrieved front end application this: 극단적으로 now data being stored ok, why ssms display gibberish? interestingly if use ssms edit data directly , paste in above displays ( edit: turns out switching results grid text aleviates part of problem proper text displayed instead of boxes.): □□□□□ but if copy , paste text editor comes out as: 극단적으로 in attempt see if ssms misbehaving (/misconfigured me) used ms access , linked sql server database, displays same gibberish sql server. this database hold static text web application, important me able view , edit data easily, not done when can see this: 극단ì ìœ¼ë¡œ any suggestions...

socialengine - Jquery.min.js is conflict in socialengine4 framework? -

i trying use jquery.min.js in socialengine frame work. it works fine affect admin panel layout editor i thing conflict can 1 me resolve it. i using loading jquery.min.js in activity module bootstrap.php bellow $headscript = new zend_view_helper_headscript(); $headscript->appendfile('application/modules/activity/externals/scripts/core.js'); $headscript->appendfile('application/modules/activity/externals/scripts/jquery.min.js'); $headscript->appendfile('application/modules/activity/externals/scripts/jquery.hovercard.min.js'); this can solved including: <script> jquery.noconflict(); </script> in code , assinging "$." "jquery."

oracle - Inject GeoServer user into SQL query -

i'm setting geoserver installation communicate oracle database. need way inject geoserver username sql query authorization of data can performed. i've tried using ${gsuser,geoserver} parameter in sql view taken literal. any suggestions? thanks in advance. this new functionality developed address accessing data specific user: http://docs.geoserver.org/stable/en/user/data/sqlsession.html however makes geoserver send down user authenticated in geoserver sql, , it's not can use inside sql view, it's restricted session scripts. for sql view you'll have pass down user parameter ogc request, &viewparams=myuser:test , have ${myuser} in sql view (the default value specified in parameter table)

javascript - Using jQuery Masonry Many times in the same site -

i'm trying use jquery masonry 3 times on same site. each code block works independently when trying use 3 @ once, last 1 works. how can combine these work yet keep different values , selectors each has? /** first instance **/ var $container = $('.smallcolwrap'); $container.imagesloaded(function(){ $container.masonry({ itemselector : '.smallcol', columnwidth: function( containerwidth ) { return containerwidth / 3; }, isanimated: true }); }); /** second instance **/ var $container = $('.slickr-flickr-gallery'); $container.imagesloaded(function(){ $container.masonry({ itemselector : 'li', columnwidth: 160, isanimated: true }); }); /** third instance **/ var $container = $('.navigationhome'); $container.imagesloaded(function(){ $container.mas...

avaudioplayer - Adding Audio file in IOS app increases the App Size more than Audio file size -

my ios app size 2 mb. trying add 1 .m4a file size 2.8 mb. when archive app in xcode estimated app store size app increases 2 mb 7.7 mb, increase of 5.7 mb. audio file 2.8 mb, expect estimated app store size increase around 2.8 mb, not 5.7 mb. normal behaviour, can ignore or fix this?

javascript - Can't highlight xml syntax with highlight.js -

i'm trying print xml on html page. exemple: <pre><code class="xml"> <?xml version="1.0"?> <response value="ok" xml:lang="en"> <text>ok</text> <comment html_allowed="true"/> <ns1:description><![cdata[ cdata <not> escape <tags like="this"></tags></not>. ]]></ns1:description> <a></a> <a/> </response> </code></pre> i'd use highlight.js highlight code on page there's conflict xml , html. i had success php code using <pre><code class="php"></code></pre> , haven't tried other languages. way found display xml code in textarea, i'd prefer show xml sweet syntax-highlighting. i have made jsfiddle illustrate problem . hope can help. you should escape angle brackets &lt; , &g...

c# - asp.net mvc4 razor pass view model to helper -

i want pass view model html helper/ have tried public static string generatefulltable(this htmlhelper helper, ienumerable<carsviewmodel> model) { but dont know model be. does possible make universal helper gets different view models? yes, it's called generics. http://msdn.microsoft.com/en-us/library/ms379564(v=vs.80).aspx edit: here's 1 example... public static string generatefulltable<t>(this htmlhelper helper, ienumerable<t> model) { ... } you can further constrain t of specific type or inheriting interface, maybe this: public static string generatefulltable<t>(this htmlhelper helper, ienumerable<t> model) t : mymodelsinterface { } but depends on needs. hope helps ;)

cannot modify header information - headers already sent by [php, mysql, csv] -

possible duplicate: “warning: cannot modify header information - headers sent by” error im getting these errors on website warning: cannot modify header information - headers sent (output started @ /home/****/public_html/monday/tuffturf/createrep.php:7) in /home/****/public_html/monday/tuffturf/createrep.php on line 103 warning: cannot modify header information - headers sent (output started @ /home/****/public_html/monday/tuffturf/createrep.php:7) in /home/****/public_html/monday/tuffturf/createrep.php on line 104 warning: cannot modify header information - headers sent (output started @ /home/****/public_html/monday/tuffturf/createrep.php:7) in /home/****/public_html/monday/tuffturf/createrep.php on line 105 warning: cannot modify header information - headers sent (output started @ /home/****/public_html/monday/tuffturf/createrep.php:7) in /home/****/public_html/monday/tuffturf/createrep.php on line 106 query failed please try again mysql_fetch_a...

asp.net - MVC 3 Validation Attribute Error Message for Multi Tenant Application -

i working on multi tenant application using mvc3 , c#. using model class properties decorated validation attributes. want return tenant specific error messages on client side , on server side well. is there way hook mvc validation , render / return tenant specific messages per each request in runtime? my code snippet sipmle: model: public class testmodel { [required(errormessageresourcename="errormessage", errormessageresourcetype=typeof(global)] [regularexpression(@"\d+", errormessageresourcename="errormessagedigit", errormessageresourcetype=typeof(global)] public string testproperty {get; set;} } view: @using(html.beginfrom()) { @html.validationsummary(false, "")<br/> @html.textboxfor(x => x.textproperty)<br /> <input type="submit" value="submit" /> } one approach create set of custom validation attributes each inherit 1 of existing validation attributes ...

Android Lazy Loading working on emulator, not in device -

i found example of lazy loading, , believe have implemented properly. works in emulator, when run same code on device, not work. not download images, , have checked confirm device connected internet. i not sure why code working on emulator created new avd hoping delete cache. on new avd working before, when tried device worked @ first failed after 2 tries. code still not download images. is there common reason why running in avd not on device? use below link that, work me. lazy loading listview

how to remove all formulas from an excel sheet by java POI api? -

we can remove formula 1 cell cell.setcellformula(null) . if want make whole sheet formula free. see the apache poi site answers question.

user interface - Powerful table widget for a Python GUI -

i'd program table-like gui. know powerful table widget (for gui), has ready-made functionality filtering, sorting, editing , alike (as seen in excel)? you can use wxgrid - here's demo code - need manage/wire events on underlying table. bit complicated gove explaination in words, here's code (mostly based on wx examples code): import wx wx import evt_menu, evt_close import wx.grid gridlib statusclient import jobdatatable, jobdatagrid app = wx.app() log = logger(__name__) class jobmanager(wx.frame): def __init__(self, parent, title): super(jobmanager, self).__init__(parent, title=title) panel = wx.panel(self, -1) self.client_id = job_server.register() log.info('registered server {}'.format(self.client_id)) self.jobs = job_server.get_all_jobs() grid = self.create_grid(panel, self.jobs) sizer = wx.boxsizer(wx.vertical) sizer.add(grid, 1, wx.all|wx.expand) panel.set...

load balancing - corba services clustering -

i working on soa platform using corba. try cluster services node , need design architecture reason new area , cant think of road map. can kindly give tips find way because dont know look also have checked "clustering", "load balancing", "high availability" issues think should pay attention , can not understand .some berief explanation great warm regards

c# - Get dynamic property from Settings -

i've got few properties stored in appconfig , want access them dynamically (e.g. in loop or function). accessing values using mysettings.name_of_that_thing no problem, if name variable? i tried: string propertyvalue = mysettings.gettype().getproperty("name_of_that_thing").tostring(); but thing got name of property. how can this? string propertyvalue = mysettings.gettype() .getproperty("name_of_that_thing") .getvalue(mysettings, null); //replace mysettings null in getvalue(...) if mysettings static class

Magento getProductUrl() is not returning the right url -

i'm stuck in getting product url in product collection. have pieces of code product collection setted featured product. $_productcollection = mage::getmodel('catalog/product') ->setstoreid(mage::app()->getstore()->getid()) ->getcollection(); $_productcollection->addattributetofilter('feat_enabled', 1); $_productcollection->setvisibility(array(2,3,4)); $_productcollection->addurlrewrite(); $_productcollection->groupbyattribute('entity_id'); $_productcollection->load(); foreach($_productcollection $_product){ $_product->load($_product->getid()); if($_product->getissalable()){ $_name = ltrim(rtrim($_product->getname())); $_url = $_product->getproducturl(); } } what doing wrong here, if ill echo $_url in each loop, url being return lacking. doesn't have category name , subcatname. correct url should be: index.php/categ...

c# - type arguments can't be inferred from the usage for higher-order function -

i have following higher-order function: public static func<t, bool> not<t>(func<t, bool> otherfunc) { return arg => !otherfunc(arg); } and trying call that: var isvalidstr = linqutils.not(string.isnullorwhitespace); compiler gives me "type arguments cannot inferred usage" error. following works: var isvalidstr = linqutils.not((string s) => string.isnullorwhitespace(s)); i wonder difference is? string.isnullorwhitespace non-overloaded function same signature. as mentioned in comments, following works , still doesn't explain why type inference fails in case: var isvalidstr = linqutils.not<string>(string.isnullorwhitespace); the details of issue dealing answered eric lippert on blog, here . basically, "david b" said in comments, "isnullorwhitespace method group. method group has 1 participating member today, more in future."

portable executable - Best way to fix IAT and relocs when patching (merging) two different binaries (x86 PE)? -

first of - hello , thank reading this, i have 1 dll not have source code need add functionalities it. i made dll implementing these needed functionalities in c - using visual studio. now need insert generated code new dll target dll (it has done @ file level {not @ runtime}). i creating new pe section on target dll , put there code/data/rdata dll made up. problem need somehow fix iat , relocs relative new inserted code on target dll. my question is: what best way it? it nice if visual studio came option build using (mostly) relative addressing - save me lot when dealing relocs. guess encapsulate vars , constants struct, msvc need relocate address of "container" struct , use relative addressing access members. don't know if idea. i go further , rid of iat making function pointer dynamically load needed function module (kind of delay load module). , again, put function pointer inside "container" struct said before. the last option have make h...

c# - CameraCaptureDialog fails with "An unknown error occurred" -

i'm working on windows mobile 6.1 app written in c#. have added ability take photos. device intermec cn50. code works fine if open app , go directly bit takes photos. if go through few other screens , open photo bit fails incredibly useful message "an unknown error occurred". there no other useful information in exception can see. code fails on line: cameraresult = cameradialog.showdialog(); here's stack trace: at microsoft.windowsmobile.forms.cameracapturedialog.launchcameracapturedialog(intptr ptrstruct) @ microsoft.windowsmobile.forms.cameracapturedialog.showdialog() @ micronetmobileui.controls.camera.showdialog(form owner, string& filename) @ micronetmobileui.fieldservice.jobimagesform.loadcamerascreen() @ micronetmobileui.fieldservice.jobimagesform.footertoolbar_itementered(object sender, eventargs e) @ resco.controls.commoncontrols.toolbarcontrol.onitementered() @ resco.controls.commoncontrols.toolbarcontrol.mouseclickup(mouseeventargs e) @ resco.c...

javascript - Run JS function from parent window in child window? -

want run javascript function parent window in child window example i have different websites let's site1.com , site2.com i want site1.com open new window of url site2.com new_window = window.open("site2.com/index.php", "window2"); then want run js function test() on new_window. // site2.com/index.php <html> ...... </html> <script> function test(){ // code here } </script> summary want open new window (child) , run js functions parent window. you can use cross document messaging circumvent same origin policy follows. parent window ( site1.com ): var site2 = window.open("http://site2.com"); site2.postmessage("test", "http://site2.com"); child window ( site2.com ): function test() { // code here } window.addeventlistener("message", function (event) { if (event.origin === "http://site1.com") { var funct = window[event.d...

flex - dropdown following moving calloutbutton -

flex actionscript question. i have calloutbutton moving on screen. when open dropdown (by click) stays @ same position on screen (only arrow moving). not follow calloutbutton's position i dropdown follow position of calloutbutton when has moved (as when 1 clicks on button again when has moved). i have tried dispatch mouseevent.click. not work. tried open, close again dropdown actionscript sing closedropdown() , opendropdown(). no change. thanks sample code (call init() creationcomplete) : creationcomplete="init();"> <fx:declarations> <!-- place non-visual elements (e.g., services, value objects) here --> </fx:declarations> <fx:script> <![cdata[ import flash.events.mouseevent; import mx.events.dropdownevent; private function init():void { var minutetimer:timer = new timer(1*1000); minutetimer.addeventlistener(timerevent.timer, updatecalloutposition); // s...

c# - how to locate webelement with innertext -

i use selenium c# write test, face problem. here html. how can locate "100" on web page? < ul> < li class=""> 100 < /li> < li class=""> 200 < /li> < li class=""> 300 < /li> < li class=""> 400 < /li> < li class=""> 500 < /li> < /ul> iwebdriver driver = new firefoxdriver(); iwebelement element = driver.findelement(by.xpath("//li[text()=' 100 ']"));

osx - bash script mv command not working -

i'm trying write script renames file @ login in osx lion. here script far: #!/bin/bash if [ -f /users/$1/library/google/googlesoftwareupdate/googlesoftwareupdate.bundle/contents/macos/ksadmin ]; mv ~/library/google/googlesoftwareupdate/googlesoftwareupdate.bundle/contents/macos/ksadmin ~/library/google/googlesoftwareupdate/googlesoftwareupdate.bundle/contents/macos/ksadmin1 "successful" else "unsuccessful" fi i've created loginhook executes script. know executes @ login because computer speaks when can finds "ksadmin" file. know finds "ksadmin" file because computer says "successful". have manually renamed file, logged out, in , computer says "unsuccessful". the problem script doesn't rename "ksadmin" "ksadmin1". have written command properly? any ideas great. morgan what permissions on ksadmin? if it's read login id , ksadmin1 exists, may need mv -f. als...

c# 4.0 - Creating a chart in ASP.net -

i working on project , need add additional image using asp:chart control. unfortunately, i've never had use control before , it's bit complex use, need help. basically, need create stacked column chart 2 legends , 2 columns. first column "income" , stacks 3 values. (wages, interest , other.) second column "expenses" , stacks 2 values. (mortgage, other.) each value has it's own value. legend income should on left, column expenses right. these legends should display texts , values it's related value plus 'total' label value. for task, have deal 5 values on 2 columns asp:chart control huge , i'm drowning in it's options. , want ready yesterday, no pressure. it's overdue... :-) no, it's not homework. if was, have practical documentation , additional how-to information. since boss expects me add this, gave me absolutely no information work with, except code contains several other charts, none of them 1 , done previous...

registry - Loading ntuser.dat with powershell -

i need check settings users on windows clients in network. users have roaming profiles. i have written powershell script loads offline copy of users' ntuser.dat , reads out specific keys. file unloaded , next 1 loaded registry. the problem after 10 users no new files loaded. when script launched again users still don't load. new users after close powershell prompt , open new one. script stalls after 10 users. $userlist = ls "c:\temp calls\profiles" foreach ($user in $userlist){ $username = $user.name #$username = "ciproda" reg load "hklm\$username" "c:\temp calls\profiles\$username\ntuser.dat" | out-null ... here check keys ... [gc]::collect() start-sleep -s 3 reg unload "hklm\$username" } in section ' here check keys ', mounting hive ps drive using like: new-psdrive -name <blah> -psprovider registry -root <blih> cd <blah>: # set-itemproperty , get-itemproperty calls here...

c++ - Delete specific line from file -

i'm trying delete specific line id file in c++ , here code: void deleterow() { ifstream indb("files/students.dat", ios::in); if(!indb) { cerr << "file no opened!\n"; } cout << countrowsofdb() << " records." << endl; student *studentsarray[countrowsofdb()]; int n = 0; while(indb >> id >> name >> grade >> points >> type) { studentsarray[n] = new student(id, name, grade, points, type); n++; } indb.close(); for(int = 0; < countrowsofdb(); i++) { cout << studentsarray[i]->id << " " << studentsarray[i]->name << " " << studentsarray[i]->grade << " " << studentsarray[i]->points << " " << studentsarray[i]->type << "\n"; } cout << "\nwhich 1 delete? enter i...

azure - Can't deploy PHP on dev emulator with Worker Role -

Image
i use eclipse , plugins php create , configure php project deploy them on windows azure (wa). however, have installed wa sdk 1.7 (7th jun) , not compatible eclipse , plugins had use commando. decided create project (with web role , worker role) in eclipse , tried run following commando recreate cscfg file , .csx folder , run on compute emulator... cspack servicedefinition.csdef /generateconfigurationfile:serviceconfiguration.cscfg /copyonly ...but generates following error... error : cloudservices38 : entrypoint dll not defined worker role myphpproj_myworkerrole. thanks advice. in web , worker role need either provide role entrypoint or program entry point. , know in custom worker role there no worker role dll can use php.exe or java.exe or nodejs.exe programentrypoint. the way solve problem using programentrypoint windows azure worker role. give example below on how use can use in windows azure php application: so if have worker role name "testworker...

asp.net - Save control's (ASP Panel and children) state in cache -

i'm looking easy , expandable way cache filter settings users. initial thought override save / load viewstate processes panel enclosing filter controls , save / load control state there. have not been able find way though. is possible without altering state process of entire control, page, or site? this seemed interesting case, i've taken shot @ solution accomplish functionality. i've come code below, should serve start. works "defaultproperty" of control, adding checks specific control types, cache , set property like. additionally, sets control cached value on first load of page. not sure if want value of control change between postbacks reflect if user/session had made change. using system.collections.generic; using system.componentmodel; using system.web; using system.web.ui; using system.web.ui.webcontrols; public class cachedstatepanel : panel { private static dictionary<string, object> cachedfilters { { ...

Navigation between pages in blackberry webworks -

i want know how handle navigation between html pages. when using window.location.href = "screen1.html"; i able load new page, when click button, application gets terminated. how can handle this? in native java blackberry, screen on stack, how done in webworks? i think better way use html url <a href="screen1.html" > @ second page when click on button take previews screen "as normal browser do"