Posts

Showing posts from August, 2011

c++ - How to cope with Mouse-Wheel-Delta cross platform? -

there question , asking why wheel-delta supposed 120 on windows platforms. however, encounter same threshold on linux , mac. value nowadays might change, how wheel-delta on windows, linux , mac? using openscenegraph, boost , qt cross-platform development. maybe might here. (it's c++ project)

javascript - strange behavior of html tags inside contenteditable div -

in project, trying add html tag letter ( < , > ) dynamically contenteditable div. whenever user pressing alphanumeric character, appending empty span element used calculating position of caret in contenteditable div. the problem when type words following: when < and press alphanumeric character b (which calls function append span element), contenteditable div showing when instead of when <b . when inspected element found contenteditable div has following content: when <b<span class="spanpos"></b<span> ^ strange span holding '</b' instead of being empty here example jsfiddle . i not sure how happening. please tell me should evade issue. ps: here trying add < , > , not html elements <b></b> . as said, you're trying add symbol can interpreted html. need escape or use different way express iso entity: $('#btncontent').click(function(){ $(&#

jsf - Allow only digits to the filtered textbox (search filter) of dataTable in Primefaces -

is possible apply such validation filtered textbox provided datatable of primefaces customizing it. the maximum number of characters textbox can hold can set using filtermaxlength="45" property of <p:column> . example. <p:column headertext="headertext" sortby="#{obj.properyname}" filtermaxlength="45" filterby="#{obj.properyname}"> <h:outputtext value="#{obj.properyname}" /> </p:column> i can't see such property perform other kind of validations such allowing specific characters, perhaps using regex. anyway, need allow have digits, since there id column of type bigint (primary key, auto-increment) in mysql database mapped long datatype in entity classes. is supported primefaces or there way customize it? afaik primefaces doesn't has option. can use javascript solve that. you have set id column want limit, input(use filter) have default id filter , process keydown

ajax - JQuery within an Object -

why work $("body").on("click",".open_popup",function(event){ event.preventdefault(); $("#form1").show(); }) but same code inside object,like so: var popupformulario = { openwith: function () { self=this; $("body").on("click",".open_popup",function(event){ event.preventdefault(); $("#"+self.id+"").show(); }) } and calling function popupformulario.openwith() just wont ? don't it. can explain me ? in advance your problem looks line: $("#"+self.id+"").show(); (which doesn't need last "", $("#"+self.id).show() , that's not issue) self this openwith function, not have dom element id.

java - MQ Channel restart from code giving error -

i have written java code start , stop mq channel. have created server-connection channel on mq testing code. while executing java code, both start , stop of channel gives errors. stop channel gives below error: about stop channel mqje001: completion code 2, reason 2202 start channel gives following error: com.ibm.mq.mqexception: mqje001: mqexception occurred: completion code 2, reason 2009 mqje016: mq queue manager closed channel during connect closure reason = 2009 code: package com.asm.mqlistenerchannelrestart; import com.ibm.mq.pcf.*; import com.ibm.mq.*; import com.ibm.mq.pcf.cmqcfc; public class mqlistenerchannelrestart implements cmqcfc { public void startchannel(pcfagent pcfagent){ pcfparameter [] parameters = new pcfparameter [] { new mqcfst (mqcach_channel_name, "testchanne"), new mqcfst(mqcach_user_id,"user"), new mqcfst(mqcach_password,"password") };

asp.net mvc 4 - Database initialization strategy Code First -

i have asp.net-mvc application migration enabled , simplemembershipprovider configured use database tables/fields. my question is, put database initialization? because i'm still developing it, i'm okay dropping database/tables , data , recreate it. i have put in configuration.cs file, i'm not sure if that's place database initializer. namespace cfcontext.migrations { using system; using system.data.entity; using system.data.entity.migrations; using system.linq; using webmatrix.webdata; using system.web.security; using system.collections.generic; internal sealed class configuration : dbmigrationsconfiguration<datacontext> { public configuration() { database.setinitializer(new dropcreatedatabasealways<datacontext>()); //database.setinitializer(new dropcreatedatabaseifmodelchanges<datacontext>()); automaticmigrationsenabled = true; automaticmigrationdatalossallowed = true;

wpf - the selectionChanged is executed twice, why? -

i have wpf application use mvvm pattern. have datagrid , use mvvm light convert event commad event selectionchanged , pass parameter selectionchangedeventargs. i have set selection mode extended, because select many rows in data grid. when select 1 row, works fine, if use ctrl pr shift select many rows, event executed twice, first 1 has rows select, property addeditems of parameter has items selected , removeditems empty. how ever, in second execution addeditems empty , removeditems has items. why if selecting items, not deselecting them? after that, in data grid can see have correct items selected, in property of view model stores selecteditems empty, state not coherent. the event commad 1 way mode. thanks.

javascript - Add params in html5 video (jQuery) -

i'm beginner in javascript , jquery , add parameter video element javascript. <script> $(document).ready(function () { $('#foo').append($('autoplay')); }); </script> <video id="foo" source type="video/mp4" src="foo.mp4"> i want result be: <video id="foo" source type="video/mp4" src="foo.mp4" autoplay> this didn't work me. suggestions? to change property on element should use prop() $('#foo').prop('autoplay', true); http://api.jquery.com/prop/

javascript - knockout computed not being updated -

i trying create computed observable , display on page, , have done way before starting wonder if knockout has changed - works except binding on totalamount - reason never changes...any ideas? my model follows: var cartitem = function(item){ this.itemname = item.title; this.itemprice = item.price; this.itemid = item.id; this.count=0; } var cartmodel = { self:this, footers:ko.observablearray([{title:'item1',text:'this item1 text',image:'images/products/items/item1.png',price:15.99,id:1}, {title:'item2',text:'this item2 text',image:'images/products/items/item2.png',price:25.99,id:2}, {title:'item3',text:'this item3 text',image:'images/products/items/item3.png',price:55.99,id:3}, {title:'item4',text:'this item4 text',image:'images/products/items/item4.png',price:5.99,id:4}, ]), cart:ko.observablearray([]), addtocart:function(){ if(cartmodel.cart().len

c# - How Serialize single value by json.net? -

i serializing student class using json.net . i add serialized object attribute (called cheak not member of student class. this class student: public class student { public int id { get; set; } [jsonignore] public faculty faculty { get; set; } [jsonproperty("faculty")] public string facultyname { { return faculty.name; } } public double avg { get; set; } public datetime dateofbirth { get; set; } public string educationinfo { get; set; } public string fathername { get; set; } public string firstname { get; set; } public string lastname { get; set; } public string mothername { get; set; } public string password { get; set; } public string personalinfo { get; set; } } json: { "id": 24, "faculty": "engen ", "avg": 3.0, "dateofbirth": "1990-02-02t00:00:00", "educationinfo&

Apache couchdb 1.3.0 build from source not stopping -

i build apache couchdb 1.3.0 source on ubuntu 11.10 following instructions on http://wiki.apache.org/couchdb/installing_on_ubuntu i able server , running, stop not working. i using commands below sudo service couchdb start sudo service couchdb stop please let know if there missing. stop command stops couch process not heart beat 1 , hence restarts couch once again.

Write text over a circle using html and css -

i'd write text on circle (i mean, text not horizontal, every letter have different orientation). possible using html , css? you! there isn't super simple standardized way set web type on circle (or kind of curve). can done! we'll explore 1 way here. forewarned, we're going use css3 , javascript , not give 2 hoots older browsers don't support of required tech. if you're interested in real project, kind of thing still best served , image proper alt text, or proper feature detection can flip out image fancy technique in browsers can handle it. thanks css-tricks.com demo download files documentation html <h1> <span class="char1">e</span> <span class="char2">s</span> <span class="char3">t</span> <span class="char4">a</span> <span class="char5">b</span> <!-- idea --> </h1> css h1 span { font: 26px mon

java - CloudBees Service Level Agreement(s) and Capabilities Service -

i have been comparing java paases , really starting cloudbees. have 1 big concern them, , sla/uptime. after scouring through of documentation, can find one paper offer on slas states: if using cloudbees paas without taking advantage of high availability options, cloudbees can offer uptime approaches base uptime sla of infrastructure cloud provider. as same paper mentions, amazon seems offer 99.95% uptime, , know cloudbees runs - largely - on aws/ec2 instances itself. so spawns number of closely-related sla questions: if don't take advantage of "high availability" options, can assume cloudbees doesn't guarantee 99.95%? or there documentation elsewhere state uptime is, , remedies failing meet uptime? what high availability options talking here? read entire developer docs , never saw ha. what remedies if partner service (like sendgrid mail, or memcachier caching) goes down? 1 thing gae capabilitiesservice where, before go use email api, or cach

Convert Text file to XML file -

i want parse teh content of text file in below format example of text file data key1:value1 key2:value2 key3:value3 now want above content parsed key-value format , make xml file text file. example of xml file data (i want type of format) <string name="key1">value1</string> <string name="key2">vaue2</string> <string name="key3">value3</string> this should either done thorough script file in windows or command prompt. could please ant 1 have better idea how solve on issue or please provide me example code or link of tutorials? problem trivial using program called awk $ awk -f: 'begin{print"<data>"} {printf"<string name=\"%s\">%s</string>\n",$1,$2} end{print"</data>"}' input.txt <data> <string name="key1">value1</string> <string name="key2">value2</string> <string name=&

awk - selecting some columns with grep -

i have text file this experiment replica module obs general0 0 scenario.host[12].wlan.mac 189 general0 0 scenario.host[4].wlan.mac 1109 general0 0 scenario.host[2].wlan.mac 1250 general0 0 scenario.host[0].wlan.mac 1150 general0 0 scenario.host[6].wlan.mac 5636 general0 0 scenario.host[102].wlan.mac 16826 general0 0 scenario.rsu.wlan.mac 41030 and going calculate sum of numbers in column after "scenario.rsu.wlan.mac" with script #!/bin/bash input_files=$1 experiments=$2 replicas=$3 if [ -z "$input_files" ] echo "usage: $0 input data file.data (willcards allowed)" fi echo "experiment replica mean" find . -name "$input_files" | while read file export module=`echo $file | cut -d- -f 2` module=${module/.data/} exp in $experiments; rep in $replicas; data=`cat "$file" | grep general$exp | awk -v replica=$rep 'begin {sum=0;n=0} {if ($2 == replica && $3 == "scenario.rsu.wla

ios - Image View is Causing Awkward Hang? -

i've been working on couple days (off & on) , i'm not exactly sure why isn't working, i'm askin pros @ sof insight. newsitem.m on first view controller, i'm reading json feed has 10+ items. each item represented newsitem view allows title, body copy, , small image. uiimageview has iboutlet called imageview . i'm loading image imageview asynchronously. when image loaded, i'm dispatching notification called image_loaded . notification picked on the newsitemarticle dispatch_queue_t concurrentqueue = dispatch_get_global_queue(dispatch_queue_priority_default, 0); //this start image loading in bg dispatch_async(concurrentqueue, ^{ nsdata *image = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:self.imageurl]]; //this set image when loading finished dispatch_async(dispatch_get_main_queue(), ^{ [self.imageview setalpha:0.0]; self.image = [uiimage imagewithdata:image]; [self.imageview setimage:self.ima

ruby on rails - disable rack-mini-profiler in resque worker -

does know how disable rack-mini-profiler in resque worker? i'm running on heroku environment identical web server, in resque worker don't want mini-profiler instrument database calls (it errors out occasionally). ideas? look @ document there . there option (pre_authorize_cb) enable/disable profiler on given request. "resque based" requests have callback return false disable profiler them.

javascript - Fixed scrolling div refusing to stick in IE -

i have following code have div sticks after it's scrolled. works in modern browsers except ie (8, 9 or 10). any quick fixes? appreciated. <script> //turns sidebar fixed scrolling var header = document.queryselector('.stickysidebar'); var origoffsety = header.offsettop; function onscroll(e) { window.scrolly >= origoffsety ? header.classlist.add('sticky') : header.classlist.remove('sticky'); } document.addeventlistener('scroll', onscroll); </script> ie 8 not support addeventlistener , must use attachevent (see: https://developer.mozilla.org/en-us/docs/web/api/eventtarget.addeventlistener#compatibility ) an example work around (modified mdn page): if (el.addeventlistener) { el.addeventlistener('scroll', onscroll); } else if (el.attachevent) { el.attachevent('onscroll', onscroll); }

java - How to pass text from activity to another? -

i want on first activity (in layout write) name?! when person write name when movie anther activity should appear hello(the name)! how should this? this how call intent parameter intent search = new intent(firstactivity.this, secondactivity.class); search.putextra("param_a", content1); startactivity(search);

jquery - Responsive website not showing menu until page loads -

i making website responsive aim make more "app like" tablet (ipad portrait , bellow) , mobile. is(was) going using css media queries. the problem page loading. user can search products. responsive menu , other accordian tabs not working until page has loaded. responsive menu http://www.meanthemes.com/plugins/meanmenu/ , accordian jquery. not working mean responsive menu not showing @ , accordion tabs staying open until page has loaded. i have hidden on page other menus populated database desktop....and have tried totally removing code.....this did speed things little still same problem. i know answer use jquery mobile(which advised) , start again....but customer wanted site responsive any advice appreciated accordion , other menu elements visual components not initialized until javascript them executed. jquery ui can large 100k , depends upon jquery 80k. standard practise execute jquery code in $(document).ready() callback, on mobile device can

extjs4 - Why Menu items are not coming in IE10 using Extjs 4.1? -

i have done application using extjs 4, contains feature menu. menu items showing nicely in browser ie9, firefox, chrome , safari. issue coming when launch same app in ie10 menu not showing menu items. when inspect element menu contains menu items data. can tell me why not displaying in ie10? how showcase menu items data. adding dynamically items menu using reference of items. below code. refs:[ { ref: 'region', selector: 'globalnavigationview > button[name="btnfilter"] > menuitem[text="region"]' }, within funcalling here regionvalue contains list of items. this.getregion().menu.removeall(); dynamicregion=new array(); for(var i=0; i<regionvalue.length; i++){ var objsubr=new object(); objsubr.cls= 'filtermenucls'; objsubr.text=regionvalue[i]; dynamicregion.push(objsubr); } this.getregion().menu.add(dynamicregion); ext js 4.1

php - regular expressions missing out certain letters -

is there simple way ignore/miss out letters. problem find word 5 letters long not contain letters b,j,m or n. can specify letters want such [a][c-i][k-l][o-2]? doesn't appear clean , still need specify word needs 5 letters long. guess need /w , {5} not sure how combine all. thanks. this selects characters except bjmn: [^bjmn]{5} if want lower case letters except listed: [c-ik-lo-za]{5} if don't want 5-letter-words part of longer words, add word boundary checking: \b[c-ik-lo-za]{5}\b

point - convert shape file to raster in matlab -

i convert shape file raster grid using matlab. first tried in python have faced difficulties , superior recommended me use matlab. use matlab randomly , pro in it. the data have ascii file set of points coordinates , want create raster grid them. i thinking can read data, create empty matrix size of (xmin,ymin,xmax,ymax) data. should assign z value each grid cell based on coordinate of corresponding point. the grid size should 0.5m . have copied part of data consideration. thankful if me find right way of thinking application. 32511632.00 5402000.00 354.29 17.50 32511632.50 5402000.00 354.29 17.50 32511633.00 5402000.00 354.35 18.00 32511633.50 5402000.00 354.52 15.75 32511634.00 5402000.00 354.70 12.37 32511634.50 5402000.00 354.61 10.62 32511635.00 5402000.00 354.11 8.50 32511635.50 5402000.00 353.43 9.50 32511636.00 5402000.00 352.72 14.25 32511636.50 5402000.00 352.22 17.62 (the first column x, second y, third z , last in attribute) isize = floor((ymax - ymin

c# - How to restart array once filled on windows form? -

i created form asked user guess number. created array on 100 ints, created method random numbers fill array. working fine required create method resets array 0 once 100 guesses made, , seems let me keep going , going in current set up. how make sure array filling , not restarting every button click, how reset it? again runs great not meeting requirements. here code array , method , calling at: int[] rndarray = new int[100]; int wrong = 1; int right = 1; public void getnumbers() { random random = new random(); (int x = 0; x < rndarray.length; x++) { rndarray[x] = random.next(1, 100); } } public form1() { getnumbers(); initializecomponent(); } then have 2 buttons seeing if guess correct , letting them guess again. private void guess_click(object sender, eventargs e) { bool num = true; (int x = 0; x < rndarray.length; x++) { if (

WCF to Named Pipe does not work when run as a Scheduled Task -

i created process monitoring program (c#) uses wcf handle logging number of processes running on server. local server, , wcf base address "net.pipe://localhost/servicedebughost". when run them explorer, open connection monitoring program , send messages, displays. however, when run them under task scheduler (windows server 2008r2), no messages arrive. have scheduled task run under admin account. the server's service model is: <system.servicemodel> <behaviors> <servicebehaviors> <behavior name=""> <servicemetadata httpgetenabled="false" /> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </servicebehaviors> </behaviors> <services> <service name="servicedebughost.commservice"> <endpoint address="" binding="netnamedpip

active directory - equivalent of gpresult /r with powershell without ad module -

i'm working on powershell script that, after doing stuffs, should launch 1 of 3 applications based on user ad group membership. can't load ad module, i'm using gpresult.exe /r $temp = gpresult.exe /r if ($temp -match "myadgroup") { ... } is there powershell command same thing more efficiently? one way is: $currentuser = [system.security.principal.windowsidentity]::getcurrent() $windowsprincipal = new-object system.security.principal.windowsprincipal($currentuser) if($windowsprincipal.isinrole("myadgroup")) { ... } else { ... }

HTML and Javascript: Multiple images sharing a single map -

i want reuse image map several different images. i'd javascript able know clicked on area 2 of image3 example. possible using javascript? if how pass image id javascript? thanks! <map name="bg_over" id="bg_over"> <area shape="poly" coords="2,44,44,2,44,44" href="team2.html" alt="" /> <area shape="poly" coords="0,0,0,43,44,0" href="team1.html" alt="" /> </map> <a href="#"><img src="/training/rumble_ora/images/bg.gif" width="44" height="44" id="image1" name="image1" usemap="#bg_over"></a> <a href="#"><img src="/training/rumble_ora/images/bg.gif" width="44" height="44" id="image2" name="image2" usemap="#bg_over"></a> <a href="#"><img src="/training/rumble_ora/

assembly - machine code instructions for a program -

how put program instruction c = a-b; in machine code instructions? i've been provided op-codes, memory address a=80, b=81, c=82 , program counter = 30 hex. instructions 16 bits long 4bit op-code, 4bit register , 16 bit memory address. i need know formal way how started. because don't understand lecturer teaches. if can clear direction, confident can without of lecturer. the mnemonics this: mov eax, [a] ; move 4 bytes starting @ address eax register sub eax, [b] ; subtract 4 bytes starting @ memory address b eax register mov [c], eax ; move contents of eax register memory address of c you substitute in opcodes operations ( mov , sub ), register address ( eax ), memory addresses ( a , b , c ) , and result actual machine instructions. i'm assuming here numbers 32 bit integers, i'm using eax register 32 bits long x86 processor, specifics of register use arbitrary, long it's big enough hold number. mov instruction read many bytes register can hold sta

java - Hide part of url -

is there way hide part of url of page? for example instead of www.mypage.com/login&userid=0011/ to show www.mypage.com/login ? i developing webpage liferay , using jsp show content of page , java complete actions want done. any appreciated! in advance! the userid here 'request parameter'. to hide request parameters use post instead of get. the method default method pass information browser web server , produces long string appears in browser's address bar. never use method if have password or other sensitive information pass server. e.g. <form action="myform.jsp" method="get"> a more reliable method of passing information post method.this method packages information in same way methods, instead of sending text string after ? in url sends separate message. e.g. <form action="myform.jsp" method="post">

xamarin.ios - Mvvmcross tableviewcell binding error -

i wrote mvvmcross touch sample app, rip of customermanagement tutorial. have 1 customer in customerslistviewmodel. when run app following error in output (look @ end of post). if load bunch of unrequired plugins in setup class, error goes away. timing issue? you can find code project @ https://github.com/patbonecrusher/mvxtableviewsampleapp.git starting ios simulator 6.1 launching application application launched. pid = 95621 loaded assembly: /developer/monotouch/usr/lib/mono/2.1/monotouch.dll [external] loaded assembly: /developer/monotouch/usr/lib/mono/2.1/system.core.dll [external] loaded assembly: /developer/monotouch/usr/lib/mono/2.1/system.dll [external] thread started: #2 loaded assembly: /volumes/dagon/users/pat/projects/learning-sandbox/mvxbindingtabletest/mvxbindingtabletest/bin/iphonesimulator/debug/mvxbindingtabletest.exe loaded assembly: /volumes/dagon/users/pat/projects/learning-sandbox/mvxbindingtabletest/mvvmcross- binaries/xs-ios-mac/bin/release/mvx/to

python - Define a django model which use in a foreign key a specific instance of an other model -

let's take example problem : models of blog. have django models : class category(models.model): name = models.charfield(max_length=30) class article(models.model): title = models.charfield(max_length=30) content = models.textfield() category = models.foreignkey('category') my problem how define other model use specific category. example, how define cook model, based on article model inheritance, used category 'cook'. thank you. to complete comment: class category(models.model): name = models.charfield(max_length=10) def cook_category(): return category.objects.get(name='cook') class cookarticle(models.model): #your model category = models.foreignkey(category, default=cook_category)

asp.net - Encrypted config file does not apply “remove” tag in connectionStrings -

Image
based on duplicate connection string error question have added remove tag before adding connectionstring. resolved problem original question. but, when applied rsa encryption web.config file (using aspnet_regiis) error came back. parser error message: entry 'theconnectionstring' has been added. i think, when encrypted, not calling ‘remove’ statement. so? workaround issue? original connectionstring <connectionstrings> <remove name="theconnectionstring" /> <add name="theconnectionstring" ... /> <connectionstrings> encrypted config by using clear instead of remove first statement in connectionstrings section, resolve problem. note: clear retained after manually decrypted config file. remove not retained after encryption-decryption. [thanks @oded giving comment check this] refer connection strings , configuration files the machine.config file contains connectionstrings section, contains con

asp.net - stack controls on mobile view -

viewing desktop label , 2 textbox controls aligned horizontally. when user views site on mobile textboxes stack on top of each other. using media query adjust mobile view. other lines stack fine (with textbox under label) problem address have 2 textboxes, 1 on each line. suggestions? questions let me know thanks current css .row { clear: none; width: 100%; overflow: hidden; margin: 5px 0; } .label { float: left; text-align: right; margin-right: 10px; width: 130px;} .value { float: left; text-align: left;} html <div class="row"> <div class="label"> <asp:label id="lblsiteaddress" runat="server" text="site address"></asp:label> </div> <div id="value"> <asp:textbox id="txtsiteaddress" runat="server" width="192px" height="22px"></asp:textbox> <asp:textbox id="txtsiteaddr

javascript - Terminating a web worker -

i have web worker appends paragraphs div , this var worker1 = new worker('many.js'); var worker2 = new worker('many.js'); var worker3 = new worker('many.js'); var worker4 = new worker('many.js'); worker1.onmessage = function (event) { function xx(){$(event.data).appendto('#div_1');} setinterval(xx,4000); }; worker2.onmessage = function (event) { function xx(){$(event.data).appendto('#div_2');} setinterval(xx,4400); }; function killworker(){ worker1.terminate(); } this many.js file function j() {return "<p>lorem ispum</p>"} postmessage(j()); i able destroy worker this worker1.terminate(); but have liked wrap in function , try , terminate following click event button <button onclick="javascript:killworker();">stop worker</button> my code doesn't seem terminate worker.why doesn't work?. is k

Sub-routines in PDP-11 assembly -

so i'm writing program assembly , , i'm trying use sub-routines, have problem. i'v written routine resembles switch case . reads input , , based on it's value , writes reserved address in stack address of following sub-routine. it looks this: 1000 jsr r5,switchcase // let return address 1004 1004 jsr r5,@0(sp) the first jsr goes switch case, writes first address in stack. second 1 jumps address. i'm using simulator , , every time reaches line stops. don't know goes wrong :/ any appreciated. the instruction jsr r5,@0(sp) pushes old r5 onto stack , puts current r7 (pc) r5 . therefore program not jump address on stack, address stored in r5 , wharever is. in example 1st jsr instruction writes r5 onto stack, , assigns 1004 r5 . edit: when program returns rts , restores old value of r5 stack. 2nd jsr instruction pushes again value onto stack, , jumps address, since on top of stack (distance 0). if subroutine called 1st js

C# SharpPCap Read Packet Content -

i'm tryin' read content of packets i've captured sharppcap. little code private void button4_click(object sender, eventargs e) { // retrieve device list var devices = libpcaplivedevicelist.instance; // extract device list var device = devices[1]; // register our handler function // 'packet arrival' event device.onpacketarrival += new sharppcap.packetarrivaleventhandler(device_onpacketarrival); // open device capturing int readtimeoutmilliseconds = 1000; if (device airpcapdevice) { // note: airpcap devices cannot disable local capture var airpcap = device airpcapdevice; airpcap.open(sharppcap.winpcap.openflags.datatransferudp, readtimeoutmilliseconds); } else if (device winpcapdevice) { var winpcap = devic

c# - Can't find some values in array -

i have array of strings, each string built form "<x> <y>" . if y starts on 'n' , seems program not be able find it. so, strings don't work are. "w north", "w n", "walk n", "walk north" can explain why? string[] next = { "next", "ne", "nx", "nxt" }; string[] yes = { "yes", "y" }; string[] no = { "no", "n" }; string[] clear = { "clear", "c" }; string[] = { "help", "h" }; string[] walk = { "w north", "w south", "w west", "w east", "w n", "w s", "w w", "w e", "walk north", "walk south", "walk west", "walk east" ,

animation - Trying to change width on hover using css -

i've done before , don't understand why it's not working. i'm trying this: http://jsfiddle.net/geometron/u3m6r/1/ <ul> <li><a href="content1.html"> demo 1 </a></li> <li><a href="content2.html"> demo 2 </a></li> <li><a href="content3.html"> demo 3 </a></li> <li><a href="content4.html"> demo 4 </a></li> <li><a href="content5.html"> demo 5 </a></li> <li><a href="content6.html"> demo 6 </a></li> </ul> but ul can have less css. i'm getting: http://jsfiddle.net/geometron/6dul9/ the width doesn't seem want change. what doing wrong? tag a behaves bit bad sometimes, when try specify size. a workaround specify display: inline-block a -tag. (it mess rest of style.) see jsfiddle better m

ruby on rails - undefined method when trying to build db with activerecord-postgis-adapter -

i trying deploy rails application using activerecord-postgis-adapter heroku, keep getting error. ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0] rails 3.2.13 $ heroku run rake db:schema:load running `rake db:schema:load` attached terminal... up, run.9233 deprecation warning: have rails 2.3-style plugins in vendor/plugins! support these plugins removed in rails 4.0. move them out , bundle them in gemfile, or fold them in app lib/myplugin/* , config/initializers/myplugin.rb. see release notes more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called <top (required)> @ /app/rakefile:7) deprecation warning: have rails 2.3-style plugins in vendor/plugins! support these plugins removed in rails 4.0. move them out , bundle them in gemfile, or fold them in app lib/myplugin/* , config/initializers/myplugin.rb. see release notes more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called <

PHP cURL fails to fetch images from website -

i've written small php script grabbing images curl , saving them locally. reads urls images db, grabs , saves file folder. tested , works on couple other websites before, fails new 1 i'm trying with. did reading around, modified script bit still nothing. please suggest out for. $query_products = "select * product"; $products = mysql_query($query_products, $connection) or die(mysql_error()); $row_products = mysql_fetch_assoc($products); $totalrows_products = mysql_num_rows($products); { $ch = curl_init ($row_products['picture']); $agent= 'mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; sv1; .net clr 1.0.3705; .net clr 1.1.4322)'; curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer, 1); curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (windows nt 6.1; rv:2.0) gecko/20110319 firefox/4.0'); curl_setopt($ch, curlopt_ssl_verifypeer, false);

html - Overflowing a page-container's background-color using CSS margin and padding -

i working on html/css of landing page of website/application , don't want make many changes. templates rendered using jinja2 , homepage extends page_template.html. there many page templates extend page_template.html fiddle little possible it. designer have background-color of div (or two) on homepage extend out on entire width of browser no matter browser/screen resolution. page template has page-container id wrapping around entire content so. #page-container { background-position: 0 85px; max-width: 1200px; position: relative; margin: 0 auto; } if want extend div go outside width of 1200px decided try this: .overflow { background-color: #fff; margin-right: -200px; margin-left: -200px; padding-right: 200px; padding-left: 200px; } and this: <div id="page-container"> <div class="overflow"> content </div> </div> and seems work. , works enough webapp ( think ). breaks responsiveness of page in divs

Is it possible to put HTML in an ASP.NET .ashx file? -

i wondering possible place html/javascript/etc in .ashx file. tried doing this, , getting error "a namespace cannot directly contain members such fields or methods" the reason want this, because trying implement photoswipe ( http://www.photoswipe.com ). photoswipe needs special css, think losing when go .ashx file. want able add html point @ css file think losing. edit: here example of markup looks like. when click on href, brought new page ".ashx?querystringparms=blah" in browser. here believe losing css. <div style="text-align:center;" class="gallery-page" data-role="content"> <ul id="gallery" class="gallery" style="max-height: 75%;"> <li style="height: 120px; width: 93px; padding-bottom: 2px;"><a href="../utilities/imagehandler.ashx?querystringparms=blah rel="external"><img src="../utilities/imagehandler.ashx?querystringpa

IIS WCF Config: service only uses default behavior -

i learning wcf deployment in iis , have found strange. service uses default behavior regardless of how set behaviorconfiguration attribute of element in web.config. so here's relevant piece of web.config: <system.servicemodel> <services> <service name="tableimport" behaviorconfiguration="myservicetypebehaviors"> <endpoint address="" binding="wshttpbinding" /> </service> </services> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="false" /> </behavior> <behavior name="myservicetypebehaviors" > <servicemetadata httpgetenabled="true" policyversion="policy15" /> </behavior> </servicebehaviors> </behaviors> </system.servicemodel> as can see default servicemetadata element has httpgetenabled="false" whereas myservicetypebe

Is there any equivalent of `to_s` in Ruby? -

i know 123.to_s gives "123" . looking other way have same output 123 . is possible? kernel#string you. string(123) #=> "123"

Jmeter summary report when using loops -

currently have project http requests. pulls urls csv file using loop. this works me. when @ summary report gives me results of 1 request (http) rather requests each url in csv file. there way show each url in summary report when using loop controller? set name of sampler : url-${url_var_csv} where url_var_csv variable name used in csv dataset.

php - not putting id into variable -

the purpose of script productid product user has entered form, id of order has been created in previous script , put these 2 values order_line_item table. i have identified error occurs because there no value in variable called '$db_productid' , when insert value database tries product id can link there no product id of 0 returns following error: cannot add or update child row: foreign key constraint fails ( the_shop . order_line_item , constraint order_line_item_ibfk_1 foreign key ( productid ) references product ( productid ) on delete cascade on update cascade) this script: if (isset($_get['submit1'])) { $dblastid = $_session['lastid']; $db_product_name = $_get['product_name']; $query = "select productid product product_name = '$db_product_name'"; $result = mysql_query($query) or die(mysql_error()); $fetch = mysql_fetch_assoc($result); $db_productid = $fetch['producti

Runing R code on `python` with SyntaxError: keyword can't be an expression error Message -

i'm looking run r code on python i installed r package robustbase on ubunto using apt-get install r-cran-robustbase , rpy packege well. from python console can run from rpy import * , r.library("robustbase") when run result = robjects.floatvector([11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55]) print(result.r_repr()) r(adjboxstats(c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, = -4, b = 3, do_conf = true, do_out = true)) to outliers values but error : adjboxstats(c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, = -4, b = 3, do.conf = true, do.out = true) syntaxerror: keyword can't expression when run on r console works!!! library("robustbase") adjboxstats(c(11232.1, 234.2, 3445532344.3, 34302.3, 203.9, 232223.3, 3434.55), coef = 2.5, = -4, b = 3, do.conf = true, do.out = true) i search here , here , here no luck. doesn knows error message , there&

magento - How can I get the 'friendly' text for product status and visibility attributes? -

how can friendly text products status , visibility options. example, 'enabled' or 'disabled' rather 1 or 2, , visibility 'not visible individually', 'catalog, search' etc rather 1,2,3 or 4? i'm guessing there function somewhere can take $product->getstatus , return text value? , similar 1 visibility? i'm playing getting used magento trying build simple list: $products = mage::getmodel('catalog/product') ->getcollection(); foreach ( $products $product ) { echo $product->getsku(); echo $product->getstatus(); echo $product->getvisibility(); } but status , visibility appear in admin pages rather numeric values. edit: of mufaddal's answer, final solution was; $products = mage::getmodel('catalog/product') ->getcollection() ->addattributetoselect('sku') ->addattributetoselect('status') ->addattributetoselect('visibility') ->addattri

Excel Macro - Add new range to existing Formula Office 2010 -

my macro inserts 8 lines of new job summary spreadsheet. these lines link different file name , has subtotal included =sum() formula (for each job). grand total not include new subtotal range in previous 4 job summary. there more jobs added later has keep working relative future jobs being potentially added. looking easy way add new range existing formula within grand totals cell. help. right cell contains formula: =g37+g29+g21+g13 (these job summary subtotals) after adding 8 new rows of new job have add cell "g45" above formula within macro , if add job "g53". cell add 3 rows above formula want add formulas has continue work jobs updated daily or @ least weekly. help. just append range sum function. =sum(a1:a6) say want add in cells c1 through c6 =sum(a1:a6:c1:c6) say want add in cell d5 =sum(a1:a6:c1:c6,d5) say want add in cells e1 through e6 =sum(a1:a6:c1:c6,d5,e1:e6)

amazon web services - AWS EC2 billed hours per instance in a given time period -

my cio asking me monthly "per instance" breakdown of ec2 charges, of our ec2 instances run on behalf specific customers. know how accomplish this? i can use java, python, or aws command line tools if necessary, report tools or service preferable. there new tool open-sourced netflix called ice allows visualize billing details retrieved via aws reports generated s3 buckets. you might want check answers on @ serverfault similar question .

javascript - Full calender delete an event -

i looking delete event full calender via event confirmation dialog box when clicked. looking use form(with text-boxes) save values calender. have read documentation not know how implement, place , how use functions such as: .fullcalendar( 'removeeventsource', source ) the calender implemented need these last few functions. here code, copy , paste notepad run , see. <!doctype html> <html> <head> <link href='../fullcalendar/fullcalendar.css' rel='stylesheet' /> <link href='../fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' /> <script src='../jquery/jquery-1.9.1.min.js'></script> <script src='../jquery/jquery-ui-1.10.2.custom.min.js'></script> <script src='../fullcalendar/fullcalendar.min.js'></script> <script> $(document).ready(function() { var equip = document.getelementbyid('equipment').value; var