Posts

Showing posts from January, 2013

scala - How to alias a sequence of tasks? -

i have custom tasks in sbt (0.12.2) project. let's call them a , b , c . when i'm in interactive mode of sbt can type a , task associated a executed. can type ;a;b;c , 3 tasks executed in sequence; same way ;clean;compile do. can interactive shell create alias run them all: alias all=;a;b;c . when type all tasks executed in obvious manner. i'm trying achieve creating alias inside of sbt configuration project. this section of sbt documentation deals tasks, achieve this: lazy val = taskkey[unit]("a", "does a") lazy val b = taskkey[unit]("b", "does b") lazy val c = taskkey[unit]("c", "does c") lazy val = taskkey[unit]("all", ";a;b;c") lazy val tasksettings = seq( <<= seq(a,b,c).dependon ) the problem have approach tasks combined , execution happens in parallel in contrast sequential, i'm trying achieve. how can create alias alias all=;a;b;c inside of sbt configurat

.net - DevExpress TextEdit - Mask for Negative Values -

actually, have devexpress textedit , displaying amount in textedit. have set mask properties of textedit : - masktype -> numeric - editmask -> n2 - usemaskasdisplayformat -> true now, getting output : - postive values -> 800.00 - negative values -> 800.00- but,i want output negative values -800.00 can me? you set: righttoleft = true - right? please set righttoleft = false & properties.appearence.textoption = far => when in put negative value => -800.00

c# - Deploy REST service without access to IIS -

i have developed .net rest web service in c#. while have plenty of c# experience, unfortunately not have understanding in deploying such service in web hosting environment. due environment, not have access iis. the advice have been provided support services of hosting provider follows: create subdomain of main domain achieve dedicated application pool (this requirement of host provider) create bin folder hold compiled libraries of source code add following web.config file: <system.web> <httphandlers> <add type="reportrestwebservice.service, reportrestwebservice" verb="*" path="report" /> </httphandlers> </system.web> <system.webserver> <handlers> <add name="report" path="report" verb="*" modules="isapimodule" scriptprocessor="c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" resourcetype="file"

Powershell: Combining variables -

i'm new powershell , have question: i made function: function a_function($a,$b){ $d = $a + $b $d } a_function "0","1" the problem is, function gives output: 0 1 and on 1 line: 01 i tried things like: $d = ($a + $b) #result: same sabove $d = (""+$a + $b+"") #result: 1 0, dont want space inbetween $d = "$a$b" #result: 1 0, dont want space inbetween thank helping you sending array , bind $a only. in powershell delimit arguments space. try way instead: a_function "0" "1" also note you're adding 2 strings, result "01" ant not 1, in case wanted add numbers.

JavaScript - Get system short date format -

is there way system short date format in javascript? for example whether system's short date in american format eg. m/d/y or in european eg. d/m/y please note: not question formatting date or calculating based on geolocation, getting format os/system after pinch of research concluded technically it's not possible regional settings -and this, date format- can several other things. pick 1 of these options: a) mentioned -and outdated- "tolocalestring()" function: var mydate = new date(1950, 01, 21, 22, 23, 24, 225); var mydateformat = mydate.tolocalestring(); alert (mydateformat); issues: 1) can't "mydateformat.replace" date mask month not stored "01", "02", etc in string text instead, based on locale (like "february" in english it's "Φεβρουάριος" in greek , knows in e.g. klingon). 2) different behavior on different browsers 3) different behavior on different os , browser versions... b) use t

trimming - Removing only the last whitespace in string - Javascript -

this question has answer here: trim string in javascript? 24 answers how can remove last whitespace (if there any) user input? example: var str = "this "; how can remove last 1-4 whitespaces still keep first 2 whitespace (between this, , it) question solved - lot! using function this: string.prototype.rtrim = function () { return this.replace(/((\s*\s+)*)\s*/, "$1"); } call: str.rtrim() addition if remove leading space: string.prototype.ltrim = function () { return this.replace(/\s*((\s+\s*)*)/, "$1"); }

android - Issue on changing the resource in imageView when that imageView is pressed -

i trying write application change image resource, when imageview pressed. i referred this link . i used both setontouchlistener , setonclicklistener in code. in both, logs. but, image didn't change. have given code below: imageview more; more = (imageview) row.findviewbyid(r.id.imageview1); more.setimageresource(r.drawable.ic_more_1); setontouchlistener is: more.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { // todo auto-generated method stub log.d(tag,"event type "+event+" "+ event.getaction()); switch (event.getaction()) { case motionevent.action_down: more.setimageresource(r.drawable.ic_more_2); break; case motionevent.action_up: more.setimageresource(r.drawable.ic_more_1); break;

c - How to reconnect the clients to server? -

my server program (socket stream) running , accepts clients. due abnormal condition, server getting terminated. other side clients waiting server reply. how reconnect running clients new server? functions in sockets? a socket had been connect() ed once can not reused call connect() . the steps connect tcp server , read/write data follows (pseudo code): fd = socket(...) // create socket describtor (allocate socket resource) connect(fd, server-address, ...) // connect server read/write(fd, data) // read server close(fd) // close /socket descriptor (free socket resource) in case server goes down after connect client , shall is close(fd) // close /socket descriptor (free socket resource) and start on beginning with: fd = socket(...) // create socket describtor (allocate socket resource) ... starting on , beginning with: connect(fd, server-address, ...) // connect server ... would propably lead undefined behaviour, @ least error.

cakephp 2.x router with i18n internationalization -

i'm using cakephp 2 i'm having hard time customize routes in routes.php. so in case, have post model , postscontroller. index action lists post , each listed post clickable link goes show action. "standard" route posts>index is: "localhost/cakesite/posts/index" , translated version it's like: "localhost/cakesite/eng/posts/index". corresponding modified routes are: "localhost/cakesite/news" , "localhost/cakesite/eng/news". now show action it's different because need pass parameters such slug , id, looks without modification of route: "localhost/cake/posts/show/75/language:eng". like: "localhost/cakesite/news/slug-id" , translated version: "localhost/cakesite/eng/news/slug-id". these both routes can't done. one: "localhost/cakesite/news/slug-id" working when have pointer on link get: "localhost/cake/posts/show/75" once click on it, redirects me on right url

c# - Execute postback url from another button -

i have 2 buttons , buttona (normal 1 ) , buttonb (has postbackurl) , need execute (buttonb) click of buttona <asp:button id="buttona" runat="server" text="button" /> <asp:button id="buttonb" postbackurl="url" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ $("#<%= buttonb.clientid%>").trigger("click"); }); }); </script> can tell me , how , either jquery or codebehind , because don't know if it's possible ? thanks, unless posting data form buttonb's postbackurl , have window redirect postbackurl so: <asp:button id="buttona" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ wind

java - PreferenceCategory theme not applied to PreferenceScreen -

i saw lots of answers , threads regarding problem alone tutorials how create custom preferencecategory. nothing works me. theme not applied. preferenceactivity class: public class preferencesactivity extends preferenceactivity{ private mypreferencefragment preferences; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); preferences = new mypreferencefragment(); getfragmentmanager().begintransaction().replace(android.r.id.content, preferences).commit(); } public static class mypreferencefragment extends preferencefragment { @override public void oncreate(final bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.layout.mypreferences); } } } androidmanifest: <activity android:name="com.gpsy.preferences.preferencesactivity" android:screenorientation="portrait" android:configchanges=&quo

html - How to create a div with 2 columns for text and image icon? -

Image
there following code: <?php foreach ($data $vacancy) { ?> <div class="vacancy"> <img src="<?php echo yii::app()->request->baseurl; ?>/images/vacancy_icon.jpg" /> <div class="name"> <?php echo chtml::link($vacancy['name'], array('vacancy/show', 'id'=>$vacancy->vacancy_id)); ?> </div> <div class="info"> <div class="public_date">public date: <?php echo $vacancy['date']; ?></div> </div> <hr /> </div> <?php } ?> as can see, each "vacancy" contains 2 columns text , 1 image. there styles: .vacancy img { float:left; width: 50px } .vacancy .name { margin: 0; width: 50px; } .vacancy .info { float: right; width: 50px; } i need each vacancy visible in following order: icon, "name",

python - Automatically create (and keep) an object when accessed -

i this: class a: def hello(): print "hello" # not want explicitly setup a: = a() # = a() -> want happen automatically when access # first try this: def a(): return a() # also, not want call function a(): must object # , must stay alive , initialized a.hello() # created, object of class a.hello() # not want second instantiation how can implement this? properties ? cached-properties ? classes: module-level object. def lazyinit(cls): class p(object): def __init__(self, *args, **kws): self._init = lambda: cls(*args, **kws) self._obj = none def __getattr__(self, k): if not self._obj: self._obj = self._init() return getattr(self._obj, k) return p example: @lazyinit class a(object): def __init__(self, a, b): print("initializing...") self.x = + b + 2 def foo(self): return self.x x = a(39, 1) print x prin

java - What is difference Javax.jws and javax.xml.ws -

i new java , trying jump webservices. found 2 examples somewhere , confused available options. firstly, javax.jws.webservice annotation seem work fine there loads of material on javax.xml.ws. difference between these 2 approaches. seems javax.jws newer , there not material available on same. please throw light. thanks , regards web services metadata annotations (jsr 181) using annotations jsr 181 specification ( java.jws. xxx ), can annotate web service implementation class or web service interface. e.g. deploy jax-ws web services on tomcat package com.mkyong.ws; import javax.jws.webmethod; import javax.jws.webservice; import javax.jws.soap.soapbinding; import javax.jws.soap.soapbinding.style; //service endpoint interface @webservice @soapbinding(style = style.rpc) public interface helloworld{ @webmethod string gethelloworldasstring(); } jax-ws 2.0 annotations (jsr 224) the jsr 224 specification defines annotations jax-ws 2.0 ( javax.xml.ws. xxx ).

mongodb compound index over extending -

i have question regarding compound indexes cant seem find, or maybe have misunderstood. lets have created compound index {a:1, b:1, c:1}. should make according http://docs.mongodb.org/manual/core/indexes/#compound-indexes the following queries fast. db.test.find({a:"a", b:"b",c:"c"}) db.test.find({a:"a", b:"b"}) db.test.find({a:"a"}) as understand order of query important, explicit subset of {a:"a", b:"b",c:"c"} order important? lets query db.test.find({d:"d",e:"e",a:"a", b:"b",c:"c"}) or db.test.find({a:"a", b:"b",c:"c",d:"d",e:"e"}) will these render useless specific compound index? compound indexes in mongodb work on prefix mechanism whereby a , {a,b} considered prefixes, order, of compound index, however, order of fields in query not matter. so lets take examp

JAVA - Check if value is not in other index 2D array -

im stuck on part of school project have shortest route between 2 co-ordinates (traveling salesman problem). made litle here co-ords of nearest neighbour, few co-ords have same closest neighbour, , dont want that. i thought of clear issue, isn't working, , can't figure out why. distance current distance between current position , every other. shortestdistance kind of speaks think. locations[20][3] 2d array in store xco-ord, yco-ord , nearest neighbour each co-ord. x in [x][0], y in [x][1] , neighbour in [x][2] for(int = 0; < 20; i++){ int shortestdistance = 100; int distance; //looking nearest neighbour 20 times for(int j = 0; j < 20; j++){ //looking closest neighbour here distancex = locations[i][0] - locations[j][0]; distancey = locations[i][1] - locations[j][1]; //to prevent negative distance: if(distancex < 0){

java - How to separate sessions for new browser instance of IE8 using servlet? -

i facing problem of creating new session , maintaining previous 1 @ same time. my code in servlet. works other browsers ie , ie7 , lower versions, not ie8 , ie9. knew ie8 & ie9 uses same session every new request; want create new session every new initial request java ee application. wrote code creation of new httpsession first time when session null , added code new session. what can code changes new session, without maintaining hidden variable value on every page or sending session id through url? there other way possible separate 2 or more sessions? my servlet code snapshot 1 below: protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { process(request, response); } private void process (httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { string strerrormsg = null; response.setcontenttype ( "text/html" ); httpsession session = null

javascript - Providing Feedback After a Php Header Redirect -

i have html table in application written javascript (and jquery) , php. contents of table stored in mysql table. when want user add data table, click button , jquery ui dialog shown, form user fill out. when user fills out form, click save, , form submitted page of pure php, saves data table , redirects original page table on, using $url = base_url . '/admin/pages/finance/pricing/pricing_schedule.php'; header('location: '.$url); //redirect right page exit(); i doing because don't want message: confirm form resubmission - page you're looking used information entered. returning page might cause action took repeated. want continue? to show should user hit refresh whatever reason. however, because of way doing this, struggling provide way give feedback user should save unsuccessful. when user hits save in jquery ui dialog box, box close when form submitted, can't provide feedback there because error hasn't occurred yet. when

knowledge management - Heart Beats increasing during Programming -

i working since more 6+ month in different technologies joomla,wordpress, php,jquery,. have sufficient working knowledge when getting project, heart beats increasing everytime, u know fear of code or don't know. 1 kind of pressure feel personally. , everytime need googling sometime simple things. solution that. yes off course time tracker going on when working , if tracker not going on beats may slow... please suggest me improve logic building , want learn php oops ..thank in advance.. sometime can't sleep considering coding... yes, know feelings because feel same feeling do. in opinion, best solution first…please take advice people 1. should communicate lot of people can give u advice , job. people should called background. if have stronger background, fear feeling disappear little little second…learn lot when have free time 2….that make u more confidence. thanks lot

javascript - Displaying popup window if it is taking more than 3 seconds to load a page -

need display popup before page load if page loading more 3 seconds. used below code displays popup if page load less tahn 3 seocnds also. popup need displayed if page loading takes more time not less time. <script type="text/javascript"> settimeout(fnshowpopup, 1000); function fnshowpopup() { var answer = confirm("it may take few time open docuemnt. click yes if want open docuemnt in native format or click on cancel continue viewing docuemnt") if (answer) window.open(nativeview()) } </script> settimeout(func, delay) comes method abort timer: cleartimeout(timeoutid) <script> var mytimer = settimeout(fnshowpopup, 3000); if (typeof(window.addeventlistener) === 'function') { // standard conforming browsers window.addeventlistener('load', function () { cleartimeout(mytimer); }, true); } else { // legacy, ie8 , less window.attachevent('onload', fun

javascript - Alternative to Eco templates with multiline -

i used eco templates time, don't @ all. have searched alternatives in google, don't useful information. i looking templates features: multiline clear syntax rails 3.x supported coffeescript supported backbone supported i'd recommand haml-coffee, integrates well, or maybe jade :).

javascript - Replacing the <img> src with Angular.js -

i building slideshow of header images, on click select , set header image replace old one. code far: var app = angular.module('plunker', []); app.controller('bannerctrl', function($scope) { var imagecounter = 0; $scope.nextbutton = function () { imagecounter = imagecounter + 1; if (imagecounter === 1) { $scope.carouselstate = 'second-slide'; } if (imagecounter === 2) { $scope.carouselstate = 'third-slide'; } if (imagecounter > 2) { imagecounter = 0; $scope.carouselstate = 'reset-slide'; } }; $scope.previousbutton = function () { imagecounter = imagecounter - 1; if (imagecounter < 0) { imagecounter = 2; $scope.carouselstate = 'third-slide'; } if (imagecounter === 1) { $scope.carouselstate = 'second-slide'; } if (imagecounter === 0) { $scope.carouselstate = 'reset-slide'; } }; $scope.setheade

xml - How to get a specific node value with xpath when id is in element instead of attribute? -

with xpath /levels/level[@id="3"]/value can value of level id=3 this: <levels> <level id="2"> <value>25</value> </level> <level id="3"> <value>33</value> </level> <level id="4"> <value>44</value> </level> </levels> but xml reading formatted without attributes this: <levels> <level> <id>2</id> <value>25</value> </level> <level> <id>3</id> <value>33</value> </level> <level> <id>4</id> <value>44</value> </level> </levels> what equivalent xpath second xml block value of level id=3? (it not guaranteed id=3 second node.) how following: /levels/level[id/text() = "3"]/valu

Primefaces galleria - how to navigate without filmStrip -

i need have primefaces galleria without film strip @ bottom. when used showfilmstrip="false", there no way navigate manually. adding autoplay="true" not make contents move. <p:galleria id="gal" value="#{articlecontroller.welcomes}" var="w" autoplay="true" showfilmstrip="false" > <h:outputlabel value="#{w.sinhalatopic}" ></h:outputlabel> </p:galleria> is there way have gallaria without film strip @ bottom, yet enable navigate arrows on either sides? if not possible, there other similar primefaces component used instead? .ui-galleria-filmstrip-wrapper { display:none; } add upper code .css file, make strip hidden @ bottom of p:galleria .

c# - Make form function accesible to all forms -

i have function on form1 , , want use same function form2 , form3 , on, instead of duplicate function on each form there way make accesible all? i've tried make new class : form , call function forms, not working... public void tb_leave(object sender, eventargs e) { if ((sender textbox).text.count() < (sender textbox).maxlength) (sender textbox).text = (sender textbox).text.padleft((sender textbox).maxlength, '0'); } thank in advice. update thank answers, work fine, if want use same method x textboxes? (like doing tb_leave function) i mean, old method select x textboxes , send leave event function, way mention need create method call method within helper class... still need create method inside every form, call class, right? although, answers helpful need create new .cs file helper classes :) update 2 i'm having problems migrating method public static void textboxkeydown(this textbox tb, keyeventargs e) { switch (e.keycode

if statement - DB2 SQL filter query result by evaluating an ID which has two types of entries -

after many attempts have failed @ , hoping can help. query returns every entry user makes when items made in factory against , order number. example order number entry type quantity 3000 1 1000 3000 1 500 3000 2 300 3000 2 100 4000 2 1000 5000 1 1000 what want query return filter results this if order number has entry type 1 , 2 return row type 1 otherwise return row whatever type order number. so above end up: order number entry type quantity 3000 1 1000 3000 1 500 4000 2 1000 5000 1 1000 currently query (db2, in basic terms looks ) , correct until change request came through! select * bookings type=1 or type=2 thanks! select * bookings left outer join ( select order_number, max(case when type=1 1 else 0 end) + max(case when ty

nlp - Clustering Words -

i have list of words. looking way cluster these words semantically. can tell me library or tool accomplishes this? have been searching on net lot nothing suits requirements. of words technical , won't found in dictionary. want perform ontological clustering on list of words. do have collection have context work with? if ha given collection can use can compute number of documents each pair of terms appear and, based on calculate semantic similarity between them [jaccard] ( http://en.wikipedia.org/wiki/jaccard_index ) or [dice] ( http://en.wikipedia.org/wiki/dice%27s_coefficient ).

java - How to add data to the GXT Grid properly? -

i have webapp in need data file , fill table. here code of page table: public class rules extends contentpanel{ private final servermanagementasync servermanagementsvc = gwt.create(servermanagement.class); private arraylist<propertyitem> propslist; private arraylist<propertyitem> itemarraylist; private editorgrid<propertyitem> grid; public rules(final string customerid){ setlayout(new flowlayout(10)); list<columnconfig> configs = new arraylist<columnconfig>(); columnconfig column = new columnconfig(); column.setid("name"); column.setheader("name"); column.setwidth(220); textfield<string> text = new textfield<string>(); text.setallowblank(false); column.seteditor(new celleditor(text)); configs.add(column); column = new columnconfig(); column.setid("type"); column.setheader("type

qt - Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init() -

whenever use opencv's cv::imshow alongside qt's qapplication , error: gtk-warning **: gtk_disable_setlocale() must called before gtk_init() i did searching , ended reading more , more stuff don't understand, got ideas how opencv , gtk+ connected. , since warning instruction call before something, included gtk.h , called gtk_disable_setlocale() , ended more errors. my code runs despite warning without problem, bugs me! , assume behind warning, there essential stuff programmer should understand. maybe can explain whole thing in way advanced newbie can understand? ;) edit: i'm using ubuntu 12.10, opencv 2.4, gtk 2.24.13 , qmake -v tells me qmake version 2.01a using qt version 4.8.3 in /usr/lib/x86_64-linux-gnu if going use qt windowing system, it's best avoid creating opencv windows alongside qt windows. convert iplimage or cv::mat qimage , draw on qt window. check cvimage , simple qt/opencv example displays image loaded opencv on qt w

c++ - Node-gyp Include and Library Directories with Boost -

i'm attempting build node c++ addon on windows 7 machine uses classes boost libraries. however, after running node-gyp configure successfully, i'm continually assaulted missing header files when run node-gyp build relating various boost headers included. i tried setting include , library directories manually in visual studio projects created "configure," no avail. how 1 go defining include directories node-gyp? [edit] after messing around node-gyp little success, explored building node modules through visual studio instead and, turns out, after several hours, it's , working. assistance. you need add them in binding.gyp file: 'include_dirs': [ '<some directory>', ], 'libraries': [ '-l<some library>', '-l<some library directory>' ]

c# - Maximum size of DataTable or other complex object in .NET -

this question has answer here: what maximum size of datatable can load memory in .net? 3 answers i know, size of object limited 2gb in .net, but maximum size of more complex objects, datatable? it depends on low-level objects inside? more complex objects still objects inside , contain references other objects. example if datatable contains references earch row , on. each pointer take 32 or 64 bit regarding of os type. pointer sizes sum , there no limit object graph depth (reasonable). limit have in case max memory amount can allocated process itself.

iphone - UIWebView: delete cookies of a specified webview -

i have 2 web views in want 2 run 2 different facebook accounts on both of these webviews. however, if sign in on 1 webview other webview automatically signs in these 2 webviews share same cookies. know can delete cookies using piece of code gets deletes cookies. however, deletes cookies of both webviews. there way delete cookies of 1 webview? or maybe alternate way of accomplishing this? thanks. this not work, since both uiwebview share same cookies. uiwebview cookies , cache shared app, each app has own cookies , cache stored apps sandbox. there no way change behavior.

python - table formatting, print out row names -

i have dictionary want format table: band3 = \ {'channel1': [10564, 2112, 1922], 'channel10': [10787, 2157, 1967], 'channel11': [10812, 2162, 1972], 'channel12': [10837, 2167, 1977], 'channel2': [10589, 2117, 1927], 'channel3': [10612, 2122, 1932], 'channel4': [10637, 2127, 1937], 'channel5': [10662, 2132, 1942], 'channel6': [10687, 2137, 1947], 'channel7': [10712, 2142, 1952], 'channel8': [10737, 2147, 1957], 'channel9': [10762, 2152, 1962]} i this: table = [[], [], [], []] # can't sort channel names because 'channel11' < 'channel2' channel_numbers = [] channel_name in band3.keys(): if channel_name.startswith('channel'): channel_number = int(channel_name[7:]) channel_numbers.append(channel_number) else: raise valueerror("channel name doesn't follow pattern") channel_numbers.sort() channel_numb

Loading Google Maps asynchronously with infobox error -

i have been trying fix since yesterday can't head around it. loading google map asynchronously following code brings error due infobox not being loaded correctly. my error is: infobox not defined my code is: function loadscript(callback) { var map = document.createelement('script'); map.type = 'text/javascript'; map.src = 'https://maps.googleapis.com/maps/api/js?key=my_key_goes_here&sensor=false&callback=initialize'; document.body.appendchild(map); map.onload = function() { var box = document.createelement('script'); box.type = 'text/javascript'; box.src = 'https://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/src/infobox_packed.js'; document.body.appendchild(box); box.onload = callback; }; } window.onload = loadscript; you specify argument loadscript, 'callback'. in map.src specify callback=initialize . call l

c# - Could we use only one ClassInitialize for all the Unit Testing classes? -

i started internship job consists of seting unit tests on projects. i have implemented dozens of tests , want create mechanism restores original database after or before each run. i have necessary scripts create, populate , drop database, don't want call mechanism each test classes, instead call once. is possible create classiniatialize() called once when start 1 or tests? edit all i/you need use assemblyinitialize() , assemblycleanup() , resolved, ;) all i/you need use assemblyinitialize() , assemblycleanup() , resolved, ;)

networking - Chrome | Strange issue with some of my site images -

Image
i using chrome 26.0.1410.64 m sadenly, today stoped serving of images of web site developing. have see chrome console, network tab, image not loaded having status (failed) , type "pending". note, these images, available if try open own url. here screen shot of console: this issue available on chrome, , not images. this example tag using 1 of images: <img src="http://www.mysite.dch/wp-content/uploads/ads/280x100/7047f30d8145b0d8abb47ff5ed07d703.jpg" alt="" title="" width="280" height="100" /> in above link example, if copy image url, , paste in tab of chrome, image normaly served, no error codes or delay. also image may helps: finally problem solved. have insalled plugin cat images because of ad keyword. these links may you: failed load resource: server responded status of 404 (not found) error in server and failed load resource under chrome try , see if solves

javascript - Some localStorage items are not being displayed -

i have 5 items in localstorage, however, when try output files, only 2 items being output, , not all. js puts localstorage: $(document).ready(function () { $.fn.savetocart = function (id, iname, ialbum, iprice) { var quantity = 0; if (localstorage.getitem('product_' + id) === null) { quantity = 1; } else { var tempitem = json.parse(localstorage.getitem('product_' + id)); var tempquantity = parseint(tempitem['quantity']); quantity = tempquantity + 1; } var cartitem = { 'quantity': quantity, 'name': iname, 'album': ialbum, 'price': iprice } localstorage.setitem('product_' + id, json.stringify(cartitem)); }; cart js: function shoppingcart() { var output; var productname; var productalbum; var productquantity; var productprice; var

sql - Map documents to different entities -

i have problem designing database. i have table contains documents following table-structure: [documents] id [int] filename [varchar] fileformat [varchar] filecontent [image] in program: each document can standalone (without relationship entity) or relation object either of type customer or employee (some more coming soon) each entity has id in database. example employee-table looks like: [employee] id [int] fk_nameid [int] fk_addressid [int] fk_contactid [int] my idea create table connection of entity , document. thought like: [documentconnection] documentid [int] entityid [int] entity [varchar] the entity-column in documentconnection-table contains table-name of relation. in example of entity of type employee column contain "employee". in application build select-statement document reading entity-string database. i'm not sure if way this. i think better design have employeedocument table, customerdocument table, etc. that allow use fo

java - Checking statement or assignation variable for performance? -

what instruction takes more time between if() or variable initialization ? will more efficient first check whether given variable has non-zero value , set if nonzero? for example : boolean ! if (boolean) boolean = false; or directly : boolean = false; most faster not check. depend on type of object being set (in case, boolean, "simple set"). particularly special objects have "simple compare" , "complex set" benefit checking first. and if easy check , hard change, "set" function should check itself. an exception shared memory between processors there lot of contention, since writing memory force caches of other processors flushed, takes time.

jquery - jqplot not working for dynamic data -

i trying use jqplot plot bar chart graph of data retrieving sqlite db phonegap - android how use same code db values. code static data working fine inside of tag when m trying put code inside of $('#pageid').live('pageinit',function(){}); not working. what's reason? <head> <script type="text/javascript" src="js/lib/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/lib/jquery.jqplot.js"></script> <script type="text/javascript" src="js/lib/jqplot.barrenderer.js"></script> <script type="text/javascript" src="js/lib/jqplot.categoryaxisrenderer.js"></script> <script type="text/javascript" src="js/lib/jqplot.pointlabels.js"></script> <link rel="stylesheet" href="css/lib/jquery.jqplot.css"/> <script type="text/javascript"> var s1

jquery - Post to controller and get result event checked -

i try result : function getprice() { var url = '@url.action("getadditionalprice")'; $.post(url, { additionalsid: $("input[name=selectedadditionals]").val }), function(data) { $("#totalamount").val(data); }; //view } public actionresult getadditionalprice(string[] additionalsid) { decimal price = 0; foreach (var id in additionalsid) { var aid = int.parse(id); price += db.contractadditionals.where(ca => ca.contractadditionalid == aid).select(ca => ca.price).single(); } return json(price, jsonrequestbehavior.allowget); }//controller why string[] additionalsid parameters undefined? how post parameter controller , set result #totalamount ? try this function getprice() { var url = '@url.action("getadditionalprice")'; $.post(url, { additionalsid: $("input[name=selectedadditionals

html - Extracting from webpage using vbs and writing into excel -

i'm pretty new vbs need extract property information web pages , input information excel. i'm trying object information links, text fields, buttons, images etc. information need .name, .id, .title, .value, .type, .class each item on page , display each item ie: google search page search box .id: lst-ib, .name: q .title: search .type: text google button .name: btnk .type: submit .value: google search etc etc. extremely helpful! i advise language such purpose, eg ruby @ , natural upstep vbscripters. said, here way how in vbscript.. set ie = wscript.createobject("internetexplorer.application", "ie_") ie .menubar = 0 .toolbar = 0 .statusbar = 0 .visible = 1 .navigate "http://www.google.com" end while ie.busy wscript.sleep 400 wend 'html = ie.document.all.tags("html").item(0).outerhtml wscript.echo ie.document.getelementsbytagname("font").item(0).innertext wscript.echo "innertext:" &

google maps - Geoxml-V3 icon request path repeated in request -

im trying migrate form geoxml geoxml-v3 , google maps v2 v3. issue i'm having geoxml-v3. icon request generated on client geoxml-v3 garbeled. example localhost/app/resources/icon.png will become like localhost/app/resources/app/resources/app/resources/app/resources/icon.png these kml files work geoxml , correctly formed. style icon segment <style id="off-red"> <iconstyle> <icon> <href>resources/icon.png</href> </icon> </iconstyle> </style> i figured out problem geoxml-v3 library, @ least in circumstance want store own marker icons. there code, line 386 if (typeof this.url == "string") which prefixes icon url current context or else last used context. didn't much. commenting out if block lead correct request. this hack works requirements.

How to read text between two particular text in unix shell scripting -

i want read text between 2 particular words text file in unix shell scripting. example in following: "my name sasuke uchiha." i want sasuke. this 1 of many ways can done: to capture text between "is" , "uchiha" : sed -n "s/^.*is \(.*\)uchiha.*/\1/p" infile

Activate a Macro each time I use a Validation List in Excel -

i have validation list selects different countries. each country has different sellers , have make validation list them too. problem have run macro manually (with button) each time select different country. want macro run/activate each time use country validation list , not manually(button). i don't think of code i'm using needed solve problem. i'll post last part anyway. dim strformula1 string strformula1 = "=$z$1:" & worksheets("graficos").range("z1").end(xldown).address() selection.validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:= _ xlbetween, formula1:=strformula1 .ignoreblank = true .incelldropdown = true .inputtitle = "" .errortitle = "" .inputmessage = "" .errormessage = "" .showinput = true .showerror = true end call macro inside worksheet_change event handler in worksheet class module. on w

objective c - Ordered Sets and Core Data (NSOrderedSet) -

Image
i have list of share prices properties datetime , value . currently sorting share prices when fetching them using sort descriptor. now, change code , store them in sorted order faster retrieve current share price (datetime = max). i inserting share prices 1 one using shareprice *priceitem= [nsentitydescription insertnewobjectforentityforname:@"shareprice" inmanagedobjectcontext:context]; how can sort share prices right after inserting them using sort descriptor on datetime ? or need convert nsmutableorderedset , use sortusingcomparator: ? thank you! mark ordered checkbox of property in coredata model. also sure set coredata automatic migration in appdelegate (options dictionary when creating persistentstore). way coredata able make change without data lost.

mysql - SQL to get even distribution from n groups - fetch random items -

i have following tables: table product id int(11) title varchar(400) table tag id int(11) text varchar(100) table product_tag_map product_id int(11) tag_id int(11) product_tag_map maps tags product. distribution of tags in system isn't normal, i.e., tags have more products others. i'm trying write sql fetch 25 random products: 5 products per tag, 5 tags (so that's 5x5 = 25). found answer here: how can distribution using id in(1,2,3,4) but doesn't yield random products - fetches same products per tag. here sql have: set @last_tag = 0; set @count_tag = 0; select distinct id ( select product.*, @count_tag := if(@last_tag = product_tag_map.tag_id, @count_tag, 0) + 1 tag_row_number, @last_tag := product_tag_map.tag_id product left join product_tag_map on (product_tag_map.product_id=product.id) product_tag_map.tag_id in (245,255,259,281,296) ) subquery tag_row_number <= 5; how make return random products per tag? any appreciated! thanks.

media player - Android playing sound on button click -

i'm trying play multiple times 2 different .wav files on button click. want play sound1 sound2 sound1 , on.. here fragment of code. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_box); mp = mediaplayer.create(box.this, r.drawable.sound1); mp2 = mediaplayer.create(box.this, r.drawable.sound2); handler = new handler(); sbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { rounds = new integer(et.gettext().tostring()); for(int j = 0; j < rounds; j ++) { f(); g(); } } }); } public void f() { cdt1 = new countdowntimer(5000, 1000) { public void ontick(long millisuntilfinished) {