Posts

Showing posts from June, 2014

javascript - Disable Browser console -

i'm writing online game uses large amount of javascript, , cheating really easy if start fiddling variables in console or, worse still, checking elements of dom see hidden units are, etc. right now, detect when console opened , rewrite entire <body> element contain message explaining have close console , refresh page carry on playing. is there reliable way of closing console again, or disabling completely? a cheater can write javascript address bar; matter, host browser control within winforms program , modify on page without ever opening console. write nice little cheating app convenient buttons , friendly ui , distribute cheater friends. have not trust input user. run important stuff on server , allow client send ajax requests. otherwise cheating inevitable.

mysql - Unintended behavior: Subtraction between null values results in '0' -

Image
when either 1 of field null , want returned value null well. have tried reversing logic: is not null . still same results. mysql code: (case when ((`creative_stg_sample_tracking_raw`.`total_samples_received` not null) , (`creative_stg_sample_tracking_raw`.`total_samples_forecasted` not null)) (cast(`creative_stg_sample_tracking_raw`.`total_samples_received` signed) - cast(`creative_stg_sample_tracking_raw`.`total_samples_forecasted` signed)) else null end) `received_forecasted_dif` screenshot: your code should working, don't need case . whenever 1 of values null , expression should null : (cast(`creative_stg_sample_tracking_raw`.`total_samples_received` signed) - cast(`creative_stg_sample_tracking_raw`.`total_samples_forecasted` signed)) ) `received_forecasted_dif` i wonder if problem value 'null' rather null

c# - Return value of math.sqrt -

i have been try draw function of y^2=4*a*x have run problem. when use math.sqrt function find square root of value has 2 answer +or- positive value. i.e if found sqrt of 4 return +2 instead of + or -2. any appreciated. you can write own method return both values: public static ienumerable<double> sqrt(double d) { var result = math.sqrt(d); yield return result; yield return -result; }

python - Get output numbers to line up in columns? -

i'm making little program display primes. code (below) produces correct answer, i'm having trouble getting output "nice". import math n = int(input('list primes to: ')) maxdigits = math.ceil(math.log10(n)) #equal spacing, lesser digit stuff in range(3,n,2): d in range(2,int(math.sqrt(i))): if i%d==0: break else : print(str(i),end=' '*(maxdigits-len(str(i)))) the idea have many columns possible fit onto output screen, based on maximum number of digits prime have. right when run program displays numbers in long line, without newlines. results output looking this: it's ugly! burns eyes! http://img194.imageshack.us/img194/5522/2eyd.png which...isn't going for. if weren't fact numbers wrap on lines, , knew go next line if there isn't enough space, work fine. how can rid of annoying wrapping in program? more elegant (i.e. please don't tell me have count terminal width , divide maxdigits) bet

.htaccess - Redirect all to index.php htaccess -

my apologies 10000000th question on topic, can't work way want it. i'm writing simple php mvc'ish framework. want framework able installed in directory. what php script : grabs request uri , breaks off segments. making segment 1 controller , segment 2 action. goes fine when this: http://www.domain.com/mvc/module/test/ it go specific module controller , method. have default controller, home controller, in folder home. now when acces folder directly http://www.domain.com/mvc/home/ display 403 forbidden, because folder exist, instead should go http://www.domain.com/mvc/index.php if have installed framework in different folder, lets folder framework has redirect http://www.domain.com/framework/index.php i redirect every folder , php file index.php, leaving else way is. my first problem encountered never redirects right folder, domain root folder. this tried : rewriteengine on rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f re

java - Clicking on a ListView -

i have listview header , footer. added 2 items class of own extending arrayadapter class. in extended class, have overridden getview function because want view s not textview s appear in listview . on listview , have set onclicklistener . the problem onclicklistener started when click either on header or on footer, never when click on items. of course, view returned getview set clickable. what missing? do want different when each list element clicked? if so, should programmatically set onclicklistener each of 2 elements added. can post code?

MySQL max value for each condition -

i'd select max value of column specific type of data in table. for simplified example, let's have game girl , boy players. want able retrieve highest scores gender = girl , gender = boy single query. any way this? example 2 queries, data in app lot more complicated. thanks :) your example develop in simple way: select gender, max(score) players group gender i suppose have table players, store score , gender. if have other more complex situation, yuo must write here , can analyze case.

php - Why does my mysql query always return an empty result? -

i'm trying read 1 row database table "cond" using id of row. in case have 1 row id=1. problem code returns $result empty. i've been trying fix long time , tried pdo or mysqli knowledge of coding limited. how can read row properly? this php code: $response = array(); require_once __dir__ . '/db_connect.php'; $db = new db_connect(); if (isset($_get["pid"])) { $pid = $_get['pid']; $result = mysql_query("select *from cond id = $pid"); if (!empty($result)) { if (mysql_num_rows($result) > 0) { $result = mysql_fetch_array($result); $product = array(); $product["id"] = $result["id"]; $product["name"] = $result["name"]; $product["mon"] = $result["mon"]; $product["tue"] = $result["tue"]; $product["wed"] = $result["wed"]; $product["thu"] = $result[&qu

Python Mako: Adding a Default Namespace -

how can make namespace of form: <%namespace name="foo" module="foo.bar" /> available of templates in project default; rather each template having include above line @ start done automatically mako. have looked @ template , templatelookup class documentation there not seem easy way of doing this. you can combine inheritance inheritable namespaces achieve want.

php - Using ImageCopyResampled possibly causing memory shortages on files > 1MB -

i have app allow users upload photos to. first save image server , use imagecopyresampled() , it's friends resize image, replace old larger image new version. it works ok on smaller images (size wise, dimensions don't seem matter) on larger images function appears breaking @ point call imagecopyresampled function. on localhost largest sized image file script process ok 2mb. on live server it's 1mb. after checking , reading on here found out php.ini's settings memory limits, on localhost: memory_limit = 128m post_max_size = 128m upload_max_filesize = 128m and yet still won't let me sample image bigger 2mb on live server (which works 1mb) i've asked host who've said package has 30 mb of memory limit. surely 1mb file manipulated imagecopyresampled() wouldn't take 30mb of memory. can tell me if in fact imagecopyresampled() , lack of memory that's causing problem? if so, there can it? if not, there obvious might problem?

php - MySQLi json encoded data parsed into Google Chart -

i can't figure out correct way move mysqli data correct json echo google chart code. i query data , echo out results in json. $query = mysqli_query($con,"select count(e.song_id) song_count, c.show_id, e.show_id, date_format(c.show_date, '%y') s_year tbl_song_shows e, tbl_shows c e.song_id='{$sid}' , c.show_id = e.show_id group s_year order s_year desc"); //show stats graph// $table = array(); $table['cols'] = array( /* define datatable columns here * each column gets own array * syntax of arrays is: * label => column label * type => data type of column (string, number, date, datetime, boolean) */ // assumed first column "string" type // , second column "number" type // can change them if not array('id' => 'year','label' => 's_year', 'type' => 'string'), array('id' => 'value','label

sql server - How to execute sql scripts from a staging table in sql stored procedure -

what best approaches below scenario? in c# program, have sql commands such update, insert, delete. execute them in c# program (which works fine) need execute these sql commands when 1 of stored procedure comes last line. planning store sql commands in staging table in same database , open table within stored procedure , execute 1 one. what best approach in terms of opening table within stored procedure , traversing through table based on condition (like select * tempstagingtable customerid = '1000'). if returns 10 records, loop them , execute sql command stored in column named "customsqlscript" ps: using sql 2008 r2. well, can select data table initially, , instead of using cursor can use while loop(as increase performance compared cursor) , can execute predefined sql statement table b please find below sql scripts same please note: have not made use of relation,this plain example create table test1( customsqlscripts varchar(100) ) create t

ios - Need assistance regarding restoring purchase items count -

i using [[skpaymentqueue defaultqueue] restorecompletedtransactions]; restore purchased items, doing want count how many items going restore because have notification tells successful transaction done pops uialertview , alert pops every restore item. with count want limit restore alert pop once. take @ skpaymenttransactionobserver 's paymentqueuerestorecompletedtransactionsfinished: method. the documentation -restorecompletedtransactions states that: after transactions delivered, payment queue calls observer’s paymentqueuerestorecompletedtransactionsfinished: method. if error occurred while restoring transactions, observer notified through paymentqueue:restorecompletedtransactionsfailedwitherror: method. so method called once after transactions restored, , if temporarily disable alerts individual transactions while restoring them, fine.

Can you dynamically create the arguments for the zip() function in python 2? -

i passing in variable number of lists in *args function. i'd accomplish pass args zip(). def amv(db, *args): x = zip(args) return x i avoid following: if len(args) == 1: x = zip(args[1]) elif len(args) == 2: x = zip(args[1], args[2]) ...etc. erm... have it. x = zip(*args)

android - Using an ImageView transform matrix instead of canvas.scale(float, float, float, float) -

i need change way scaling , moving imageview using matrix instead of calling canvas.scale(,,,,) , cannot figure out proper calls this. i had in scalelistener listener class's onscale method public boolean onscale(scalegesturedetector detector) { ...//determining zoom level , pivot points offset child.zoom(scalefactor, zoomcenter[0], zoomcenter[1]); } i had in child imageview's ondraw method: protected void ondraw(canvas canvas){ super.ondraw(canvas); canvas.scale(mscalefactor, mscalefactor, mposx, mposy); ... //do drawing here } public void zoom(float scalefactor, float zoomcenterx, float zoomcentery) { mscalefactor = scalefactor; mposx = zoomcenterx; mposy = zoomcentery; //redraw , remeasure mapview after zooming in invalidate(); } i in onscale method: public boolean onscale(scalegesturedetector detector) { ...//calculating scale , offsets matrix m = child.getimagematrix(); m.reset

python 2.7 - Custom Django VM Control Panel - LDAP Questions/Insight needed -

i intern @ company summer. have been assigned project must done in django. have rough setup going , need feedback of how should further set things up. people on techops team spend time rebooting vms developers when break something. solution allow users themselves. project outline user logs in ldap credentials server gets ldap groups individual in ['techops', 'staff'] only servers apart of these ldap groups displayed user have ability reboot these vms server ssh designated vm domain via ssh key , trigger vm reboot i have ability users sign admin panel via ldap, not on separate authentication page website. there way populate user's ldap groups automatically? # populate django user ldap directory. auth_ldap_user_attr_map = { "first_name": "givenname", "last_name": "sn", "email": "mail" } i need understanding how ldap works(with django), , how can retrieve current user logged in,

ios - How to avoid crashes on call back to deallocated delegate objects -

my application on arc , still see few crashes. saw setting view controller delegate of alert view , when alert on screen, on tap on "ok" button moving previous view , current view controller getting dealloc-ed. after getting dealloc-ed, got call uikit alert view , crashes. safe handling, created property uialertview , in dealloc now, setting delegate of uialertview nil . working fine now. i see crash happening randomly: -[cfstring release]: message sent deallocated instance 0xd2de900 my question here there lot many places create local instances of objects (custom view controllers or ios objects uialertview ) , set view controller delegate of it. need create class level properties of them , delegate on them nil in dealloc ? there other easy alternative make sure no call happens after delegate object gone.

asynchronous - How to wait for an async method to be completed in a background tast -

implementing backgroung task fetch checksum on remote server , update live tile accordingly, i've bumped timing issue. here's code : matchlistimpl.istherenewresults(); newslistimpl.istherenewnews(); raisetoast(); updatetile(); it's rather simple. first 2 calls refering async function download 2 files "*.cksum" using webconnector. last 2 calls update tile , raise notification depending on content of downloaded files. the problem later function executed before 2 files downloaded, async method not being completed. , of course, whole logic of thing void. my question : there way "pause" execution of task wait async method on ? as absolutely unelegant, second question : there not better way of doing ? thanks yours answers :) you can pass current class async task , in onpostexecute method of async class call raisetoast() , updatetile() example: assuming in raisetoast() using files downloaded in

How to detect Ambiguous and Invalid DateTime in PHP? -

when dealing local datetime values provided user, it's quite possible have time either invalid or ambiguous, due daylight saving time transitions. in other languages , frameworks, there methods such isambiguous , isvalid , on representation of time zone. example in .net, there timezoneinfo.isambiguoustime , timezoneinfo.isinvalidtime . plenty of other time zone implementations have similar methods, or functionality address concern. example, in python, pytz library throw ambiguoustimeerror or invalidtimeerror exception can trap. php has excellent time zone support, can't seem find address this. closest thing can find datetimezone::gettransitions . provides raw data, can see methods written on top of this. exist somewhere? if not, can provide implementation? expect them work this: $tz = new datetimezone('america/new_york'); echo $tz->isvalidtime(new datetime('2013-03-10 02:00:00')); # false echo $tz->isambiguoustime(new datetim

class - C++ Workaround for listing all possible template implementations -

i've got multi-file project uses templates. // foo.h template <class t> class foo { t bar; }; i have class (e.g. cup) , bunch of subclasses of class. // cup.h class cup { }; class chalice : public cup { }; class sippycup : public cup { }; // ...etc. in template's .cpp file, need list possible template implementations avoid linker errors. learned c++ faq . //foo.cpp template class foo<cup>; template class foo<chalice>; template class foo<sippycup>; // ...etc. in reality, have 20+ subclasses i'd use @ point in code. in development, i'm creating new subclasses. each time create new one, have add growing list in foo.cpp . this pain. there way around having list of these possibilities? the way avoid put template function definitions in header file (i.e. in actual template definition) rather in separate .cpp file.

actionscript 3 - How to get caretIndex from a TextArea as TextField -

i saw lot of examples of using .caretindex index of cursor inside textfield text, i'm using textarea , there no such property, selection index. how cursor index position textarea? edit: ok, did test , selectionbeginindex returning value. "right" use it, or there specific way? you can use selectionbeginindex according adobe's documentation : if there no selection, value set position of caret.

Rails gem for adding text/images to site which retain the language syntax -

Image
i want make blogging site . basically, blogs contain posts of code snippets , other coding related stuffs . so side admin can add posts blog. writing code snippets, want add text-editor rails app post code syntax,highlight it , not plain text. something this: or it should support major languages c,c++,ruby, rails,python. suggest method/gem. ace editor syntax highlighting , editor. pretty good. github uses gists , things. for syntax highlighting, have many options such pygments.rb , coderay , , rainbow list few..

qt - QListView not accepting drops in QMainWindow with Python PyQt4 -

i'm not being able make qlistwidget accept dropped files. i've used qt designer make qmainwindow , qlistwidget . how can solve problem? this main.py import sys import os pyqt4 import qtcore, qtgui pythonapp import ui_mainwindow class mainwindow(ui_mainwindow): def __init__(self): super(mainwindow, self).__init__() listview = ui_mainwindow.listview listview.setacceptdrops(true) listview.seticonsize(qtcore.qsize(72, 72)) self.connect(listview, qtcore.signal("dropped"), self.picturedropped) self.setcentralwidget(listview) def picturedropped(self, l): listview = ui_mainwindow.listview url in l: if os.path.exists(url): print(url) icon = qtgui.qicon(url) pixmap = icon.pixmap(72, 72) icon = qtgui.qicon(pixmap) item = qtgui.qlistwidgetitem(url, listview)

Rubymotion multilevel BW::HTTP calls return early -

i attempting call method, from_server, giving block accept results. from_server loads list of items api each in list calls function add_update giving block accept results each detail. when of details have been handled, from_server calls block return summary. i can low levels work ok. problem first function calls block before done. not sure why or need put block.call the main caller from_server |updates, inserts| puts "\n updates = #{updates}" puts " inserts = #{inserts}\n\n" puts 'all done' end the from_server function calles def from_server(&block) inserts = 0 updates = 0 channels = [1,2,4,6,7] channels.each add_update("/api/channels/#{channel}", &block) |added, channel| if added inserts += 1 else updates += 1 end #do things channel end block.call(updates, inserts) unless block.nil? # problem here gets returned channels have been started on thread end end

gorm - Is it possible in grails to disable persistence of a domain class dynamically with inheritance -

my question related to/or identical is possible in grails disable persistence of domain class? i using grails 2.2.1 tried turn off domain class putting static mapwith = "none" gorm creates database table, , calling .save() put entry database. mapwith flag did nothing me. cannot find documentation regarding mapwith flag. there replacement in grails 2? update on sept 16 code package test class person { string name static constraints = { } static mapping = { version false tableperhierarchy false table 'psn' } } ------------------- package test class employer extends person{ static mapwith = 'none' string title static constraints = { } static mapping = { version false tableperhierarchy false table 'emplyr' } } --------- package test class employee extends person{ string description static constraints = { } static mapping = { version false tableperhierarchy false

c# - Where do I set the CookieContainer on a Service Reference? -

when adding webservice reference asmx service on .net 2.0 project example, var objservice = new namespace.groupservices(); there exists, objservice.cookiecontainer = new system.net.cookiecontainer(); when adding servicereference asmx service on .net 4.0 project example, var objservice = new namespace.groupservicessoapclient(); there isn't cookiecontainer property objservice a similar question asked here no positive solution. could please guide find property? in contrast asmx web services tied http transport, wcf allows various transport protocols used. therefore, not protocol-specific options (such cookies http transport) available in wcf service reference. you can, however, add message inspector inspects messages sent between client , server. article describes way send cookies server. i've extended sample use cookiecontainer. also, following code shows how evaluate set-cookie header sent server add new cookies container. please note sample s

node.js - Cannot install grunt-contrib-imagemin (weird error 1) -

i cannot install package grunt-contrib-imagemin in yeoman (angular) project. fails npm err! weird error 1 npm err! not ok code 0 but no other errors reported. i running ubuntu 12.04, , nodejs 0.8 this solved updating nodejs version 0.10 i followed instructions @ http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/

xml - php - how to parse a blog rss file -

i downloading blogs in rss format. example: <rss xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> <channel> <title> john doe clippingsconverter - google blog search </title> <link> http://www.google.com/search?hl=en&q=john+doe+clippingsconverter&tbm=blg </link> <description>1 result</description> <opensearch:totalresults>1</opensearch:totalresults> <opensearch:startindex>1</opensearch:startindex> <opensearch:itemsperpage>1</opensearch:itemsperpage> <item> <title>5 best kindle tips , tricks - make tech easier</title> <link> http://www.maketecheasier.com/5-best-kindle-tips-and-tricks/2010/10/16 </link> <description> <em>john doe</em>. can convert clippings file word, excel , pdf @ http://www.<em>clippingsconverter</em>.com &mid

JavaFX XYChart NumberAxis -

i'm having problems y axis on custom xychart. y axis numberaxis, , set tick label formatter custom formatter. auto-ranging off. when change upper bound of chart , request axis layout, old labels remain on chart. debug logging, can see custom formatter methods being invoked, , return correct strings, tick labels on chart not update. ones update ones not on axis before. example, if range of y axis 0 3, , change upper bound 3 5, new labels correct values show @ indices 4 , 5. however, labels 0 through 3 not update though custom formatter returns different strings them. i tried taking custom formatter out of equation , changed tick label fill color when changed upper bound of y axis, , saw same behavior (labels pre-existing indices had old color, , labels new indices had new color). hope i'm missing obvious. appreciated. otherwise may need resort recreating chart whenever y axis labels need change. from have found, tick labels immutable. once range set, add

Accessing Exchange Server using PHP -

i trying access windows exchange server using php. found class online connection exchange server http://www.troywolf.com/articles/php/exchange_webdav_examples.php the problem when try code syntax error , sure how solve it. if @ first example $h->xmlrequest = '<?xml version="1.0"?>'; $h->xmlrequest .= <<<end <a:searchrequest xmlns:a="dav:" xmlns:s="http://schemas.microsoft.com/exchange/security/"> <a:sql> select "dav:displayname" scope('hierarchical traversal of "$exchange_server/exchange/twolf/inbox"') </a:sql> </a:searchrequest> end; in second line syntax error , not sure how solve it. parse error: syntax error, unexpected t_sl also $exchange_server value put web mail address? ex. https://exch2.mydomain.com/owa/ thanks the code must looking this: $exchange_server = 'localhost'; $h->xmlrequest = '<?x

Sencha Touch 2 - Ext.device.SQLite.Database working? -

does have example of use of class ext.device.sqlite.database? can provide code it? i'm trying implement sqlite on st2 , build app native on android 4. when use websql, app didn't run, apperars 3 circles blinking , nothing happens. thanks! using proxy in webapps simple – switch proxy on model definition this: ext.define('app.model.model', { extend: 'ext.data.model', requires: ['ext.data.proxy.sql'], config: { identifier: { type: 'uuid' }, fields: [ ... ], proxy: { type: 'sql' } }}); the other thing worth noting that, because using database, save , load calls asynchronous. unlike localstorage, saves , loads instantly, need rely on sencha touch’s callbacks , listeners. load on both models , stores have callback, , save on model has callback

go - Golang parse a json with DYNAMIC key -

i have json string follows: j := `{"bvu62fu6dq": { "name": "john", "age": 23, "xyz": "weu33s" ..... .....} }` i want extract value of name , age above json string. looked @ example given @ golang site http://play.golang.org/p/yqgzp7kpp9 but problem key in json on top level dynamic. means bvu62fu6dq dynamic. have created struct this: type info struct { uniqueid map[string]string } but not sure how extract name , age . code @ http://play.golang.org/p/vbdkd3xikc i believe want this: type person struct { name string `json:"name"` age int `json:"age"` } type info map[string]person then, after decoding works: fmt.printf("%s: %d\n", info["bvu62fu6dq"].name, info["bvu62fu6dq"].age) full example: http://play.golang.org/p/fyh-cdp3na

mysql takes up a lot of memory when writing results to a file -

i have query so: mysql --port=3306 --host=remote_host -e 'select * pretty_big_table' > data.out the problem is, table pretty big , takes lot of memory. can't select ... outfile because i'm running on remote host. there way dump data out locally without taking memory? use mysql --quick . http://dev.mysql.com/doc/refman/5.6/en/mysql-command-options.html --quick, -q do not cache each query result, print each row received. may slow down server if output suspended. option, mysql not use history file.

php - Customizing 403 error messages -

i've set .htaccess file in directory not want users go, .htaccess file: deny errordocument 403 /upload/misc/403.php this not prevents users going /uploads/ directory, child directories want them go such site.com/uploads/1/. there fix this, or rather way can make 403 error parent directory, not sub-directories? thanks. you can put .htaccess file in each sub-directory , allow all . .htaccess files in child directories take precedence on parent directories. you might able use file match allow if know specific pattern. you instead of using errordocument , bootstrap files in /uploads/ php file displays error using mod_rewrite. use rewritecond skip sub directories. not write 403 error logs.

html - Text in p tag is not breaking to new lines -

Image
please have @ following image: and here code problem: <div class="excerpt"> <p>manual para la descarga e instalación de los contenidos digitales del proyecto canaima&nbsp;educativo,&nbsp;conformado&nbsp;por&nbsp;recursos&nbsp;de&nbsp;aprendizaje&nbsp;que&nbsp;buscan&nbsp;impulsar&nbsp;la&nbsp;interacción&nbsp;entre&nbsp;el[...]</p> </div> for bizarre reason text getting on top of columns right. tried changing height of of elements taking part 1000px, , still overlapping! edit: question had link succesfully answered changed image per @roddy of frozen peas suggested. as people suggested, if remove & nbsp; problem goes away. not case looks admin inserting & nbsp; , have no saying in changing admin. accepted answer solved it. use: word-wrap: break-word; on paragraph elements. that'll start forcing them start new line. .entry-footer .excerpt p { word-wrap: break-

Regex to Find Four Open Brackets without a Closing Bracket -

i'm trying find places in .less files nested 4+ levels deep without being closed. here i'm @ on rubular: http://rubular.com/r/a6uwyh0muv and in case you'd prefer see example here on so: ul { width:100%; li { width: 25%; { color: @blue; span { font-weight: normal; } } } } ul { width:100%; li { width: 25%; { color: @blue; } } } ul { width:100%; li { width: 25%; } } ul { width:100%; } the 1 want match first test string has 4 nested css properties. through various experiments, i've been able close still end matching parts of strings shouldn't caught regex. any appreciated. .*?(?:\{[^}]*?){4}(.*?\}) .*? makes sure find first one, not necessary (?:\{[^}]*?) finds 4 opening brackets without closing ones (.*?\}) capturing group until first closing bracket. if that's not want, can mo

c# - ACS signout redirect not working -

working on acs sso, , signout process works fine. problem users remain on same page calls logout action, no matter have set redirect to public actionresult logout() { //load identity configuration federationconfiguration config = federatedauthentication.federationconfiguration; //get wtrealm wsfederationconfiguration section string wtrealm = config.wsfederationconfiguration.realm; string wreply = wtrealm; //read acs ws-federation endpoint web.config string wsfederationendpoint = configurationmanager.appsettings["ida:issuer"]; signoutrequestmessage signoutrequestmessage = new signoutrequestmessage(new uri(wsfederationendpoint)); signoutrequestmessage.parameters.add("wreply", wreply); signoutrequestmessage.parameters.add("wtrealm", wtrealm); string signouturl = signoutrequestmessage.writequerystring(); federatedauthentication.wsfederationauthenticationmodule.signout(); return this.redirect(signou

How to use counters in a redis key? -

is there way in redis ? set counter 0 incr counter set key:{counter} "content of line 1" incr counter set key:{counter} "different content of line 2" my example code should substituted (i.e., transformed @ runtime redis-cli) into: set counter 0 incr counter set key:1 "content of line 1" incr counter set key:2 "different content of line 2" etc. my problem not how auto-increment counter. problem syntax: how include generic {wildcard} like: set keyname:{currentcounter} "value" ... any appreciated. lot ! bernie if using redis 2.6+ can use lua scripting along eval command following: eval "local c = redis.call('incr', keys[1]); return redis.call('set', keys[2] .. ':' .. c, argv[1])" 2 counter key "content of line 1" i broke onto multiple lines make easier read. edit sorry, away on business few days. here sample showing works. redis 127.0.0.1:6379

scala - Play 2 - Can't return Json object in Response -

i'm trying restfull web service poc using play 2.1.3 i have following class: case class student(id: long,firstname: string,lastname: string) now create restfull uri json serialised student pojo , return same pojo in response. implicit val studentreads = json.reads[student] implicit val studentwrites = json.writes[student] def updatestudent = action(parse.json){ request=>request.body.validate[student].map{ case xs=>ok(xs)}.recovertotal{ e => badrequest("detected error:"+ jserror.toflatjson(e)) } } but i'm getting compilation error - cannot write instance of entities.student http response. try define writeable[entities.student] i provided writes[a] implicit variable. what else missing? i think problem ok() method cannot figure out student needs transformed json, arguments ok() may vary. you may return ok(json.tojson(xs)) you may explicitly point desired type: ok(xs: jsvalue) and sure implicits

interop - Invoking custom javascript functions in clojurescript -

my project.clj follows : (defproject cljsbuild-example-simple "0.3.2" :description "a simple example of how use lein-cljsbuild" :source-paths ["src-clj"] :dependencies [[org.clojure/clojure "1.5.1"] [compojure "1.0.4"] [hiccup "1.0.0"]] :plugins [[lein-cljsbuild "0.3.2"] [lein-ring "0.7.0"]] :cljsbuild { :builds [{:source-paths ["src-cljs"] :compiler {:output-to "resources/public/js/main.js" :libs ["src-js/jsfuncs.js"] :optimizations :whitespace :pretty-print true}}]} :ring {:handler example.routes/app}) jsfuncs.js contains following code : function calculate(a,b,c) { d = (a+b) * c; return d; } how invoke js function within clojurescript files? tried invoke function via : (js/calculate 4 5 6) but did no

javascript - Jquery Fade in background-image on dynamically created div -

i've searched everywhere, can't seem find answer this... i'm looking way check if dynamically created div's background image has loaded. i have built photo gallery first makes ajax call , creates divs background images display thumbnails of photos in gallery. can check out here: http://www.aslamhusain.com/design.php#id=set_allison_basha i find way fadein each div when loads, can't find way check if background image has loaded. possible? appreciated! first time posting here, site has been lifesaver me!! in advance, here code: if($("#"+gallery_id).length<=0){ $.ajax({ url: "get_photos.php?gallery="+gallery, success: function(data){ //create gallery div $("#wrapper").append("<div class='page' id='"+gallery_id+"'><h2>"+gallery+"</h2></div>")

email - Can I use PHP to send a meeting invetation via exchange server? -

if use outlook know how can create meeting request , send different people , shows on calender. trying same idea sending request person via php. no sure if can send request using mail() somehow. want email sent , meeting request go on other party's calendar. how can using php? thanks you can create own activesync client sending http requests according activesync protocol: http://msdn.microsoft.com/en-us/library/dd299446(exchg.80).aspx http://msdn.microsoft.com/en-us/library/ee158066(v=exchg.80).aspx http://msdn.microsoft.com/en-us/library/dd299441(v=exchg.80).aspx if in section 2.2.2.9 of command reference, there mention of how acknowledge meetingresponse in user's "inbox folder" or "calendar folder". suspect create entry in "calendar folder" create initial meeting. there's this post on same topic.

asp.net - service reference wont update when I add a radtreeView? -

i have web service project referenced project. in web service have function want use populate telerik radtreeview. webservice builds if try update/add web service main project error: metadata contains reference cannot resolved: 'http://localhost:49304/service1.asmx'. there error downloading 'http://localhost:49304/service1.asmx/_vti_bin/listdata.svc/$metadata'. the request failed error message: request format unrecognized url unexpectedly ending in '/_vti_bin/listdata.svc/$metadata'. this simplified version of web service class i'm writing: namespace mcmwebservice {` [webservice(namespace = "http://tempuri.org/")] [webservicebinding(conformsto = wsiprofiles.basicprofile1_1)] [system.componentmodel.toolboxitem(false)] [scriptservice] public class service1 : system.web.services.webservice { [webmethod] public bool getbool(radtreeview treesites, string demogs) { //dummy method return true;

visual studio 2012 - Setting Typescript --module compiler option in WebEssentials? -

i unable install typescript on vis studio 2012. says it's installed, there's no add-in or extension. luckily, web essentials compile typescript. these nice products. i want generate typescript external module (for amd) there's no place set --module option. web essentials has options, they're true/false. , since vsix doesn't install have no build rules modify. if add typescript 'export' get: ts5037: cannot compile external modules unless '--module' flag provided. is there someplace can control web essentials compiler options from?? matter, can't ever find documentation on compiler options. thanks tools - options - webessentials - typescript - module : amd having said rely on grunt compilation : https://github.com/basarat/grunt-ts

java - Hibernate one-to-one XML mapping -

i found following links: hibernate 1 one mapping problem hibernate one-to-one mapping reference column (xml mapping) hibernate one-to-one (on foreign key) vs one-to-one (on primary key) but nothing seems work. i have 2 entities: class user { integer userid; profile userprofile; } class profile { integer profileid; user user; } with xml mapping: <?xml version="1.0"?> <!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping> <class name="model.user" table="user" catalog="proj1" dynamic-update="true"> <id name="userid" type="java.lang.integer"> <column name="userid" /> <generator class="identity" /> </id> <one-to-one name="userprofile"

Memory usage keep growing with Python's multiprocessing.pool -

here's program: #!/usr/bin/python import multiprocessing def dummy_func(r): pass def worker(): pass if __name__ == '__main__': pool = multiprocessing.pool(processes=16) index in range(0,100000): pool.apply_async(worker, callback=dummy_func) # clean pool.close() pool.join() i found memory usage (both virt , res) kept growing till close()/join(), there solution rid of this? tried maxtasksperchild 2.7 didn't either. i have more complicated program calles apply_async() ~6m times, , @ ~1.5m point i've got 6g+ res, avoid other factors, simplified program above version. edit: turned out version works better, everyone's input: #!/usr/bin/python import multiprocessing ready_list = [] def dummy_func(index): global ready_list ready_list.append(index) def worker(index): return index if __name__ == '__main__': pool = multiprocessing.pool(processes=16) result = {} index in range(0,100

sql - How to add a where clause to a column from a correlated subquery -

Image
i have following correlated subquery in sql server works fine select *, [status]=(select max([status]) data_121emaillog o2 o2.data_121id = o1.data_121id) data_121 o1 you can see what's going on here screenshot however, when try add clause on column in generated subquery doesn't work how can added clause on [status] column. in example should return 1 result there 1 record status of 2. following comment link marcinjuraszek solved me select * ( select *, [status]=(select max([status]) data_121emaillog o2 o2.data_121id = o1.data_121id) data_121 o1) a.[status] = 2

AngularJS and Ruby on Rails - Uploading multiple files directly to Amazon S3 -

i'm writing app users can write notes, , each note can have many files attached it. i users able click 'browse', select multiple files, uploaded when user clicks 'save note'. i want these files uploaded directly amazon s3 (or other cloud storage solution?) without going through server , don't have worry uploads blocking server. what best way accomplish this? have seen many examples upload directly amazon s3, none of them support multiple files . somehow have in javascript looping through collection of files selected browse button? thanks! technically, javascript residing in browser make http restful calls aws , store data in s3, exposing security credentials connect aws in script.. not good. i guess way process thru web-server can securely access aws , store notes.. or, write notes local disk (where webserver sits), , schedule tools s3cmd automatically synch them s3 buckets.

html - How to replace text in first TD based on the values of table stored in other TD with JQuery? -

i have multiple tables stacked inside div container below:- <div id="mycontent" style="display: block;"> <table id="mytable" cellspacing="0" cellpadding="0" > <tbody> <tr> <td style="padding-top: 10px;"> <table> <tbody> <tr> <td align="left"> health care (id-20) </td> </tr> <tr> <td align="left"> 20 wisconsin ave</td> </tr> <tr> <td align="left"> 641.235.5900 </td> </tr> <tr> <td align="left&qu