Posts

Showing posts from January, 2014

javascript - Allow content documents (web pages) to detect my Firefox addon -

in firefox addon i'm looking secure way let content code detect presence of addon itself. ideally i'd end allowing content code query presence of addon executing: if (window.navigator.my_addon) { // addon present } else { // addon not present } any suggestion/pointers? adapted here (but using getter make my_addon value read-only) // contentwindow window object of contentdocument being displayed var s = new components.utils.sandbox(contentwindow); s.window = contentwindow; components.utils.evalinsandbox(" window.wrappedjsobject.navigator.__definegetter__('my_addon', function(){ return true; // or whatever want value // (note: unprivileged code!) });", s );

html - How do I import text from a user generated .txt-file to a div with PHP? -

this first experience php, bare me. i've made ecard using flash , dreamweaver. on ecard form fill out, name, email, comment, , name , email person sending ecard to. (http://ornryd.com/test/playfulform/) when push "submit"-button sends email receiver, , creates .txt file on server info. the .txt-file has unique name generated by: $mailcount = $_post['me_count']; $sendername = $_post['me_name']; $senderemail= $_post['me_email']; $sendercomm = nl2br($_post['me_com']); $date = date("l js f h:i:s"); $tosubject = "email $sendername via $webname"; $emailbody = ""; $emailcount = 0; $createecard = date(u); $filename = $createecard.".txt"; $sendername = stripslashes($fromname); $sendercomm = stripslashes($sendercomm); $id = stripslashes($id); $today = (date ("l ds of f y ( h:i:s )",time())); $created="ecard created on $today"; $ecardnum = $ecardselect; $ecardtext =

login validation in flex -

i new flex, have problem while username , password validation.i retrieved data (username , password)from xml doc using http service problem have verify username , password entered user username , password of xml doc...can tell me how possible? my xml doc follows: <employees> <employee> <username>ndo1</username> <password>1234</password> </employee> <employee> <username>ndo2</username> <password>1234</password> </employee> <employee> <username>ndo3</username> <password>1234</password> </employee> <employee> <username>ndo4</username> <password>1234</password> </employee> <employee> <username>ndo5</username> <password>1234</password> </employee> </employees> it big security leak if trying transfer account informations client

java - Web Interface or Graphic UI -

hey, i've simple question. task: program backup system can used server-, or desktop-systems. backup system should include graphical configuration , status view. programming language should java. question: use web interface, solve these jobs or create gui in swing? my thoughts: - web interface has advantage is accessible everywhere (server - configuration made easy without additional software on client side). - gui has advantage more responsive web interface , maybe more professional on desktop-system than, web interface version. which solution whould choose? thanks! the desktop vs. web app discussion depends on use application, , where. if it's going used person sitting @ desk (or @ desk of server), desktop application choice. if user may remote web application way go. another consideration deployment. going deployed on 1 or 2 machines, or need installed / available 10's, 100's or 1000's of users? deployment , updates across hundreds of mach

java - Log4j properties and log4j.xml -

how actions , exceptions running in project file of log4j. 1 use logger mechanism log exceptions , error file stored in hard disk drive or server location (example : c:\\myproject\logs\mylog.txt ) the logger mechanism im talking usage of log4j in logging exceptions reported in application in separate path. log4j.jar has placed in lib folder along other related jar files. useful link : http://www.mkyong.com/struts/struts-log4j-integration-example/

hibernate - Rolling back and 2nd level collection cache -

i have hibernate 2nd level cache provided ehcache. i have parent , child classes, parent.children cached collection. when execute following code: session session = datasessionfactory.opensession(); transaction tx = session.begintransaction(); parent parent = // load session child child = new child(); child.setparent(parent); session.saveorupdate(child); session.flush(); session.refresh(parent); tx.rollback(); session.close(); session = datasessionfactory.opensession(); tx = session.begintransaction(); parent = session.load(parent.class, parent.getid()); system.out.println(parent.getchildren()); the last line fails exception, trying load child not exist. after investigation found reason it's trying load child have been created , rolled in previous transaction. what correct way configure caching, or roll transaction, collection cache cleared properly? don't want purge collection caches on rollback, thank you. looking way make hibernate or ehcache me minimal i

c# - "Object expected" error while calling javascript function -

i want change visibility of textbox, according value selected in dropdownlist. i have created function this: function showgiftcardsource() { var ddlgiftcardsource = document.getelementbyid('<%=ddlgiftcardsource.clientid%>'); var txtgiftcardsource = document.getelementbyid('<%=txtgiftcardsource.clientid%>'); if (ddlgiftcardsource.value == "other") { txtgiftcardsource.style.visibility = "visible"; txtgiftcardsource.focus(); } } in cs page: ddlgiftcardsource.attributes.add("onchange", "onselectedindexchanged();"); and in control: <asp:dropdownlist id="ddlgiftcardsource" runat="server" width="151px" onchange="showgiftcardsource();"> but i'm getting following error: microsoft jscript runtime error: object expected could 1 please me resolve it? change code behind to: ddlgiftcardsour

x509certificate - FindPrivateKey under Windows 7 64 bit doesn't work -

i've downloaded .net sample findprivatekey, compiled framework 4.0, tried different platforms (32bit, 64bit, cpu) didn't work. same error: ordinal 345 not located in dynamic link library comctl32.dll. use windows 7 enterprise, 64 bit version. method call fails: matches = x509certificate2ui.selectfromcollection(store.certificates, "select certificate", "select certificate find location of associated private key file:", x509selectionflag.singleselection); problem here? aleksandar this morning i’ve encountered same problem (ordinal 345 not located ...)… i’ve tried application in 3 different pc win7 64bit; in 1 of these exception throws. found problem in use of comctl32.dll library (which different mine). you can execute piece of code in order check version of library using: foreach (processmodule module in system.diagnostics.process.getcurrentprocess().modules) if (module.modulename.tolower() == "comctl32.dll")

sql server - Is there a stored procedure to work out what indexes I should add? -

firstly, apologies if on wrong site. secondly, vaguely remember couple of years ago, when trying heavily index sql server 2005 db there stored procedure run output stats on tables judge indexes should placed. am right in this, or dreaming it? sql server 2005 , above have missing indexes dmv .

javascript - Is there an oncomplete event for HTML5 audio? -

is there oncomplete event html5 audio? not find on this. trying play sound after completes. well, trying play through array of sounds 1 after other. thanks. there ended event . . . http://dev.w3.org/html5/spec/overview.html#event-media-ended here examples: http://forestmist.org/2010/04/html5-audio-loops/

iphone - Three20 + Core Data Simple Example -

i've combed through so, google group, , blog-o-sphere trying find example of how three20 library work core data, , have not found speak of. does here know find simple tutorial (or willing post one) on how work core data entities , three20? maybe like: i have core data entity called book has string attributes title , description . how create simple app open table view showing listing of books, , when row touched push view onto nav controller displays selected book object's attributes? (just idea -- shows how work core data / three20 appreciated) thanks! there branch of three20 - coredatasupport - supports using nsfetchedresultscontroller. there find nsfetchedresultsdatasource.

php - pChart does not render to web browser, only shows missing image -

pcharts documentation says should able render image browser using code. mypic.php $mypicture->stroke; mypage.html <img src=‘mypic.php‘> the img tag supposed invoke php script. within php script, stroke function sets content-type: image/png . so here have: netsales.php <?php include('../class/pdata.class.php'); include('../class/pdraw.class.php'); include('../class/pimage.class.php'); /* query sales , create new image */ $mypicture->stroke; ?> index.php <?php include ('netsales.php'); ?> <!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"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <div> <img src="netsal

c# - Use BeginOutputReadLine when the process output newline or return -

i used process() execute external file named "test.exe". the "test.exe" prints string. "abc \n \r xyz\n" my goal string , turn each byte corresponding ascii code. that is, expect outputs in c# console below, 97 98 99 32 10 32 13 32 120 121 122 10 but when used beginoutputreadline output of test.exe, \n , \r striped. as result, got 97 98 99 32 32 32 120 121 122 finally, don't want use synchronized ways read, readline, , readtoend. there way want?? thanks! actually, create backgroundworker deal external process test.exe have proc_datareceived , backgroundworker_build_progresschanged... the related code below http://codepad.org/gmq1xqxb all code below http://codepad.org/k7vpwynu (i'm new stackoverflow. pasted code in codepad.org before finding out how format code here.) if use beginoutputreadline, string won't contain "end of line" characters (or of them). see capture output unrelated process way

iphone - Add a view to a UITableViewCell's contentView when it is selected -

i trying add new view 5 buttons cell once selected . trying in 3 different ways. first 1 checking if selected inside - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath method. if (cell == nil ) { //initial customizaton of cells } else { if ([cell isselected]) { //i add view cell's contentview here never enters if though cell still blue, scrolled table , forth several times , blue cell never evaluated here } } i have tried inside following 2 methods: - (nsindexpath *)tableview:(uitableview *)tableview willselectrowatindexpath:(nsindexpath *)indexpath and: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath i used tableview:cellforrowatindexpath: reference cell , when had reference tried adding view inside cell's contentview didn't seem work(by "didn't work" mean didn't appear, i'll debug further). i know didn't provide detaile

java metro framework - Help analyzing glassfish server hang problem -

we running glassfish server around 20 jax-ws metro web services. server specs core2duo 8gb ram. using single http listener web services. development set true. request thread count 2 , acceptor count 1. minimum , maximum heap sizes 1gb , perm gen set 512mb. services access oracle database via hibernate layer , there many interservice calls between services. front end asp.net. our problem when 4-5 users try access application simultaneously time (1 hour) glassfish server hangs cpu going 100% memory utilization around 10-11%. not able find pointers how debug problem. on instances log file gives java.lang.outofmemory exception : permgenspace. not everytime, i.e. on many occassions log file not give error on hanging. glass fish server not start if try increase perm gen space. need direction on how diagnose , move towards solution problem. glass fish version using v2.1. have following observations: 1. adding more http listeners (1 listener per 4-5 services) prolong failing time not effe

html5 - beginner questions about canvas elements with imported images... caching and changing colors -

couple noob questions canvas element in html. first, images imported canvas element cached? across browsers? and second can import black , white png canvas element , change black color different color? there nothing in canvas spec saying images must cached. with canvas, need image html element already. way can interact canvas call .drawimage() on canvas' context. there's no caching or saving after event. canvas prints pixels of image onto , forgets ever happened. no history, no caching. you can draw (no importing) black-and- transparent png onto canvas, , change black color different color. you change canvas context's globalcompositeoperation 'source-atop' , fill image space color of choice. you same if black-and-white instead of black-and-transparent, take more work.

Control sizing and position will change when form will resize in win form application c# -

suppose have label , button on textbox , want if resize win form label , button size , position change. got solution in wpf working win form apps. here giving url can see kind of output looking form. url http://i.stack.imgur.com/qeovk.png . please see image , tell me how can implement same output in win form apps. please me code snippet in c#.thanks. consider window forms , wpf very different, ui management , controls nesting / ui composition. i have seen articles describing trying in windows forms, long ego, it's called control scaling if recall well.

.net - When should I use a BitVector32? -

i working on project @ moment need show 1 month days still available. there function calculates days available. colleagues said:"oh know, should return bitvector32 . that's efficient when working list of booleans." have used list<bool> or that. bitvector32 seems me low level stuff when working bits. so, question is. should use bitvector32 whenever need list of booleans less 32 items or should use low level stuff? using list extensible other time periods. want show 2 month @ once. oh that's bigger 32. need change return type , everywhere it's used. great! , bitvector32 doesn't implement ienumerable<t> . and unless it's in tight loop readability , maintainability top efficiency. , overhead of list allocation isn't big, unless million times per second. so agree you should use bitvector32 low level code.

What can iOS apps do in the background? -

am able make app process while in background, or sit dormant until brought foreground? can have issue http requests, instance? if can figure out how make app fit within bounds of " app states , multitasking " under "background execution , multitasking" section, answer yes.

PHP to ASP.Net conversion -

i converting old php porject on asp.net (vb) , wondered if point me in right direction in order convert final snippet of code. there 3 functions called within , ahve converted , honest session arrays giving me headache. i have thought using hashtables , direccasting confusing me further. any apreciated. $response = array(); $messages = array(); if (!empty($_post['cbox'])) { if (!empty($_session['opsd_user_'.$_post['cbox']])) { $messages = $_session['opsd_user_'.$_post['cbox']]; } } else { if (!empty($_post['blist']) && $_post['blist'] == 1) { getblist(); } if (!empty($_post['initialize']) && $_post['initialize'] == 1) { getstatus(); if (!empty($_session['opsd_sessionvars'])) { $response['initialize'] = $_session['opsd_sessionvars']; if (!empty($_session['opsd_sessionvars']['openc

Content not showing in Joomla modules -

i build simple client site in joomla last summer. http://squirtz.ca somewhere along line, after site had been completed, content stopped showing in modules. menus don't show up, polls modules doesn't show up, nothing. funny thing headings of modules show, not content. i have searched while now, trying find solution other fresh reinstall of joomla, thoughts or advice appreciated! my thoughts: the database may have been corrupted. there may have been auto-update host (godaddy) caused break (highly unlikely) there may have been change in server that's causing issue you did not install or change in mean time? more info on setup helpful. did install and/or use non-default extensions? components, modules, plugins? maybe godaddy provide non-joomla-defaults default? tagged question joomla-extensions, did not provide info on setup. check in admin section in modules section modules, , ones active, , settings use (e.g. shall show). check things displayed

iphone - Remove glossy from my game icon in GameCenter app -

how it? uiprerenderedicon removes glossiness springboard icons. has binary been uploaded , approved apple? in experience, until upload binary, itunes connect , game center don't know want gloss turned off. info app plist after upload it. after game goes live, glossiness should gone (that's happened me, anyways).

python - generating non-html output from google's app engine -

i'm trying dynamically generate ical output using max m's icalendar python module , google's app engine. however, when omit boiler plate <html> header , footer tags on output webapp.requesthandler , looks http 200 response added top of file. when register code: class calendar(webapp.requesthandler): def get(self): self.response.out.write('begin:vcalendar\n') [...] with webapp.wsgiapplication , response looks like: status: 200 ok content-type: text/html; charset=utf-8 cache-control: no-cache expires: fri, 01 jan 1990 00:00:00 gmt content-length: 11133 begin:vcalendar [...] how omit <html> tags and not http 200 response splatted @ top of page? webapp , app engine don't care content type return, issue unrelated tag (or lack thereof). have print statement somewhere in code, causing headers sent part of body of response. should never use print in wsgi app - use self.response.out.write in snippet pasted

ajax - Sharepoint 2010 wcf service. call method with jquery -

i have wcf service hosed in sharepoint application. when try call method jquery fails. i have tested service such string: ttp://localhost/_vti_bin/webservices/wcfservice.svc/**mex** and have normal response. wcf test client have response too. but in javascript code recieve error. why? doing wrong? $.ajax({ url: "/_vti_bin/webservices/wcfservice.svc/helloworld", datatype: 'json', contenttype: "application/json", success: function (res) { alert("good answer"); }, error: function (xhr) { alert("error"); return; } }); browser response: <wsdl:definitions name="wcfservice" targetnamespace="http://tempuri.org/"> <wsp:policy wsu:id="basichttpbinding_wcfservice_policy"> <wsp:exactlyone> <wsp:all> <http:ntlmauthentication/> </wsp:all> </wsp:exactlyone> <

powershell - Find character position and update file name -

what function might use find character position in string using powershell 2.0. i.e use charindex or patindex if using sql server. i looked @ using select-string cmdlet doesn't seem need do. ultimately i'm looking find "_" character in file name , strip off following "." . example file name 237801_201011221155.xml final solution, below strips out characters , including <_> <.> .xml files in current directory get-childitem *.xml | rename-item -newname ` { $_.name -replace $_.name.substring($_.name.indexof("_"), ` $_.name.lastindexof(".") - $_.name.indexof("_") ),''} will end 237801.xml the string .net string can use .net methods. in case: $index = "the string".indexof(" ") will return 3, first occurrence of space in string. more information see: http://msdn.microsoft.com/en-us/library/system.string.aspx for need try like: $s.substring($s.indexof(

Are flash cookies the same as http cookies? -

are flash cookies same http cookies? are stored in text files? why flash cookies have higher storage capacity? is security risk? translation? additional difference flash cookies shared between browsers installed in system, whereas usual cookies "local" browser. again, if browser has separate profiles, profiles sharing same set of flash cookies.

Entity Framework: 0..1-to-many foreign key constraint not recognized? -

i using ef4 map db schema object model; generated edmx database have been editing xml directly (trying leave ssdl same while changing csdl/msl approximate object model want). database contains, among many other things, couple tables (0..)1-to-many constraint via foreign key so: go create table options ( kitnodeid int primary key foreign key references kitnodes (kitnodeid), [skuid] int null foreign key (skuid) references skus (skuid) ) go create table upgrades ( upgradeid int identity (1, 1) primary key not null, [name] nvarchar(50) not null, defaultoptionid int null references options (kitnodeid) ) the relevant sections in edmx this: [...] <!-- ssdl content --> <edmx:storagemodels> <schema namespace="dmodel.store" alias="self" provider="system.data.sqlclient" providermanifesttoken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/entitystoreschemagenerator" xm

python - Django: Display a custom error message for admin validation error -

i'm using django 1.2.4. have model has field needs validated. when validation fails, i'd display custom error message user. model editing done in admin interface. this i'm doing currently: def clean_fields(self, exclude=none): # validation if problem: raise validationerror({'field_name': "error message"}) unfortunately, print out separate validation message on admin page each character in value of field_name . what proper way signal error message want? without looking, sounds admin looking iterable value field_name . try: raise validationerror({'field_name': ["error message",]}) i think admin expects number of validation messages associated each field on form.

stored procedures - MySQL - Keep getting records if last record is higher than previous -

i don't know if concept possible -- maybe in stored procedure? consider 2 row table: `id` (int) | `value` (int) | `date` (datetime) lets these rows exist: 1 | 3 | 2011-02-18 2 | 5 | 2011-02-19 3 | 12 | 2011-02-20 4 | 7 | 2011-02-21 5 | 8 | 2011-02-22 6 | 10 | 2011-02-23 i trying find trends, rather obvious human eye recognize last 3 values going each day: 7 -> 8 -> 10. possible rows remain in pattern? i'm thinking stored procedure might able read through rows sequentially , find first pattern (10 > 8), continue checking until no longer matches concept: ( 8 > 7 ), not ( 7 > 12 ) stop. any advice in right direction helpful. set @was:=null; select id ( select id, @was was, value now, (@was:=value) the_table order date ) trends not null , now<=was limit 1;

django - RequestContext returns 404 error for my imagaes? -

i stumbled on silly situation django's requestcontext thing. here question: i stored images in media/uploads file. in template i'm using : {% photo in photos %} <a href="#"> <img src="{{gallery_root}}/{{photo.get_name}}" /></a> {% endfor %} my view : def gallery_view(request): photos = photo.objects.all() return render_to_response('gallery/samplegallery.html',{'photos':photos},context_instance=requestcontext(request)) in settings file : gallery_root = os.path.join(media_root, "media/uploads") and have contextprocessor file contains: from django.conf import settings def gallery_root(request): return {'gallery_root':settings.gallery_root} when open template, image's path appears server gives 404, path seems correct django can not serves them.. what's reason can not see images on template ? the image source appears : <a href="#"> <img src=&quo

java - submitting a multiple values and hidden values on checkbox in html -

is there way submit multiple form fields tying 1 checkbox eg: <input type=hidden name=code value="cycle_code" /> <input type=checkbox name=vehicle value="cycle" /> <input type=hidden name=code value="car_code" /> <input type=checkbox name=vehicle value="car" /> i want able check car , car_code submitted also. , same cycle you use javascript dynamically set value of hidden field.

php - json_encode issue -

i have code if($_post){ // response hash $response = array('type'=>'', 'message'=>''); try{ // sort of data validations, simple example below $required_fields = array('name'); foreach($required_fields $field){ if(empty($_post[$field])){ throw new exception('field empty'); } } // ok, field validations ok // add data db, send email, ect. // let's assume ok, setup successful response $response['type'] = 'success'; $response['message'] = "done"; }catch(exception $e){ $response['type'] = 'error'; $response['message'] = $e->getmessage(); } // ready turn hash json print json_encode($response); exit; } and want redirect page ( ok.html ) after 'success'. how can make it regards

coldfusion - Does VAR scope in function really get Garbage collected quickly if the reference is shared? -

if have function say <cfcomponent name="details"> <cffunctiion name="getdetails" access="public" returntype="struct"> <cfscript> var mydetails = {}; mydetails.fname='lilly'; mydetails.lname ='flower'; </cfscript> <cfreturn mydetails > </cffunction> </cfcomponent> now call function , return session variable <cfset session.mydetails = details.getdetails()> what here reference of structure mydetails (since complex object) function. believe reference point same memory location created when called function , variable created inside it. so var scope garbage collected since have reference still pointing memory location through new session.mydetails variable!!! when return value object, it's not returned reference. try this: testcomponent.cfc <cfcomponent name="details"> <cffunction name="getdetails" access="public"

haskell - Why is import of an abstract type not necessary, when using functions which work with values of that type -

following excercises in chapter 5 of real world haskell, end prettify.hs, exports among other things abstract type doc , rendering function compact, function doc string. file, prettyjson.hs exports renderjvalue, ends giving me doc value. in main, import renderjvalue , compact, , use output of 1 input other. confused why works. think have been necessary import abstract doc type. can haskell see 2 functions fit without doc imported? for illustration, main.hs: module main import system.io import simplejson (jvalue(..)) import prettyjson (renderjvalue) import prettify (compact) main = let val = renderjvalue $ jstring "foo" putstrln $ compact val getline which outputs "foo" can haskell see 2 functions fit without doc imported? yes. to elaborate bit, import saying what's in local namespace, mention doc type in type signature, you'd have import it. ghc doing lot of matching types (and hunting down modules) in background

graph theory - How's A* able to abandon a non efficient path following a better one? -

Image
consider a* algorithm. in google possible find pseudo-code: function a*(start,goal) closedset := empty set // set of nodes evaluated. openset := set containing initial node // set of tentative nodes evaluated. came_from := empty map // map of navigated nodes. g_score[start] := 0 // distance start along optimal path. h_score[start] := heuristic_estimate_of_distance(start, goal) f_score[start] := h_score[start] // estimated total distance start goal through y. while openset not empty x := node in openset having lowest f_score[] value if x = goal return reconstruct_path(came_from, came_from[goal]) remove x openset add x closedset foreach y in neighbor_nodes(x) if y in closedset continue tentative_g_score := g_score[x] + dist_between(x,y) if y not in openset

Is there a simple, universal outbound click tracking method for JQuery / Javascript? -

i'm looking way of tracking outbound clicks web page using javascript/ jquery without modifying of existing page code. solution must work frames, iframes, content different domains, ajax etc. perhaps, javascript wrong technology universal solution. if so, please let me know better. it's easy enough capture clicks on external links. $(document).ready(function() { $("a[@href^=http]").each(function(){ if(this.href.indexof(location.hostname) == -1) { // handle click here } }); }); getting work iframes little trickier. iframe should reside same domain due same origin policy . if should able change css selector above $("#iframe_id").contents().find("[@href^=http]")

oracle - SQL Query to find all possible paths -

i have table : create table testtb (c1 number, c2 number); insert testtb values (1, 100); insert testtb values (2, 100); insert testtb values (3, 100); insert testtb values (3, 101); insert testtb values (4, 101); insert testtb values (5, 102); commit; i'm struggling come sql query return following result when clause : "c2=100" result set: c1 c2 -- --- 1 100 2 100 3 100 3 101 4 101 the reason result set contains "3,101" because it's reachable through "3,100". , same "4,101" : reachable through -> "3,101" -> "3,100". update: table contains identifiers 2 different data sets after similarity join. idea allow user search identifier , show possible matches between 2 datasets. why when user searches "c2=100" want show "3,101" , "4,101" show full graph of matches. thanks. select distinct c1, c2 testtb connect nocycle prior c1 = c1 or prior c2 = c2 start c2

How are these PHP function applied to a specific page in WordPress? -

i'm new php , trying understand practical ways. i'm getting of what's going on in following code, of http://www.php.net , http://codex.wordpress.org/function_reference/ . in current situation, 1 page on site triggers popup form if no cookie set. functionality specified within code? here's functions: if (isset($_post['confirm']) && isset($_post['location'])) { setcookie("location", $_post['location'], time()+3600); } elseif (!isset($_cookie["location"])) { setcookie("location", "", 1); } elseif (isset($_post['deny'])) { setcookie("location", "", 1); } // popup confirmation function show_popup($content) { global $post; $location = get_post_meta($post->id, 'location', true); if (strtolower($l) == strtolower($location) || strlen($location) == 0 || (isset($_cookie["location"]) && strtolower($_cook

c# - Graphic transformations -

i'm working data (stuff sin/cosin waves, etc) repeat frequency m. i've written simple display control takes data , paints connected lines represent data in pretty picture. my question is, data given if painted onto bitmap, quadrant 1 data in quadrant 3 , quadrant 2 data in quadrant 4 (and vice versa). the bitmap of width m , hight array.max - array.min . is there simple transform changing data display in appropriate quadrants? a way of thinking (0,0) in world coordinates divided between (0,0), (width, 0), (0,height), (width, height) which (width/2, height/2) in image coordinates. from there, transform be: data(x,y) => x = abs(x - (width/2)), y = abs(y - (height/2))

javascript: casting an object that has been created with eval -

i have set of javascript classes use throughout app. in 1 case want eval json ajax response shape matches 1 of classes. i'm using jquery parsejson method eval me. the problem want call method defined in class know method won't exist on eval'd object. what's nicest way make method available on new object. there way "cast" it? there no concept of casting in javascript. instead, can modify class' constructor accept plain object. how depends on how you've set class, involve shallow copy of object new instance of class: var myclass = function (obj) { (var in obj) { if (!obj.hasownproperty(i)) continue; this[i] = obj[i]; } // other class initialisation code }; then "cast" object this: var result = new myclass(someobject); if have multiple classes require this, may prefer create extend function cloning (or if you're using jquery, function exists): var extend = function (obj1, obj2) {

javascript - How to fill Jquery UI Progress bar with radio button clicks -

i have jquery ui progress bar fill according how many questions have been answered in form. i have 46 questions radio buttons acting 3 options choose per question. i want progress bar full when questions have been completed. i post code if necessary think explanation enough... thank replys.. cheers. working example here http://jsfiddle.net/ruhley/9depa/ . more efficient , stuff. works , extensible. id of radio buttons can whatever want, make them unique. , names have start same thing.

generics - Scala parameterized type problem with returning an instance of the same type -

in following, present reduced versions of scala code. enough show problem. unnecessary blocks of code reduced ... . the part works i have created vector library (that is, modeling mathematical vectors, not vectors in sense of scala.collection.vector ). basic trait looks this: trait vec[c] extends product { def -(o:vec[c]):vec[c] = ... ... } i have created numerous subtypes specific vectors, vec2 two-dimensional vectors, or vec2int specialized two-dimensional int vectors. the subtypes narrow return types of operations. example, subtracting vec2int vector not return generic vec[int] , more specific vec2int . additionally, have declared methods in specific subtypes vec2int final , thereby allowing compiler elect methods inlining. this works well, , have created fast , usable library vector calculations. building on top of that, want create set of types model basic geometrical shapes. basic shape trait looks this: trait shape[c, v <: vec[c]] extends (v=>

Visual C++ 2010 Express: How to use with Qt? -

i'm confused getting qt working visual studio express. of searches online have turned instructions compiling qt using instructions such as: install msvc2005 or msvc2008 install recent platform sdk (@ msdn: "platform sdk windows server 2003 r2") from platform sdk, you'll need install @ least base + internet options then, download , extract recent snapshot or preview release d:\qt\4.x.x open console msvc settings loaded (see msvc tools-menu) , go qt directory type "configure -platform win32-msvc2005" without quotation marks that build project files you'll need after that, it's simple running "nmake" , drinking lot of coffee then, add d:\qt\4.x.x\bin , d:\qt\4.x.x\lib path environment variable, , you'll able use version of qt everywhere on system. latter added library section in options msvc well. (from http://www.qtcentre.org/threads/11710-visual-studio-2005-express )

iphone - memory leak when JPEG, not when PNG -

my application aims @ saving user photos in pdf file in order send file email. produce small size pdf, want compress images in jpeg. when draw jpeg pdf context, pdf file indeed smaller when use png, use of jpeg leaks. for debugging added jpeg , png file project. the following call leaks : uiimage * destimage = [uiimage imagenamed:@"image.jpg"]; [destimage drawinrect:drawingframe]; whereas 1 not : uiimage * destimage = [uiimage imagenamed:@"image.png"]; [destimage drawinrect:drawingframe]; is there i'm missing ? know issue ? i'm thinking workaround consist in using png representations of images , set specific compression option pdf generate, did not find in pdf generation sdk. do have idea ? in advance.

firefox - Adding items in DOM with jQuery without browser scrollbar update -

i adding many <li> <ul> using jquery append method. when there more <li> browser space can accomodate, expected vertical scrollbar enable scrolling doesn't show @ all. i have tried in firefox , chrome , effect same. it sounds have css issue. scrollbars determined css overflow property. try #myul { overflow:scroll; } or #myul { overflow:auto; }

coldfusion ajax jquery cross-domain -

i'm new cross-browser ajax issues. i'm using following code, doesn't work if cfc on domain , need rewrite it. $.getjson(cfroot + "/series.cfc?method=getsrdetailedtable&returnformat=json&queryformat=column", {"seriesid":seriesid,"inserttempdata":true}, function(res,code) { //code here }); i've played examples ben nadel , few others, can't happening. constructive examples or hugely appreciated. doesn't need use getjson(). can post too. tend use getjson out of habit. in scenario, function performs calculations , updates table. doesn't data. the cfc huge, following first line: <cffunction name="getsrdetailedtable" output="false" returntype="query" access="remote"> i'm not sure understood question, noticed "another domain", if case here's need read crossdomain ajax calls, possibilities , limitations: http://www.ibm.com/developerworks/li

python - Pymssql, How to use it to read unicode data from MSSQL2008 -

i've used pymssql-1.0.2 , freetds-0.82.7 on ubuntu-10.10. also, have mssql2008 server on windows-7. can connect mssql ubuntu using pymssql , freetds. can't unicode data mssql database. database collation cyrillic_general_ci_as. my freetds.conf file looks this: [mssql2008] host=10.0.0.34 port=1433 tds version=7.0 my code looks this: conn = pymssql.connect(host=10.0.0.34\mssql2008, user=***, password=***, database=eoffice, as_dict=true, charset='iso-8859-1') crms = conn.cursor() crms.execute('select cc_name tblhr_codeclass') row in crms.fetchall(): raise u"succeeded! test data: " + row['cc_name'] break expected result is: "Өмнөговь аймаг" actual result is: "ªìíºãîâü àéìàã" when use 'utf-8' charset, fetchall() call throws error means utf8 can't read data out of range of code page. how unicode data stored on mssql database? please give hand! regards, orgil

objective c - XLST in a UIWebView using iOS SDK 4.2 -

is possible use xslt in uiwebview using ios sdk 4.2? alternatively, possible use xslt in ios sdk 4.2 outside of uiwebview? have seen similar questions this, seem dated , refer pre-4.0 ios sdks. if possible, link simple ios xslt example great too. tia. the answer yes. here's example: nsstring *path = [[nsbundle mainbundle] bundlepath]; nsurl *baseurl = [nsurl fileurlwithpath:path]; nsstring *xml = @"<?xml version=\"1.0\"?><?xml-stylesheet type=\"text/xsl\" href=\"greeting.xsl\"?><greeting>hello, world!</greeting>"; [self.webview loaddata:[xml datausingencoding:nsutf8stringencoding] mimetype:@"text/xml" textencodingname:@"utf-8" baseurl:baseurl]; i having problems because trying load xml using uiwebview's - (void)loadhtmlstring:(nsstring *)string baseurl:(nsurl *)baseurl method.

visual studio - How to program MSI installer to write to registry? -

how program msi installer, write user selected installation path registry? later, want c++ program read path registry. create entry in registry table "value" field set targetdir property.

Forcing ignoring errors from ADODB to Excel VBA -

i don't know if possible, figured i'd ask. is there equivalent on error goto next adodb connections in excel vba? i have stored procedure i'm calling using adodb.command object. problem is, if 1 statement in stored procedure throws error, entire process gets shut down. yes, that's appropriate in cases, in case, it's not big deal, i'd continue executing rest of stored procedure anyway. on error goto 0 shows sql error message , gives options "end" or "debug". on error resume next skips sql error message, silently cancels sql command , moves next vba statement. any ideas? edit: i've had request code. i'm not sure much, here: on error goto 0 serverconnection.open "provider=msdasql.1;persist security info=true;extended properties="driver=sql native client;trusted_connection=yes;server=dbserver;database=database";" dim sqlcommand adodb.command set sqlcommand = new adodb.command sqlcommand

php - how to send daily post on facebook? -

hi please if knows tell me how send daily post application user's wall using facebook application. need php script how post message user wall. thanks this question supposed asked on stackoverflow however, facebook documentation has php example this. can use php sdk this. for publishing user's wall app need have publish_stream extended permission , can issue post request http://graph.facebook.com/[username/userid]/feed like: curl -f 'access_token=...' \ -f 'message=hello, arjun. new api.' \ https://graph.facebook.com/arjun/feed

java - Integrating BlackBerry application with Flurry -

has been able integrate flurry blackberry mobile application? have imported flurryagent.jar project, yet when go run application given error "module 'flurryagent' not found." have tried following: preverifying .jar file adding .jar file build path of library project (that main project references) it still not working me after trying above - i'm getting ready pull hair out, there isn't helpful guide this. thanks! in project properties, go java build path section, , order , export tab. make sure check box flurry component checked. that solved me.

ruby - Is there an existing gem or script that converts comp-3/packed decimal format to number? -

i'm starting new adventure convert cobol program ruby program, have convert comp-3/packed decimal format number. from previous post , there code convert number comp-3, not inverse. comp-3 typically ibm method of packed decimal. have had issues in past converting packed decimal on ibm other formats. have pad destination size byte sizes match up. i'm not aware of comp conversion programs or utilities on this.

php - Yii save data to different tables -

i new yii. need save data collected single form 3 different tables. doubts are how can design model class (cformmodel or cactiverecord)?? how design view?? in controller how can save data different tables?? i need manually validate vales md5 hash etc you need create 3 models. , use according model fields , save 3 models. in yii 1 table - 1 model.

bash: comment a long pipeline -

i've found it's quite powerful create long pipelines in bash scripts, main drawback see there doesn't seem way insert comments. as example, there way add comments script? #find vnc sessions ls -t $home/.vnc/*.pid \ | xargs -n1 \ | sed 's|\.pid$||; s|^.*\.vnc/||g' \ | xargs -p50 --replace vncconfig -display {} -get desktop \ | grep "($user)" \ | awk '{print $1}' \ | xargs -n1 xdpyinfo -display \ | egrep "^name|dimensions|depths" this works too: # comment here ls -t $home/.vnc/*.pid | #comment here xargs -n1 | #another comment ... based on https://stackoverflow.com/a/5100821/1019205 . comes down s/|//;s!\!|! .

c++ - Template << and >> operators specialization -

i want template >> , << operators in class, specialize them strings, did this; class sql_command { public: sql_command() { } explicit sql_command(std::string& cmd) : m_raw(cmd) { } inline sql_command& operator<<(const char * arg) { m_raw += arg; return *this; } inline sql_command& operator<<(const std::string& arg) { m_raw += arg; return *this; } template<typename t> inline sql_command& operator>>(const t arg) { m_raw += boost::lexical_cast<std::string>(arg); return *this; } inline std::string const& command() const { return m_raw; } private: std::string m_raw; }; template<> inline sql_command& operator>> <std::string> (const std::string& arg) { m_raw += "'"; m_raw += arg; m_raw += "'"; return *this; } temp

articles's title list generated by drupal views module don't have title tip -

i used views module genereate articles title list, when put mouse hover on article's title .three isn't tip of node title. html code this <div class="views-field-title"> <span class="field-content"> <a href="/resell.html">resell</a> </span> </div> there no title= "", label in <a> label,my views setting add title field , checked l"ink field node." right? how make node title tip show when put mouse hover on article's title. the drupal version 6, views module version 6.x-2.12 instead of "link field node" use "output field link" , set alt text nid. this: add field of nid drag field top of list , set exclude display set "output field link" , link path "node/[nid]" then set alt text [title] alternatively if title attribute required manually add template file. see template edit click theme: information in

http - nginx and proxy_pass - send Connection: close headers -

nginx seems replacing connection: close header upstream sending, , replacing connection: keep-alive header. there way can override it? http { upstream main { server 127.0.0.1:8000; } server { listen 443; ssl on; ssl_certificate server.crt; ssl_certificate_key server.key; location / { proxy_pass http://main; } location /find { proxy_pass http://main; proxy_buffering off; } } } setting keepalive_requests 0; convinced nginx send connection: close .

php - Parsing StdClass Object from file -

i'm using superfeedr php client, , when gets ping, json_encodes , writes ping file. result saved stdclass object. tried load result via file_get_content can not access of data. $obj = file_get_contents('result.txt'); echo $obj->title; the object long looks like: stdclass object ( [status] => stdclass object ( [title] => blah ) [title] => blah ) i haven't used php in long time i'm rusty... seems i'm loading object string can't treat object. right? if so, how approach this? this not appear "save" object file (which not possible anyway), dumps results of print_r($obj) file. useful debugging purposes, it's not possible reconstruct actual object this. you save result of json_encode file, along lines of this: {"status":{"title":"blah"},"title":"blah",...} this can json_decode 'd object or array.

java - call a method in Javascript file -

in struts 2 based application have java classes , jsps. in jsps have included javascript files. have java method return string. want call method in javascript files. how can this? struts server side framework, java running on server. javascript found running in browser (and doesn't sound have involved ssjs solution). therefore: can't. programs running on different computers , can't interact directly. you need issue new http request, including data somewhere can retrieved (e.g. in query string). setting location , generating <form> , calling submit() method, using xmlhttprequest object, dynamically adding <script> element src set appropriately , various other approaches.

sql server - Help with store procedure -

i need following sp. couldnt solve really. have 2 columns in table: 1. parent 2. child i need create sp using rownum create new table given param (level num) display connection between parent , son, or grandfather & grandson, etc... for instance: parent | child 2 4 4 6 the sp return given level of 1 same table, if hand level 2 (grandfather<-> grandson) show: parent | child 2 6 how can that? thanks all! declare @level int set @level = 3 declare @temp table ( parent int, child int ) declare @result table ( parent int, child int ) insert @result select * testing while @level > 1 begin set @level = @level - 1 delete @temp insert @temp select t.parent, r.child testing t inner join @result r on t.child = r.parent delete @result insert @result select * @temp end select * @result

java - Need information about spring Controllers -

i confused spring controllers, pls me. i want know how spring controller initate , how constructor action, as when call controller 1 page, , ask same controller page dosn't seems create new object of controller rather provide same reference of controller object controllers "application-scoped"; instantiated once , reused requests associate them with. such, important not carry session-specific state. you should refer the documentation more details on how controllers work , how instantiate them.

jquery - jqGrid has double right border in forceFit state -

i have jqgrid forcefit property set true. result, right grid border solid, double. screencast: http://screencast.com/t/kmkmgwakh . i need solid border always. source code: var gridel = $('<table id="grid-213487-1235" class="details-summary-grid"></table>'); var columns = [ { label : "date", index : "date", name : "date", width : 140, formatter : this._formatdate, sorttype : "int" }, { label : "sender", index : "sender", name : "sender", formatter : function() { return "blablabla blablablabla blabla blablablabla blablabla blablabla blablablabla"; } }, { label : "subject", name : "subject", index

windows 7 - Visual Studio 2008 SSIS Error -

i have switched sql server 2008 r2, sql server 2008 sp1. seems have caused issue when attempt open ssis package in visual studio 2008. error message: 'could not load type 'microsoft.sqlserver.dts.runtime.wrapper.idtspackagesigning100' assembly 'microsoft.sqlserver.dtsruntimewrap, version=10.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91' i running windows 7 64 bit os. i have attempted re-install of sql server unsuccessful. i had same issue , have through job of removing , installing sql 2008 please see link before give up. http://social.msdn.microsoft.com/forums/en-us/sqlsetupandupgrade/thread/5ac7423a-9d7b-4def-b16b-9b4fc188871b

haskell - Can't seem to implement Either correctly -

alright here's current code: import system.io import system.environment import system.directory main = unfiltered <- getargs ; home <- gethomedirectory ; let db = home ++ "/.grindstone" case unfiltered of (x:xs) -> return () _ -> error "no command given. see --help more info." command:args <- getargs createdirectoryifmissing true db let check = case args of [] -> error "no arguments given. see --help more info." _ -> let (params@(param:_),rest) = span (\(c:_) -> c=='-') args if length params > 1 error ("no arguments given " ++ param) else let (pargs,_) = span (\(c:_) -> c/='-') rest return (param, pargs) :: either (io ()) (string, [string]) let add = print "sup" let cmds = [("add", add)] let action = lookup command c

javascript - iPad HTML5 canvas not refreshing -

edit: demo code found in "parallelogram explorer" tab here: http://atmdev01.procloud.net/geometry_tools9/ so i'm calling following javascript function @ document load draw perimeter of parallelogram, , working fine that. issue when call function touchmove handler allow ipad user adjust size of parallelogram, canvas not redrawing shape. in fact not responding @ all. i've run alerts verify function being run , is. could issue way i'm clearing canvas (the "canvas.width = canvas.width + 0" method) or refresh rates on ipad? the interesting part it's working in desktop browser using mousemove, not on ipad using touchmove. please advise... (the "corners" in code areas user can touch , drag resize parallelogram) this.drawsides = function() { var order = [1, 2, 4, 3]; var canvas = document.getelementbyid("canvas"); var ctx = canvas.getcontext("2d"); var firstcorner = this.getcornerobj(1); va