Posts

Showing posts from July, 2015

directory - Typical Naming Conventions for Python Directories in Packages -

the question know if there standard convention naming of python directories plan imported module. meaning directory contains blank __init__.py background until have given little thought , named solely based on made sense @ file system level. got me in trouble made sense @ file system level made sense other developers' standalone modules. consider following directory: + drivers + prologix - __init__.py - driver_a.py - driver_b.py + visa - __init__.py - driver_a.py - driver_b.py __init__.py ringout.py <-- simple file ring-out drivers while worked fine when ringing out prologix's drivers, ran issue when trying import visa drivers pyvisa's 'visa' module. easy diagnose problem, fix rename visa driver's folder 'visa_dir' makes code more difficult read (imo). import drivers.visa vs import drivers.visa_dir is there better way handle this? each module&

Does anyone know what happened to the official FastCGI website? -

ok, know off-topic (and down-vote me if want it), can't find anywhere else large enough group of programmers or general people in know ask this. know happened official fastcgi website? it's been replaced website of new york charity (screenshot here ) the reason ask because looking download fastcgi developer's kit wrote, read fastcgi specification, it's gone. if has access latest fastcgi dev kit , fastcgi specification, link me in answers below?

android - How to make a group of clickable graphical object? -

my question how can make set of clickable images on android. i can make 1 clickable sphere using shapedrawable, want make more 1 @ once , still able clicks in of them. moreover want position them on screen @ will, instead of auto positioned layouts. the number of spheres can change can places. this code use make one: main.java package com.teste; import android.app.activity; import android.os.bundle; import android.view.view; import android.widget.linearlayout; import android.widget.toast; public class main extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); linearlayout layout = new linearlayout(this); customdrawableview mcustomdrawableview = new customdrawableview(this, 100, 100, 50, 50, 0xff74ac23); customdrawableview mcustomdrawableview2 = new customdrawableview(this, 10, 10, 50, 50, 0xffffffff); mcustomdra

javascript - How do I handle this response from YQL -

in request yql (select * html url="...") got following response: callback({ "query": {"count":"1","created":"2011-05-09t23:29:05z","lang":"en-us" }, "results": ["<body>... we\ufffdll call mr ...</body>"] } this yql console page. when type sequence firebug (even on yql's page) get: ... we�ll call mr ... what doing wrong? yql's site in bad encoding? there way convert symbols ascii equivalent? btw isn't site it's not can change meta charset on site it seems (the question mark in solid black diamond) should seeing: http://www.fileformat.info/info/unicode/char/fffd/browsertest.htm the comment on character's page says: used replace incoming character value unknown or unrepresentable in unicode maybe answers these might better answer: what character expecting @ place? can post url you're scraping? is

freepascal - Pascal - not writing to file -

howdy, pascal masters! i've got file type of custom records: dbcell = record name: string[10]; surname: string[15]; balance:integer; opendate: record year: integer; month: 1..12; day:1..31 end; accountn: string[10]; end; dbfile = file of dbcell; and functions, open , add new element file: procedure fopenf(var f:dbfile; var fname:string; var fopened:boolean); begin assign(f,fname); rewrite(f); fopened:=true; end; procedure insn(var f:dbfile;var cell:dbcell;var fopened:boolean); begin write(f,cell); close(f); rewrite(f); writeln('added'); fopened:=false; end; problem is, nothing written file. doing wrong? the problem 'rewrite' call in insn. 'rewrite' creates new file, calling @ end of program, creating new, empty file!

android - if something = false display ads -

i have protected boolean follows protected boolean iskeyinstalled(context context) { // packagename of 'key' app string propackage = "com.funhouse.mytimmieskey"; // package manager final packagemanager pm = context.getpackagemanager(); // list of installed packages list<packageinfo> list = pm.getinstalledpackages(packagemanager.get_disabled_components); // let's iterate through list iterator<packageinfo> = list.iterator(); while(i.hasnext()) { packageinfo p = i.next(); // check if propackage in list , whether package signed // same signature package if((p.packagename.equals(propackage)) && (pm.checksignatures(context.getpackagename(), p.packagename) == packagemanager.signature_match)) return true; } return false; } i'm trying show ads if

javascript - Extjs4: TreeStore with method POST -

i have ext.tree.panel , define in have store . want able update store via ajax along post params. here tree definition: var mytree = ext.create('ext.tree.panel',{ rootvisible:false, store:ext.create('ext.data.treestore', { root:{ id:'rootnode', nodetype:'async' }, proxy:{ method:'post', type:'ajax', url:'myurl' } }) }); and try , reload store follows: mytree.store.load({params:{search_string='value'}}) but store attempts reload params get parameters. some appreciated. extjs 4 docs arent great @ moment (in opinion) there actionmethods parameter in proxy specify method of requests: http://dev.sencha.com/deploy/ext-4.0.0/docs/api/ext.data.proxy.ajax.html proxy:{ actionmethods: { create: 'post', destroy: 'delete', read:

syntax - How to compile a complete list of MySQL "Words" -

really getting mysql , 1 thought i've had on mastering 1 aspect of gather complete listing of mysql words. 1 example of might reserved words list, though appears that's not complete list; example: concat, crc32, etc. bizarre may seem, thinking such list might exist, or there might query yield it, and/or way extract source code of mysql. it non-scientific method, is: extract strings native_func_registry func_array. lookup sql/item_create.cc , e.g in http://bazaar.launchpad.net/~mysql/mysql-server/mysql-trunk/view/head:/sql/item_create.cc those should cover builtin functions. extract strings 'symbols' , 'functions' in lexer : http://bazaar.launchpad.net/~mysql/mysql-server/mysql-trunk/view/head:/sql/lex.h extract symbols bison input http://bazaar.launchpad.net/~mysql/mysql-server/mysql-trunk/view/head:/sql/sql_yacc.yy lines %token sometoken except when tokens have _sym suffix (they covered sql/lex.h) combine of those, , r

c# - Where to place Dlls in version control visual studio -

my current structure follows /project name/ file1.cs file2.cs project.sln libraries/ i know common answer put libraries folder within /project name/ folder shown above. correct? if so, need special when adding references in project? need set "copy local" option? thanks. for answer first question, see location of third party dll's in version control .net project . for second question: nothing special needs done; adding reference in visual studio (using browse tab) automatically set assembly dll copied output folder.

Counting in a Prolog List -

i'm trying make prolog function (i know it's not function can't recall it's name) given list , number n returns list elements repeat @ least n times. xpto(['a', 'a', 'a', 'b', 'b', 'c'], out, 3) should return out = ['a'] xpto(['a', 'a', 'a', 'b', 'b', 'c'], out, 2) should return out = ['a', 'b'] etc. i have: xpto([], _, _). xpto([h | l], o, num) :- count(h, [h | l], n), n = num, xpto(l, [h | o], num). xpto([h | l], o, num) :- count(h, [h | l], n), n \= num, xpto(l, o, num). where in count(a, l, n) n number of times repeats in l, doesn't work. i'm pretty sure algorithm works on paper. any appreciated :) if prolog system supports clpfd , use following implementation of xpto/3 . implementation preserves logical-purity ! let's implement xpto/3 based on list_counts/2 , meta-predicates tfil

c++ - How can I avoid std::vector<> to initialize all its elements? -

edit: edited both question , title more precise. considering following source code: #include <vector> struct xyz { xyz() { } // empty constructor, compiler doesn't care xyz(const xyz& o): v(o.v) { } xyz& operator=(const xyz& o) { v=o.v; return *this; } int v; // <will initialized int(), means 0 }; std::vector<xyz> test() { return std::vector<xyz>(1024); // memset() :-( } ...how can avoid memory allocated vector<> initialized copies of first element, o(n) operation i'd rather skip sake of speed, since default constructor nothing ? a g++ specific solution do, if no generic 1 exists (but couldn't find attribute that). edit : generated code follows (command line: arm-elf-g++-4.5 -o3 -s -fno-verbose-asm -o - test.cpp | arm-elf-c++filt | grep -ve '^[[:space:]]+[.@].*$' ) test(): mov r3, #0 stmfd sp!, {r4, lr} mov r4, r0 str r3, [r0, #0] str r3, [r0, #4] str r3, [r0, #8]

html agility pack - TypeInitializationException When Using Moles With HtmlAgilityPack -

i attempting use moles test non-static method in separate assembly. when running test without [hosttype("moles")] tag, test runs fine. when replace receive following error: "the type initializer 'htmlagilitypack.htmlnode' threw exception." i have attached code samples perform in identical manner. any great! class/method being called unit test using system; using htmlagilitypack; using system.web; namespace hapandmoles { public class class1 { public void foobar() { htmldocument foo = new htmldocument(); } } } unit test using system; using system.text; using microsoft.visualstudio.testtools.unittesting; using hapandmoles; using microsoft.moles.framework; using htmlagilitypack; using system.web; namespace hapandmoles { [testclass] public class unittest1 { [testmethod] [hosttype("moles")] public void testmethod1() { class1 bar =

iphone - Encrypting different types of files using C or Objective-C -

i have chosen algorithm encrypt file. may encrypt text or image files. how can write generic type of encryption method works both text , image files? i'm working objective-c. what ever encrypting might using data or nsdata, converting char array , applying algorithm. make method takes nsdata argument, , return encrypted nsdata. e.g. -(nsdata*)encrypt:(nsdata*)data{ ///your algorithm return encrypteddata; } convert image or file nsdata , pass method.

iphone - Is it against the HIG for a UITableViewCell to remain Hightlighted? -

is against hig uitableviewcell remain hightlighted? currently, when cell selected remains blue. unsure if need add: nsindexpath *tableselection = [self.tableview indexpathforselectedrow]; [self.tableview deselectrowatindexpath:tableselection animated:yes]; the hig says appearance , behavior a table view displays data in rows can divided section or separated groups. users flick or drag scroll through rows or groups of rows. users tap table row select , use table view controls add or remove rows, select multiple rows, see more information row item, or reveal table view. table row highlights briefly when user taps selectable item. if row selection results in navigation new screen, selected row highlights briefly new screen slides place. when user navigates previous screen, selected row again highlights briefly remind user of earlier selection (it not remain highlighted). always provide feedback when users

Google Maps API V3 : How show the direction from a point A to point B (Blue line)? -

Image
i have latitude , longitude 2 points on database, want google map display route point point b... just see here (google maps directions) how draw direction line on map ? use directions service of google maps api v3. it's same directions api, nicely packed in google maps api provides convenient way render route on map. information , examples rendering directions route on map can found in rendering directions section of google maps api v3 documentation.

creating a table in oracle using sql server table -

i have table in sql server 2008 r2, contains 1m or more records want create table in oracle same contents thats in sql. there several ways of doing that. can first on following tutorial: migrating microsoft sql server database oracle database 11g i have done task in past using following steps: create table in oracle database (only schema, not data). export data sql server 1 or more csv (or other delimiter files (i suggest create files no more 100,000 records) use sql*loader (an oracle utilily) load data files oracle. the oracle sql*loader utility command line tool allows load data files oracle. uses control file specifies source file, structure , loading strategy. the advantage of using tool vs. loading using insert statements speed of loading. since tool bypass log files extreamly fase. here link sql loader tutorial: sql*loader faq from tutorial: usage: sqlldr username/password@server control=loader.ctl control file sample: (1) load data (2)

c# - WPF: validation confirmed password -

i have 2 passwordboxes. need check passwords equal. don't want write condition [].xaml.cs code, want mark passwordbox in red when passwords aren't equal. should write special validationrule, code in viewmodel or else? can me? validation written in [].xaml.cs want avoid it. using: <passwordbox name="tbpassword" /> <passwordbox name="tbpasswordconf" /> <passwordvalidator box1="{binding elementname=tbpassword}" box2="{binding elementname=tbpasswordconf}" /> code (this code not cover cases): public class passwordvalidator : frameworkelement { static idictionary<passwordbox, brush> _passwordboxes = new dictionary<passwordbox, brush>(); public static readonly dependencyproperty box1property = dependencyproperty.register("box1", typeof(passwordbox), typeof(passwordvalidator), new propertymetadata(box1changed)); public static readonly dependencyproperty box2propert

Converting existing android application which is developed in 240 density toe 320 density -

if want convert our existing android applications developed in 240 density (1024x600) 320 (1024x600) density, need change entire layout ui files of current application or have other alternatives. can apply 320 density programetically current 240 density application? no change bitmaps have xhdpi form. whole point of density changes layout doesn't change, because scaled density. why use "dp" units in layout.

"Flatten" CSS to HTML -

what tools available programatically merge css stylesheet html document? mean style attributes created on elements match css declarations. premailer along couple of other tweaks html email. there other tools around formatting html email can too, can't think of others premailer works great.

windows - Python says pygames has no attribute 'init()' but lib is installed correctly -

i'm using python 2.7 pygame-1.9.2pre.win32-py2.7.‌exe http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame i've run script: import pygame print 'pygame version: %s ' % pygame.__version__ to see if module installed correctly , got: pygame version: 1.9.2pre as far know, means pygame working correctly. in python idle try run interactively: import pygame pygame.init() # set height , width of screen size=[700,500] screen=pygame.display.set_mode(size) pygame.display.set_caption("my game") and works fine. whenever try run script get: traceback (most recent call last): file "d:\computing\workspaces\python\test\pygame.py", line 5, in <module> import pygame file "d:\computing\workspaces\python\test\pygame.py", line 13, in <module> pygame.init() attributeerror: 'module' object has no attribute 'init' on eclipse or running in idle either. be? if script named pygame.py python impo

create application like android home screen -

i want make application android home screen. want place icons. have 10 pages. want scroll between these pages. how achieve this? plz help. thanks. checkout link hope give idea.

ruby on rails - devise + omniauth auth/failure?message=invalid_credentials -

after added application in twitter when request authentication in twitter (/auth/twitter) these error message http://localhost:3000/auth/failure?message=invalid_credentials routing error no route matches "/auth/failure" how can add valid credential or there ssl certificate must included in requesting twitter auth?? my facebook authentication works fine after added parameter ssl certificate looks this rails.application.config.middleware.use omniauth::builder provider :facebook,'xxx', 'xx', { :scope => 'publish_stream,offline_access,email',:client_options => { :ssl =>{ :ca_path => "/etc/ssl/certs" } }} provider :twitter, 'xx','xxx' #,{ :client_options => { :ssl =>{ :ca_path => "/etc/ssl/certs" } }} end i've same problem you, happen because oauth_token in twitter login valid on once request. may application trying refresh when authentication twitter. when

file - Atomicity with openTempFile -

i have following function: safewrite :: text -> io () safewrite c = bracket (opentempfile "/tmp" "list.tmp") (\(path, h) -> hclose h >> copyfile path datafile >> removefile path) (\(_, h) -> ti.hputstr h c) i under impression safe, no copying happen if there errors during moment, , original file still usable. yesterday ended empty file, , have no idea go @ it. program had been running on month without hiccups points corner case didn't think of. does method guarantee atomicity, meaning error somewhere else, or if not, why not? should guarantee atomicity? your definition of mktemp atomic with respect haskell exceptions . if there exception print message failure (leaving file there). it not atomic respect unix file system -- other programs overwrite same file it not clean should there failure. you can bit more clean up, optionally removing file if there exception, or using provided (atomic) mktem

binding - C# WPF two different DataContext in One Control while using MVVM and the secound property is every time the same -

first code: <listview itemssource="{binding datatransfermodel.output}" background="transparent" margin="0" verticalcontentalignment="top" alternationcount="2" name="lvoutput" scrollviewer.verticalscrollbarvisibility="auto" grid.row="2"> <listview.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" margin="0,1"> <usercontrols:outputtextbox text="{binding data, mode=oneway}" isreadonly="true" grid.row="2" textwrapping="wrapwithoverflow" selectedvalue="{binding path=datacontext.selectedoutput, mode=twoway,

Selenium: intermittent "element not found" issues -

every , selenium tests randomly fail "element x not found" error message. simple select id, eg. click('sidebar_querybutton') when use dom inspector, element there, wonder why selenium doesn't find sometimes. when run same test again, works or breaks again, there seems no reliable way of reproducing it. tests there ages seem randomly break , magically work again. inserting few sleep statements helps not reliably. wonder if i'm using incorrectly. has else had these problems selenium , if so, how did fix them? edit: found more reliable put test markers in pages , wait them appear. if use asynchronous operations might create race conditions in tests, inserting test marker html after finish operation worked pretty me. e.g. $('<div>').addclass("testmarker").append("opxyzfinished").appendto($('#content')); that way, can simple "waitfortextpresent" see if things worked out , more reliable guessi

java - Why does this String.equals() method always return false? -

Image
i have class have implemented custom hashcode() , equals(object) method using eclipse method generator. each object of class has string field called muid should unique , enough determine equality. overridden methods this: @override public int hashcode() { final int prime = 31; int result = 1; result = prime * result + ((muid == null) ? 0 : muid.hashcode()); return result; } @override public boolean equals(object obj) { if (this == obj) return true; if (obj == null) return false; if (getclass() != obj.getclass()) return false; datasource other = (datasource) obj; if (muid == null) { if (other.muid != null) return false; } else if (!muid.equals(other.muid)) return false; return true; } but reason, when compare 2 objects of class, returns false. i've stepped through code debugger , can determine muid strings same. equals(object) method returns false @ line if (!muid.equals(

qt - Problems with using QTimer -

i having small problem qtimer . whenever use qtimer shows me error qtimer *timer = new qtimer(); error: invalid use of incomplete type 'struct qtimer' so tried qtimer timer(); now got rid of error when use members inside qtimer shows me these errors. example timer.start(1000); or timer->start(1000); error: request member 'start' in 'timer', of non-class type 'qtimer*()' i tried include qtimer shows me there no such file or directory error. i using code::blocks ide. just add #include <qtimer> to start of source file. , go first version: qtimer *timer = new qtimer();

eclipse - Contents section missing in New Java Project wizard -

why contents section (with create project existing source option) missing in create java project screen ? know have seen , used before has disappeared. you better have ask question on eclipse jdt forum: http://www.eclipse.org/forums/index.php?t=thread&frm_id=13&

c# - open browser instance from $ajax -

i trying open new browser instance popup show contents of file not staying in same page? $(document).ready(function (event) { $.ajax({ type: 'post', url: "/home/index" }); }) public actionresult index() { return file(@"c:\textfile1.txt", "text/plain"); } what without ajax? $(document).ready(function (event) { window.open('/home/index', 'window name') }) if require ajax, because need post data $(document).ready(function (event) { $.ajax({ type: 'post', url: "/home/index", success: function( data ) { var win = window.open('about:blank', 'window name'); $(win.document.body).append(data); } }); })

c# - Conditional Includes -

i know how can change query: events = _database.events .include("contacts") .tolist(); to include contacts having property "type" set "event". i'm using entityframework, _database context. firstly, it's worth understanding code posted doesn't include lambda expression @ all. "query not in query expression syntax" isn't same "lambda expression". i suspect bad idea return event objects partially-filled entity reference set. however, this: _database.events .select(e => new { event = e, eventcontacts e.contacts .where(c => c.type == "event") });

build automation - Error using Ant to create EJB after upgrading WAS from 6.0 to 7.0 -

ant task breaks @ <wsejbdeploy> tag. exception message : [wsejbdeploy] error executing deployment: java.lang.classnotfoundexception. error com.ibm.etools.ejbdeploy.batch.plugin.batchextension. [wsejbdeploy] java.lang.classnotfoundexception: com.ibm.etools.ejbdeploy.batch.plugin.batchextension [wsejbdeploy] @ java.lang.class.forname(class.java:136) in addition that, ivy.xml reports problems, when inspect it, messages have no sense ( screenshot ). suspect problems be: a) additional files have build conflict upgraded ant (in rsa 7.0 i've had ant 1.6.5 , rsa 8.0 comes ant 1.7.1). additional files are: required ant tasks execution ant-contrib/ant-contrib.jar antelope-tasks/antelopetasks_3.2.10.jar antform/antform.jar antform/defaultstyle.txt antlr/antlr.jar checkstyle/checkstyle-4.2.jar checkstyle/checkstyle-optional-4.2.jar checkstyle/checkstyle-frames-errors.xsl clover/clover.jar clover/cenquatasks.jar clover/clover.license doccheck/doccheck-modifi

Is there an IDE for javascript development with Google's Javascript APIs? -

is there ide development google javascript apis autocomplete etc? gwt allows use java or python, if wish use javascript native app development google apis. i using netbeans , add reference script google , try code. cannot copy google javascript apis local, have try :) thanks.

php - How to assert mock object's function invocation's object arguments -

consider class foo { public $att; public function __construct ( $a ) { $this->att = $a; } } class { public function callme ( foo $f ) {} } // class want test class sut { public function testme ( $s ) { echo $s->callme( new foo('hi') ); } } i want check whether sut::testme() invokes some::callme() . since parameter ( foo ) object (not scalar type), can't figure out how call phpunit's with() run assertions on it. there assertattributeequals method example, how feed invocation's argument? what i'd this: class suttest extends phpunit_framework_testcase { public function testsut () { $stub = $this->getmock( 'some' ); $stub->expects( $this->once() )->method( 'callme' ) ->with( $this->assertattributeequals('hi', 'att', $this->argument(0) ); /* * $stub->callme called foo object $att 'hi'? */

sql - MySQL Where Not Exists -

what's wrong code? keep getting error 1064 (42000): have error in sql syntax select clientreport.id clientreport.rownumber not exists ( select clientreport.rownumber report02, clientreport report02.id=clientreport.id); i assume want like: select clientreport.id clientreport left join report02 on(report02.id = clientreport.id) report02.id null; this return ids clientreport have no corresponding entry in report02. an alternative might be: select clientreport.id clientreport clientreport.rownumber not in ( select clientreport.rownumber report02, clientreport report02.id=clientreport.id);

How to run php scripts from c++ via fastcgi -

i writing c++ webserver high(er) performance cms. first used php noticed performance issues. can not ask front-end developers write views / templates in c++ code. want run fastcgi server (i dont know right name) holds php fastcgi app. when application needs render view, views passes data php script via fastcgi, php renders html (or that), sends view, via fastcgi, , c++ application sends html client. does knows better solution or can find fastcgi server or keywords can find self (on google). is you're looking for? http://php-fpm.org/ php-fpm (fastcgi process manager) alternative php fastcgi implementation additional features useful sites of size, busier sites.

wcf - Visual Studio can't add WSDL resource in Windows Vista or later through Apache reverse proxy -

i @ wits' end on one. fyi, work in infrastructure, not .net development, know little wcf , next nothing visual studio environment, don't think that's problem lies. we have wcf service running on couple of iis 7.5 servers on our internal network. exposed outside world via reverse proxy on apache 2.2.15 on fedora 11. reverse proxy handles load balancing between iis servers, ssl. the wcf service configured use transport level security, , iis servers have self-signed ssl certificates. reverse proxy not authenticate iis servers, , reason have ssl on iis servers in first place wsdl present correct location url. we thought had working perfectly, there's 1 annoying , crucial exception: wsdl can't added service reference in visual studio on machines running windows vista or later. on xp machine, it's fine, later throws following error: there error downloading '[url]'. operation has timed out metadata contains reference cannot resolved:

c++ - How to check that LIB import library fully match its DLL? -

i have dll import library. when try reference import library, linker errors functions can't resolved. think there mismatch in versions of dll , import library. there way check import library match dll, without checking tons of functions manually via dumpbin? the problem header file contains functions not defined in .lib file. have new header file , out of date .lib file. possible solutions: contact library vendor obtain .lib file matches header file , dll using. create .lib file yourself .

for loop - Perl programming: continue block -

i have started learning perl scripting language , have question. in perl, logical reason having continue block work while , do while loops, not for loop? you can use continue block everywhere makes sense: while , until , foreach loops, 'basic' blocks -- blocks aren't part of statement. note can use keyword for instead of foreach list iteration construct, , of course can have continue block in case. as else said, for (;;) loops have continue part -- 1 want execute first? continue blocks don't work do { ... } while ... because syntactically that's different thing ( do builtin function taking block argument, , while part statement modifier). suppose use double curly construct them (basic block inside argument block), if had to: do { { ...; continue if $bad; ...; } continue { ...; # clean } } while $more;

c# - Convert string to decimal with format -

i need convert string decimal in c#, string have different formats. for example: "50085" "500,85" "500.85" this should convert 500,85 in decimal. there simplified form convertion using format? while decimal.parse() method looking for, have provide bit more information it. not automatically pick between 3 formats give, have tell format expecting (in form of iformatprovider). note iformatprovider, don't think "50085" pulled in. the consistent thing see appears examples expect 2 decimal places of precision. if case, strip out periods , commas , divide 100. maybe like: public decimal? customparse(string incomingvalue) { decimal val; if (!decimal.tryparse(incomingvalue.replace(",", "").replace(".", ""), numberstyles.number, cultureinfo.invariantculture, out val)) return null; return val / 100; }

javascript - What sites will break my iframe? -

i'm building search site uses iframes display results. aware sites either fail deliver content, or 'break out' of frame. far have identified twitter, facebook , nytimes. what other big-name frame-busters there? i'm sure paypal 1 of them. have keep in mind iframes can make appear though user viewing site itself, , not own site. take example if twitter allowed iframing. malicious hacker sets site twitter in iframe, , login box next it. unsuspecting user thinks need login twitter, puts in username , password, , viola! hacker has login data. in sense of nytimes it's "don't pretend content" issue. for these reasons chances of running frame-busting on big name sites high.

Unity with asp.net mvc, passing parameters with property injection -

i inserting dependency in mvc controller shown below: public class homecontroller : controller { [dependency] public iproxyservice proxyservice { get; set; } } in global.asax, type registered using unitycontainer _container = new unitycontainer(); _container.registertype<iproxyservice, systemproxyserviceex>(); now, need pass few parameters systemproxyserviceex constructor. these include values stored in session variable(httpsessionstatebase session) stored during authentication. how make happen? the common thing wrap in class , inject based on interface. instance: // interface lives in service or base project. public interface iusercontext { string userid { get; } // other properties } // class lives in web app project public class aspnetusercontext : iusercontext { public string userid { { return (int)httpcontext.current.session["id"]; } } // other properties } now can make systempro

sitecore6 - Sitecore: How to get sublayout ITEM from sublayout codebehind? -

i'm trying sublayout item (or item id) in codebehind. is possible? update: i not mean datasource item or current item, i'm talking sublayout rendering definition item. has 1-to-1 relationship sublayout file. codebehind file: public partial class product_sublayout : system.web.ui.usercontrol { protected void page_load(object sender, eventargs e) { sublayout sublayout = this.parent sublayout; item sublayoutitem = null; //how sublayout rendering definition item here? } } this page explain details, here's code need: sitecore.context.database.getitem(((sublayout)parent).datasource); update: you can rendering item using database id: sitecore.context.database.getitem(((sublayout)parent).renderingid);

WPF/Silverlight: Printing of Visuals - Drawbacks -

i read once or twice printing visuals wpf/silverlight has drawbacks people tend use flowdocument or fixeddocument printing. i want print graphically intense dashboards , printing visual directly seems easiest way go. don't have care pagination since every dashboard want print supposed fit on 1 page. are there still drawbacks must consider before choosing way of printing? you can print visual objects hosting them in frameworkelement , adding frameworkelement fixeddocument content of fixedpage. visual host looks this: /// <summary> /// implements frameworkelement host visual /// </summary> public class visualhost : frameworkelement { visual _visual; /// <summary> /// gets number of visual children (always 1) /// </summary> protected override int visualchildrencount { { return 1; } } /// <summary> /// constructor /// </summary> /// <param name="visual">the vi

Android: getSharedPreferences for session -

okay, check source code: public void checksession() { sharedpreferences session = getsharedpreferences(prefs_name, 1); string getsession = session.getstring("session", null); toast.maketext(this, getsession, toast.length_short).show(); if(getsession.length() > 30) { intent menu = new intent(this, menu.class); startactivity(menu); finish(); } else { } } the problem "first time users" crush. when disable function, run app , login code creates session. after when logout, , restart app - there's no problem. ideas? first time app runs , don't have value stored in sharedpreference "session" return null default value. getsession().length result in nullpointerexception. you should instead: string getsession = session.getstring("session", "");

module - Why does Drupal think my email address is invalid? -

i'm trying send e-mail module i'm writing, keep getting error message, when hardcode valid address in call drupal_mail() : warning: mail() [function.mail]: smtp server response: 550 address not valid in defaultmailsystem->mail() (line 77 of c:\program files (x86)\wamp\www\drupal-7.0\modules\system\system.mail.inc). how fix this? this has nothing drupal smtp (simple mail transfer protocol) configuration in php.ini file somewhere in c:\program files (x86)\wamp\ (i don't know because use xampp). there have 'mail function' can put smtp = smtp.server server name of server internet provider. personnaly don't change thing because work once going live.

asp.net - Facebook C# SDK installation from Nuget not working -

coding platform: asp.net webforms4.0 vb installed facebook , facebookweb , when run application. error could not load file or assembly 'facebook.contracts, version=5.0.25.0, culture=neutral, publickeytoken=58cb4f2111d1e6de' or 1 of dependencies. strong name signature not verified. assembly may have been tampered with, or delay signed not signed correct private key. (exception hresult: 0x80131045) what wrong? removed facebook.contracts.dll , facebook.web.contracts.dll . working fine now.

java - Redirect or forward in web application -

hi all have requirement like, web page on event user redirect myapp's login page parameter. want test myapp able parameter or not. test made app in using (code below ). showing parameter in url don't want. want know other ways there redirect/forward url parameter ( parameter should hidden hiddn ). <% response.setstatus(httpservletresponse.sc_moved_permanently); response.setheader("location","http://localhost:8080/myapp/login/login.jsf?user_id=inc&reference_id=123456789"); %> thanks it's not possible post redirects, can't redirect post scriptlet. what can is: build html form in post parameters want pass, remember, post perceived security brittle, since tool firebug can see variables (or can @ html source). a way around problem use encryption or 1 time passwords (that last session). used way, connect seamlessly java application php. if you're interested , share details of solution.

php - Nested input fields (parent and child structure) -

i in real tricky situation have page allows records inputted , there parent/child structure (or records/sub-records if call it). many records/sub-records can added dynamically (the rows cloned , inserted after next row) when user needs add more. the structure : <div class="row"> <strong>parent record:</strong> <input type="text" name="parent-record[]" /> <div class="row"> <strong>child record:</strong> <input type="text" name="child-record[]" /> </div> <span class="add-subrecord">add sub-record</span> </div> <span class="add-record">add record</span> the problem on php side, when have 2 loops, 1 in loop this: for($i = 0; $i < count($_post['parent-record']); $i++) { $sql = "insert records (input) values ('" . $_post['parent-record'][$i] . "')";

emacs magit diff highlighting -

i'm getting started magit. it, except diff viewer annoying me. chunk highlighting makes no sense because scroll around cursor moves screen, highlighting new regions. there no other syntax highlighting in magit diff mode. know how disable chunk highlighting , better diff colours other white on gray? thanks. there should customize group magit allows customize different faces diff viewer. in other words, can run m-x customize-group ret magit-faces ret to see list of faces used magit. ones relevant diff viewer are, of course, ones starting magit diff . simply customize away , select apply , save . alternatively, can use customize interface see faces available, , set them directly using set-face-foreground , set-face-background , , on in init-file.

Playing Sound Javascript or HTML -

i need implement object(or sth else) play sounds in web. i've searched lot there nothing can play sounds in each browser. mean there code each browser. my question if there code can used in every browser. thanks in advance, , sorry bad english!!!!!! may can start throwing light on 5 accepted ways add sound on ur webpage. midi files - small size, easy implements looks amateurish n dicy. wav files - easy again, don't loop. file size may bigger too. mp3 files - ensure quality, required external player, not user-friendly. flash files - flexible, small , can loop. road block, creating 1 of ur own requires buying flash software. pre-build flash loops - small, made professionals (www.flashmusictracks.com, www.flashkit.com). see if u can find suit u. thr cud more sites mentioned. just u know, google used flash loops when embedded sounds pacman logo , on home page.

C# how to create a method that invokes a delegate to another generic method -

i have code this.... var x = inv.invokeproxy<serviceclient, anothertype, returntype>( p => p.execute(input), guid); what looking encapsulate of above code delegate including specified types. i want create method literally invoke above method. this... func<a,b> func = delegate() { .... 1st code sample inserted here ... } then need pass func method invoke e.g. protected treturn invokedelegate<treturn>(func<> functionobject) { return functionobject.invoke(); } does know how can done? this pretty simple: func<typeofinput, guid, typeofx> func = (input, guid) => inv.invokeproxy<serviceclient, anothertype, returntype>( p => p.execute(input), guid); execute this: typeofinput yourinput = ...; guid yourguid = ...; typeofx x = func(yourinput, yourguid);

amazon ec2 - change keypairs ec2 running instance -

hello i've made big mistake may key pairs on ec2 instance. can't connect sftp , putty because private key wrong. how can access instances or change key pairs @ console? i think need rebuild instance old(correct) key pair. http://docs.amazonwebservices.com/awssecuritycredentials/1.0/aboutawscredentials.html#ec2keypairs

sitemap - How can I build a Google Site Map for my PHP website? -

i build sitemap newly developed website in php. can me in building sitemap google? google has pretty thorough documentation on topic here

Automatic integer factoring for 310-digit decimal numbers -

is here software, capable of factoring 310-digit decimal integer number primes? there msieve, used 120-digit factoring, 310 digit greater max allowed number of 308-digit msieve. ps: number factor have 2 prime factors, , p-1,p+1 , other easy , fast factoring methods fail. update: seems ggnfs work , there python scripts automate factoring. use lenstra's ec algorithm if it's not semiprime. otherwise use pomerance's nfs. introductions exist both of these "boxes." bet browse homepages of lenstra , pomerance, they're both @ exposition. or check out " number theory: programmers guide ", mark herkommer . it's need, nothing more, , clear. edit: although 1000 bit modulus may bit of stretch, assuming have conventional hardware. edit: sure, additional links: http://tinyurl.com/herkamzon herkommer book. a 1987 paper on ec factoring hendrik lenstra's homepage : factoring integers elliptic curves, ann. of math. 126, 649-673. . from

SQL Server DISTINCT -

select dbo.clientrep.ref, dbo.rep2.ref dbo.clientrep full outer join dbo.rep2 on (dbo.rep2.ref = dbo.clientrep.ref) dbo.rep2.ref null or dbo.clientrep.ref null; how can specify distinct dbo.clientrep.ref , dbo.rep2.ref returned? just write select distinct ... select distinct dbo.clientrep.ref, dbo.rep2.ref dbo.clientrep full outer join dbo.rep2 on (dbo.rep2.ref = dbo.clientrep.ref) dbo.rep2.ref null or dbo.clientrep.ref null;

facebook landing page iframe wont resize -

hi have designed custom facebook landing page , quite long iframe seems limited set length. getting scrollbars turned on or off not problem, can regardless of having scrollbars or not iframe stays same size. ideas? you can view page here: http://www.facebook.com/petsmarket?sk=app_199629183389823 cheers. paul change iframe size auto-resize use: fb.canvas.setsize p.s: be-aware js code broken since have in 1 line comments in it!

qt4 - Porting an C++ code application from Solaris to Linux and real time headers issues -

please help, tools using kdevelop , qt4. on main.cpp have errors, example; error: sys/procset.h: no such files or directory error: sys/priocntl.h: no such files or directory error: sys/tspriocntl.h: no such files or directory error: sys/rtpriocntl.h: no such files or directory in function 'int main(int. char**)': error: 'pcparms_t' not declared in scope error: expected ';' before 'pcparms' error: 'rtparms_t' not declared in scope error: 'rtparmsp' not declared in scope error: 'pcinfo_t' not declared in scope error: expected ';' before 'pcinfo' error: 'rtinfo_t' not declared in scope error: 'rtinfop' not declared in scope warning: unused variable 'lret' warning: unused variable 'priority' ... ... ... * exited status:2 * can't find real time headers on centos 5 linux. plus, don't know equivalence of above headers linux. know have add if statement solaris , linux i

android - Can Facebook Graph API only return n entry? -

is possible place graph api call, returns n entries, n number of result entries like? example limiting 5 or 10, not default. something similar sql select * .... limit n . i haven't found on fb dev page. yes. use limit parameter: https://graph.facebook.com/me/likes?limit=3 edit: see https://developers.facebook.com/docs/reference/api/ : @ paging section.

php - Site Design: How to award users tasks with achievements? -

so i'm wanting setup achievements system on site. people perform tasks , upload information stored in database (think 'time', 'date', 'task', etc.). best method of checking information , awarding achievements? have achievement.php once information uploaded trigger document run through checks determine if user needs awarded achievement? or there server side should set award user? thanks or suggestions, comments, etc. :d edit: have achievements listed in database, ( id , name, class) tasks stored ('date_time','time','device','user_id[fk]') edit 2: many achievements calculated based on not tasks user submitting takes account previous tasks in addition newly added task. ex: if user has completed 3 tasks within 3 consecutive days, awarded it it depends on preference business logic placement lies, , how real time want acheivements be. if you're looking offload bunch of business logic on sql server, put in

c++ - iPhone-Cocos2d-Box2d game #include <list> problem -

i have cocos 2d game under development implements box 2d , integration required me change .m classes .mm now trying use code draws fruit ninja style swiping effect using code @ https://github.com/hiepnd/ccblade when compiling error @ line #include < list > (ccblade.h:14:0 ccblade.h:14:15: error: list: no such file or directory) it works fine when integrated .m file, error when trying use .mm any solutions ? (after reading description in comments) the problem translation not c++ or objc++ including <list> via inclusion of ccblade.h check build transcript failed file: -x objective-c here, flag -x specifies language. if not c++ or objc++, you'll error presented.

problem with fetching results from mysql via php function -

can 1 point out problem code? supposed fetch data mysql returns blank. here full code. <ul class="list"> <?php require("object/db.class.php"); error_reporting(0); function entry_tickets() { if($_session['dojopress_global:root'] == false) { $entry_ticket .= <<<entry_ticket <li><p><img src="http://cdn1.iconfinder.com/data/icons/humano2/32x32/apps/gnome-keyring-manager.png" />access denied</p></li> entry_ticket; } elseif($_session['dojopress_global:root'] == true) { $q = "select * `notice` order nid limit 12 desc"; $r = mysql_query($q); if ( mysql_num_rows($r) == 0 ) { $entry_ticket .= <<<entry_ticket <li><p><img src="http://cdn1.iconfinder.com/data/icons/humano2/32x32/status/dialog-information.png" /> nothing display</p></li> entry_ticket; } elseif ( $r !== false && mysql_num_rows($r) > 0 ) { while ( $a =