Posts

Showing posts from January, 2010

c - How to decrypt data using RSA public key? -

let me introduce problem, have *.crt file, contains der encoded x509 version 3 certificate. using asn1 der(libtomcrypt) decrypt data , save structure called x509v3 . have message m, encrypted signature of m -> s(rsa encrypted), , public key -> p located inside x509 certificate(subject public key field). first must decrypt s using public key p, problem can't find api this? looked libtomcrypt seems there no api takes public key( unsigned char * ) , encrypted data (also unsigned char *) , gives decrypted data( unsigned char *). thanks help! p.s. sorry english;) you 1 of countless victims of historical sloppy presentation of signatures, has created , still creates massive amounts of confusion. what have signature , want verify it. there exist several signature algorithms, , 1 of them called "rsa" because looks similar asymmetric encryption algorithm called similar. rough description of rsa signatures "you encrypt private key" (i.e. taking...

c# - OAuth client credentials (key + secret) needed in a desktop app even with valid token credentials -

i under impression once authorization process done, access token , secret (token credentials) needed use target resource. according quote [ in cases, client credentials cannot trusted , can used informational purposes only, such in desktop application clients ] may not case. running problem after authorization consumer key , secret (client credentials) still needed in order access resource. not seem right. i have implemented oauth in desktop application looking dotnetopenauth samples. have used unchanged inmemorytokenmanager , desktopconsumer , works once authorized. when restart app , reuse saved token credentials, app fails access resource. if used saved token credentials + client credentials, resource accessed alright. design? sounds incorrect no expert. this correct. per oauth 1.0 spec, client credentials required every time use access token. protects leaked access token being exploited client. reasoning assumes client secret in fact secret, point out cannot a...

oop - PHP Getting a reference through a constructor? -

i wondering if possible while using keyword 'new' return reference existing object instead of new object. , if not, best way avoid co-existence of objects same parameters? i have class arguments on constructor. if using arguments similar ones of existing instance, i'd new object reference existing one. possible? understand different singleton in case can have several instances of same class, not several instances using same parameters. class myclass{ public $signature; /* unique signature connection */ public static $instances = array(); /* array of references connection */ private static function singleton($cfg,$inst){ $signature = sha1(serialize($cfg)); foreach ( self::$instances $obj ) { if ( $obj->signature == $signature ) return $obj; } array_push(self::$instances,$inst); return true; } function __construct($myparam){ if ( is_object(self::singleton($myparam,$this) ) // here i'd $this become ref of existing obje...

.net - smtpclient.sendasync fails to work with too many recipients -

this application wpf windows application using c#, i trying send email long list of recipients. let me state @ outset not spam these people have signed list. i using smtpclient.sendasync. works fine in testing when send 1 3 people when send whole mailing list, fails work. number on list 2623. there no error message; it’s receipts don’t email. problem debug because can’t test by, example, sending 100 people because spamming. see code below. note changed email addresses prevent spamming. int32 _messagecount = 0; mailmessage msg = new mailmessage(); smtpclient client = new smtpclient(configuration.smtpserver); string _prioremail = ""; msg.from = new mailaddress("a@b.com"); msg.to.add (new mailaddress("a@b.com")); // bcc list foreach (string str in emailtoaddresses) { if (clsutilities.isanemail(str) == true && str != _priorema...

google app engine - Unable to update app: Failed to compile JSP Files -

i'm trying deploy app first time on app engine , i'm getting error saying "unable update app: failed compile jsp files". have ideas how can fix this. i've set eclipse point jdk1.6.0_17 in windows/preferences/java/installed jres. java_home set "c:\program files\java\jdk1.6.0_17". i've edited appcfg.cmd file in "appengine-java-sdk-1.4.2\bin" folder following: @"%java_home%"\bin\java -cp "%~dp0\..\lib\appengine-tools-api.jar" com.google.appengine.tools.admin.appcfg %* any ideas why happening? thanks you have both jre , jdk , eclipse uses jre when deploying problem. should use jdk. uninstall jre (using programs , features control panel). make sure path set jdk. if don't see add in path variable. should like: c:\program files\java\jdk\bin. adapt based on own config.

objective c - NSNumberFormatterCurrencyStyle number formatter without decimal digits -

i want price rounded displayed currency without digits after decimal symbol. without currency style there no problem. currency style overriding other properties set? after set currency style, try [currencyformatter setmaximumfractiondigits:0]; you may need set rounding mode well.

javascript - How to create page section based on JSON -

i have jquery slider code want populate via json url. below sample json starting with: { "context": null, "isgeneric": false, "items": [ { "description": "lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla tincidunt condimentum lacus. pellentesque ut diam....<a href="#" >read more</a>", "mediaurl": "\/images\/image1.jpg", "alternativetext": "15+ excellent high speed photographs", "height": 1050, "thumbnailurl": "\/images\/image1-thb.jpg", "width": 1680 }, { "description": "vestibulum leo quam, accumsan nec porttitor a, euismod ac tortor. sed ipsum lorem, sagittis non egestas id, suscipit....<a href="#" >read more</a>", "mediaurl": "\/images\/image2.jpg", "alternativetext": ...

PHP MongoDB, update document without erasing the rest -

i'm trying update mongo document, using php , update() function. however, when this, replaces whole document value wanted update. how can fix this? the code have written now: http://twaddlr.com/view/73 (scroll down "update" function. it's database wrapper i'm writting site) the key use $set in update, e.g. instead of (sorry using javascript syntax here, not sure exact php driver syntax): db.my_collection.update({hello: "world"}, {foo: "bar"}) you do db.my_collection.update({hello: "world"}, {$set: {foo: "bar"}}) if use $set , properties specify updated, whole document not replaced. you can read more in documentation, here: http://www.mongodb.org/display/docs/updating#updating-modifieroperations edit: looking @ code, in addrow method. same thing in update .

WPF Icon Won't show after install -

i have wpf app has icon. when run program using ctrl + f5 - works great! icon shows in task bar. if install on local computer developed app on... still shows. but, when install on different computer icon doesn't show in task bar or anywhere else. any ideas on one? thanks. i'm going guess did along following lines: <window icon="/resources/myicon.ico" ...> if that's case, make sure go myicon.ico file , change build action resource .

visual studio 2010 - Is there any graphical designer for ASP.NET MVC? -

i guess people use visual studio had same reaction when created first asp.net mvc project: did design view end up? when using classic web forms develop application in visual studio, design view handy, helps create user controls , other components in webpage drag , dropping item toolbox design page. although not allow positioning , advanced styling, dreamweaver instead, useful feature if want avoid painful html formatting , css styling (or not have knowledge of html). is there way use graphic designer create view layout , integrate design "logic" part of view (the 1 uses model populate/submit data from/to controller)? i guess people use visual studio had same reaction when created first asp.net mvc project: did design view end up? not @ all. never used design view in classic web forms , when migrated mvc didn't make difference. , not this, doesn't make sense use anymore. happy there no designer messing code anymore. have enough headaches intell...

php - AJAX contact form with user data -

i have built contact form checks errors , submits using ajax. problem want take users data (email, first name, , last name) , store in database. the contact form working fine until wanted accomplish second goal. database wordpress driven simple matter of wp_insert_user. php file needed header information access database added the_header() php file , entire function not work. have tested through firebug , should working nothing happens; no validation , no email. the contact form here. wondered if figure out problem http://www.divethegap.com/update/contact any ideas? edit -- after misunderstandings in commentary have removed offending the_header() line php file. disable function have inserted users data database show how form works , line causing problem. problem may point out has not stopped of other ajax functions working. http://www.divethegap.com/update/contact/

Automatically update drupal nodes at submit time -

is possible automatically update drupal node's content @ submit time? when adding images node, stored <img src="http://myserver/sites/...."> however, distribute content customer servers, , 'myserver' therefore incorrect. if used <img src="/sites/...."> can foresee issues (drupal installed @ root level). if not cause issues, can automated, when new content added, scans 'http://myserver/sites' , replaces '/sites' ? thanks in advance, martin i think gritty details depend on how uploading images... either default upload module or combination of filefield , imagefield (i'd recommend latter). either way.. should able make adjustments node automatically implementation of hook_nodeapi() (when $op == 'presave'). doing require custom module , don't deterred that, it's pretty straightforward set up. to see what's going on during hook, can make sure you're file info there , ready...

asp.net - Place Dynamically Generated Objects in an Array (or Collection)? -

i created custom class custom object. instantiate so: dim class_info new class_level then use linq-to-entities query pull information: dim get_config = p in dbcontext.configs _ p.type = "classdate" _ select p then have for..each loop want create instance of object information so: each row in get_config dim the_row = row class_info.class_level = the_row.description class_info.dateo = the_row.datevalue class_info.timeo = the_row.timevalue class_info.datec = the_row.datevalue class_info.timec = the_row.timevalue class_info.query = "q" + the_row.description next now, have 2 problems. first, right overwriting same object properties, again, , again. need somehow dynamically name object. then, need place these objects in array can iterate through them... what should project query type directly: dim class_infos = p in dbcontext.configs _ p.type = "classd...

PHP Remove duplicates from multidimensional array based on key -

i have multidimensional array ($array) in entries like: { ["upload/example.gif"]=> array(5) { ["title"]=> string(12) "this me" ["excerpt"]=> string(24) "this photo of tree" ["img"]=> string(42) "upload/example.gif" ["link"]=> string(23) "http://www.google.co.uk" ["source"]=> string(6) "custom" } } i need able remove duplicate values in $array based on key. if array was: $array = array( ["upload/example.gif"] => etc.... ["upload/tree.gif"] => etc.... ["upload/example.gif"] => etc....) i able remove 1 of ["upload/example.gif"] => etc.... arrays. i have tried: $array = array_map('unserialize', array_unique(array_map('serialize', $array))); but didn't work. thanks in advance. netcoder answered qu...

xamarin.ios - MonoTouch: proper way to handle ReceiveMemoryWarning -

i have monotouch app out in wild dies mprotect errno 12 (out of memory) , , seems @ least 1 receivememorywarning notification beforehand. i'm wondering right way respond is. there 2 types of things app free: opengl textures , managed memory. my questions are: opengl textures: deleting opengl textures help? managed memory: can't free directly, can null out references it. enough? gc.collect: should call gc.collect() @ end of handler? gc.collect immediately, or schedule collection future? anything else can/should in response this? i ran while in app using opengl. me, memory leak. [dllimport("/system/library/frameworks/coregraphics.framework/coregraphics")] public static extern void cgdataproviderrelease(intptr provider); and after call gl.teximage2d..... you need call cgdataproviderrelease(data.handle); now being said, might want @ this: http://forums.monotouch.net/yaf_postst1541.aspx

solr - SolrJ: Disable Autocommit -

we have instance of solr, we've found turning on autocommit in solrconfig.xml may serve our needs well. there instances , batch operations want temporarily disable autocommit. have not been able find anything, i'm wondering if knew if via solrj disable autocommit process, , re-enable it? you can't disable , enable autocommit it's configured in solrconfig.xml. however, can leave disabled in solrconfig.xml , use commitwithin add commands need autocommit .

data structures - most suitable language for computationally and memory expensive algorithms -

let's have implement tool efficiently solve np-hard problem, unavoidable possible explosion of memory usage (the output size in cases exponential input size) , particularly concerned performances of tool @ running time. source code has readable , understandable once underlying theory known, , requirement important efficiency of tool itself. i think 3 languages suitable these 3 requirements: c++, scala, java. provide right abstraction on data types makes possible compare different structures or apply same algorithms (which important) different data types. c++ has advantage of being statically compiled , optimized, , function inlining (if data structures , algorithms designed carefully) , other optimisation techniques it's possible achieve performance close of pure c while maintaining readability. if put lot of care in data representation can optimise cache performance, can gain orders of magnitude in speed when cache miss rate low. java instead jit compiled, allows app...

c# - Single-shot event subscription -

i'm convinced isn't possible, i'm going ask nonetheless. in order make single-shot subscription events, find myself using (self-invented) pattern: eventhandler handler=null; handler = (sender, e) => { someevent -= handler; initialize(); }; someevent += handler; it's quite lot of boiler-plate, , makes resharper whinge modified closures. there way of turning pattern extension method or similar? better way of doing it? ideally, i'd like: someevent.oneshot(handler) it's not easy refactor extension method, because way can refer event in c# subscribing ( += ) or unsubscribing ( -= ) (unless it's declared in current class). you use same approach in reactive extensions: observable.fromevent takes 2 delegates subscribe event unsubscribe it. that: public static class eventhelper { public static void subscribeoneshot( action<eventhandler> subscribe, action<eventhandler> unsubscribe, eventhan...

How to display blocks of text in drupal? -

i'm trying build module lets users role post messages displayed users different role. i'd 1 module handles both these things, however, furthest i've gotten setting form post messages. i'd show posted messages on same page input form (and hide form unauthorised users), can't figure out have show messages. how hard can display simple text? so far i've added item menu links page form on it. you make use of boxes module have online editing of text other users see. if you're set on using custom form put text in block.

visual studio - Build of project with RDLC cannot find custom assembly -

i've been tearing hair out 3 days trying rdlc report build in vs2010. want access custom assembly project in same solution in expression text item on subreport. there reference assembly in project containing rdlc , added reference assembly dll in properties of subreport, when build error telling me cannot find file: error while loading code module: ‘cccarchive, version=2.0.847.11068, culture=neutral, publickeytoken=null’. details: not load file or assembly 'cccarchive, version=2.0.847.11068, culture=neutral, publickeytoken=null' or 1 of dependencies. system cannot find file specified. the rdlc file appears have no path information assembly in xml , have tried putting copies of assembly in bin\debug folder under project containing rdlc , in same folder rdlc without success. judging little have been able find this, appears may have register assembly in gac build work, can't find direct confirmation of , putting in gac build run major nuisance. am missing som...

audio - What elements are involved with songs -

i want store , write songs. songs pitch? if stored pitch of each part of song , apply pitch bing sound , play replicate song? i'm confused. at minimum require sequence of notes, have pitch , duration. can improved chords , other types of polyphony, dynamics (volume or loudness), timbre, etc. you should midi technology , related file formats ideas such system, , possible means playing songs on computer.

sql server 2005 - How to insert new line to nvarchar using c# code -

i have table field ,description nvarchar(200). i inserting string lot of lines. when take quick watch on string in visual studio, can see string splited on mutile lines expected. line1 line2 line3 but when insert database using stored procedure,all "\n\r" beomes spaces. when read databse there no "\n\r" what can do? it should stored fine. when through ssms, removes newlines readability in grid.

xamarin.ios - Bring Safari to front -

i'd bring safari front (switch to) without using url, instead i'd see "pages" view user can pick loaded page. possible? we open links in safari , if user returns app , selects link again, i'd rather let them pick safari page browse instead of opening new one. know if same url called open correct page user may have navigated within original site url no longer matches. thanks, rick i don't think possible, use uiwebview inside app in order experience want, can find uiwebview apple docs here (http://developer.apple.com/library/ios/documentation/uikit/reference/uiwebview_class/reference/reference.html) , equivalence of c# methods here (http://tirania.org/tmp/rosetta.html) hope helps alex

ajax - django multiple model in dictionary json -

i want pass create json output dictionary multiple models, this: results = {} results["game_info_db"] = db.gameinfo.objects.get(name='name') results["dlc_list_db"] = db.gameaddon.objects.filter(game__name='name') what tried serialize (serializers.serialize) dicts entrys , after dumps (simplejson.dumps) dict... doesn't seems correct ... any sugestion ? you pass in values of models , convert list: results = {} results["game_info_db"] = list(db.gameinfo.objects.get(name='name').values()) results["dlc_list_db"] = list(db.gameaddon.objects.filter(game__name='name').values()) return httpresponse(json.dumps(results), mimetype='application/javascript') the data appear objects on javascript side. assuming have name column, can access attributes following: $.getjson("/ajax/", function(data) { var dlcs = data.dlc_list_db; (i = 0; < dlcs.length; i++) { var d...

javascript - window.Event vs window.event -

for reason when fired through c# code using ihtmlelement2.focus() method call, onfocus event not set window.event (which become null), instead other object window.event set event information. there reason this? using shdocvw interface internetexplorer , first time have seen issue. sounds typical microsoft bug. have problem case sensitivity since has been onverlooked distinction since day 1 of os. i suggest maybe looking kb article http://msdn.microsoft.com/en-us/library/aa703985(v=vs.85).aspx tabindex hooha sounds joke, else expect. then suggest trying 4th variant form of ihtmlelement particularly onfocusin event alternative onfocus. but since control environment via shdocvw object - i'd map window.event object window.event object in onfocus handler - 1 line of code never hurt no 1 - except when 1 line of code hurts stack overflow, buffer overrun or out of memory exception of course :d

javascript - include external .js file in node.js app -

i have app.js node application. file starting grow, move part of code in other files "require" or "include" in app.js file. i'm trying things like: // declare application var app = require('express').createserver(); // declare usefull stuff db purposes var mongoose = require('mongoose'); var schema = mongoose.schema; var objectid = schema.objectid; // following require not work require('./models/car.js'); in car.js: // define car model carschema = new schema({ brand : string, type : string }); mongoose.model('car', carschema); i got error: referenceerror: schema not defined i'm looking have content of car.js loaded (instead of having in same app.js file) there particuliar way in node.js ? to place emphasis on else has been saying var foo in top level not create global variable. if want global variable write global.foo . all know globals evil. if uses globals in node.js project on ref...

android - Simple display of data from SQlite database -

Image
i trying find simple example of displaying data sqlite database in layout. tried @ "notebook" example has 1 output column. there example out there multiple output columns and, if possible, integer data in of columns? theblitz, you may want consider creating own customer adapter . project created custom cursoradapter . result such: . here code custom cursoradapter if use example: public class itemadapter extends cursoradapter { private layoutinflater mlayoutinflater; private context mcontext; public itemadapter(context context, cursor c) { super(context, c); mcontext = context; mlayoutinflater = layoutinflater.from(context); } @override public view newview(context context, cursor cursor, viewgroup parent) { view v = mlayoutinflater.inflate(r.layout.items_row, parent, false); return v; } /** * @author * * @param v * view in elements set here displaye...

flex4 - Flex font rendering differences from 4.1 to 4.5 -

Image
i'm upgrading app flex 4.1 4.5 we've noticed arial font rendered differently between 2 versions when used @ small sizes. here's simple app example: <?xml version="1.0" encoding="utf-8"?> <s:application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minwidth="955" minheight="600"> <fx:style> @namespace s "library://ns.adobe.com/flex/spark"; @namespace mx "library://ns.adobe.com/flex/mx"; @font-face { src: url("/assets/fonts/arial.ttf"); fontfamily: arial; embedascff: true; } @font-face { src: url("/assets/fonts/arialbd.ttf"); fontfamily: arial; embedascff: true; font-weight: bold; } ...

Javascript does not work upon AJAX call -

i have page ajax call , loads entire page. page gets loaded has javascript. javascript works on page when loaded, when gets loaded ajax, javascript not work. dont know missing. the code of loaded page <html> <script type="text/javascript"> function showfield(name){ if(name=='lstbox')document.getelementbyid('div1').style.display="block"; else document.getelementbyid('div1').style.display="none"; } function hidefield() { document.getelementbyid('div1').style.display='none'; } </script> <head> </head> <body onload="hidefield()"> <form action = "test2.php" method = "post"> please enter name app <input type = "text" name = "name"> <table border = "1"><tr><th>choose label</th><th>choose element</th></tr> <tr><td><input type = "text" name...

Higher dimensional array vs 1-D array efficiency in C++ -

i'm curious efficiency of using higher dimensional array vs 1 dimensional array. lose when defining, , iterating through array this: array[i][j][k]; or defining , iterating through array this: array[k + j*jmax + i*imax]; my inclination there wouldn't difference, i'm still learning high efficiency programming (i've never had care kind of thing before). thanks! the way know sure benchmark both ways (with optimization flags on in compiler of course). 1 think lose sure in second method clarity of reading.

c# - can't get the exception of wcf under iis -

we running wcf service on iis throwing an exception. however, includeexception = true in servicebehavior configuration section , compile = debug no exception details revealed , generic message recommending enable attribute mentioned. how wcf show real error? please make sure have following 2 entries set true under servicebehaviors section <servicedebug includeexceptiondetailinfaults="true"/> <servicemetadata httpgetenabled="true"/>

c++ - Why was std::pow(double, int) removed from C++11? -

while looking efficient way compute p^q (exponentiation), q integer , reviewing c++98 , c++11 standards noticed apparently std::pow(double, int) overload removed in c++11. in c++98 26.5/6 has double pow(double, int); signature. in c++11 26.8 find overloads taking pair of float , double , or long double , , explicit note in case of mixture of parameter types integral&double, pow(double, double) overload should picked. is clarification of previous intention, incorrectly added in c++98, removed in c++11, or else? obviously pow(double, int) version provides nice opportunity optimization seems odd removed. compiler still standards conforming provide such optimized overload? double pow(double, int); hasn't been removed spec. has been reworded. lives in [c.math]/p11. how computed implementation detail. c++03 signature has changed is: float pow(float, int); this returns double: double pow(float, int); and this change done c compatibility. clar...

java - How to move around on a map with mouse and/or keys (RTS-like game) -

as title suggests, i'm making game there map, map of course bigger fit on screen rts games :) so, suggestions on how go this? map big jframe images drawn on it. i highly doubt drawing whole map in memory , choosing part display scalable. want draw user sees instead, in window-coordinates.

Access "My Maps" in Google Maps from Android -

i want write app display markers 1 of custom maps in google maps. how access data? there must api can't find information anywhere. if have created google maps map through browser tools, can copy link map , pass google map application on device. intent intent = new intent("android.intent.action.view"); intent.setcomponent(componentname.unflattenfromstring("com.google.android.apps.maps/com.google.android.maps.mapsactivity")); intent.addcategory(android.intent.category.launcher); // replace string google map url intent.setdata("your google map url here"); startactivity(intent); i don't believe mapview api supports maps, 1 path use google map application if want view data. or export out of maps kml , parse app, responsible putting down of poi markers, etc. update 2011-04-13: if add on parameter 'output=kml' google maps link url can kml file of map. kml xml file containing of points of interest on map along lat/long , det...

android - Want to package a small video in the package for deployment -

is there way reference programmatically small video file adn include in teh package - i.e. don't want have separate on sd card. thinking of putting in 'raw' package directory. e.g. mpeg4 called 'video' in 'raw' am trying work out correct format uri.parse() has beaten me. thought should r.raw (as used when setting media player audio mymediaplayer = mediaplayer.create(this, r.raw.audiocameralive1) - doesn't seem be. any suggestions oliver i see there have been number of views, in case looking solution, did - , seems work fine. there cleaner way of doing same but, 1 makes sense me ... oliver public class showvideoactivity extends activity implements surfaceholder.callback, onerrorlistener, onpreparedlistener, oncompletionlistener { /** called when activity first created. */ private mediaplayer mymediaplayer; boolean bolmediaplayerisreleased = false; // surfaceholder , surfaceview used display video // implemen...

Killing EXCEL.exe Process from C# in a Windows Service -

i have windows service opens excel spreadsheet via microsoft.office.interop.excel.application object. application xlapp = new application(); workbook workbook = xlapp.workbooks.open(filename, 2, false); ... ... workbook.close(); xlapp.quit(); i kill excel.exe process left running after done working workbook. i've tried following no success... // returns processid of 0 intptr processid; getwindowthreadprocessid(new intptr(xlapp.hwnd), out processid); process p = process.getprocessbyid(processid.toint32()); p.kill(); anyone have ideas how can via windows service? properly closing open excel workbook , quitting app extremely difficult. if can find links i'll post them, must clean references com object create . includes odbcconnections (data connections), worksheets, workbooks, , excel application. combination got work involved garbage collection , system.runtime.interopservices.marshal object: // garbage collecting gc.collect(); gc.waitforpendingfi...

Validating Select Box with PHP? -

i have coded in php today first time needed validate select box , shocked realise not sure how to. html: (ignore session stuff in code) <label for="gender">gender</label> <select id="gender" name="gender" class="select option"> <option<?php if( $_session['gender'] === "" ) { echo ' selected="selected"'; } ?> value="">&nbsp;</option> <option<?php if( $_session['gender'] === "male" ) { echo ' selected="selected"'; } ?> value="male">male</option> <option<?php if( $_session['gender'] === "female" ) { echo ' selected="selected"'; } ?> value="female">female</option> </select> basically wrote php code below thinking validate whether tamper values or not in browser using firebug returns gender not valid error. the rest of edit ...

ruby on rails 3 - Are you supposed to put *.css files into git when they're generated from *.scss? -

i started using sass scss stylesheets. these generate *.css files *.scss files. question is, files check version control? right check in both main.scss , generated main.css . wonder though if there way check in *.scss file , ensure *.css files generated on deployment. in general, don't need check generated files source control. long code generation works consistently, , use consistently update target .css files, don't think need put them in source control. that said, suggestion not put generated files source control intended more binary files (i.e. libs or executables generated build). main reason binary files cannot diffed/merged, if multiple people try checkin changes same binary, may end merging issues cannot resolved. since you're dealing plain text css files, don't think it's big of deal put them in source control too, have backup of actual target file.

ruby on rails 3 - What's wrong with my delete link? -

<%= link_to "delete party", party_path(@party.id), :method => :delete %> a called according logs. redirected same show page when click delete link. instead of @party.id, use @party in party_path().

java - Good books and web resources for JOGL and JMonkeyEngine? -

i trying decide between using jogl , jmonkeyengine on project learn bit basics of each , decide 1 prefer. have books or web resources recommend learning how use each one? prefer stuff gives lot of detailed information , examples use style on brief online tutorials poor quality code examples. official documentation good, haven't yet found either. jmonkeyengine says has complete documentation haven't yet located on website. information appreciated. i should mention have never used opengl before. if go jogl need learn of opengl basics, need resources on opengl if jogl resources don't go full detail on it. updated: jmonkeyengine 3 beginner's guide jmonkeyengine 3 cookbook i in jmonkey core team, albeit not programmer. for starters, if you're considering jogl, hope you're looking @ jogl2 jogamp , , not old abandoned 1 on @ java.net. in terms of use, jogl , jme 2 different things. jogl, lwjgl jme (and minecraft, name one) based...

JSONP works in jQuery but not in mootools -

i'm trying convert code mootools (i coding paradigm better). i doing cross-domain ajax own both domains (closed network). requesting simple json server. these errors in mootools (jquery works): resource interpreted script transferred mime type text/plain. uncaught syntaxerror: unexpected token : var url = http://localhost:3000/ server: var http = require('http'), json = {"hi" : false}; http.createserver(function(req, res) { res.writehead(200, {'content-type': 'text/plain'}); res.end(json.stringify(json)); }).listen(3000, function() { console.log("server on " + 3000); }); jquery: $.ajax({ url: url, type: "get", datatype: 'json', success: function (data) { } }); mootools: var myrequest = new request.jsonp({ url: url, oncomplete: function (data) { alert(json.stringify(data)); } }); myrequest.send(); i've tried adding these headers no ava...

c++ - Why this code compiles in VS? ("extra" comma) -

the line below inside loop. if method fails, needs break. category_1 enum. added enum new parameter addtolist method default value. if see closely below, made mistake of putting comma , enum outside parameter list of function. compiles fine vs2010. had hard time finding that default value being passed parameter instead of category_1. know why succeeds? if (! addtolist(obj1, (unsigned int) val), category_1) { break; } in c++, comma isn't separator; can operator. comma operator. comma operator evaluates first expression, discards result, evaluates second expression , yields result. !addtolist(obj1, (unsigned int) val) , category_1 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ first expression second expression [of course, comma operator, other operators, can overloaded, , if overload used here, semantics different. behavior of built-in comma operator.]

ios - Interface builder not loading in xcode -

i using xcode version 3.2.6 , ios sdk 4.3. created new view based app (iphone or ipad). after double clicking on view controller xib , interface builder not loading up. seems it's attempting open, nothing. have thoughts? xcode 3.2.6 has separate ib sdk. so, can try open file interface builder, or if problem persists, can reinstall xcode. maybe "built-in" bug, happened me too, many times.

Google Maps marker clicks do not work on iPad when using Sencha Touch -

has been able map marker clicks working on ipad? have tried following, worked nicely on google chrome, not on ipad. // marker var marker = new google.maps.marker({ position: location, title: 'title', map: map, icon: '/images/marker.gif' }); // click listener google.maps.event.addlistener(marker, 'click', function() { ... }); the problem was listening on "click" events when should have been listening on "mousedown" events.

actionscript 3 - problem with reaching attribute in xml -

i'm trying put each attribute xml file , store each attribute in object, can't reach them, doing wrong? have 2 other classes wich loads image too, not important question. thankful answer xml: <personal> <person id="1" name="oprah winfrey" image="oprah-winfrey.jpg" title="administrator"></person> <person id="2" name="zlatan ibrahimovic" image="zlatan-ibrahimovic.jpg" title="technician"></person> <person id="3" name="barack obama" image="barack-obama.jpg" title="ceo"></person> </personal> as3: private var _items:array = new array(); private var _xmlloader:urlloader = new urlloader(); private var _loader:loader; private var _urlrequest:urlrequest; private var _xml:xml; public function main(){ _xmlloader.load(new urlrequest("personal.xml")); _xmlloader.a...

Rails 3 and Devise: authenticating a user while performing a POST action -

using rails 3.0.6, omniauth 0.2.0 , devise 1.2.1, i'm encountering following situation: i want offer users option authenticate via facebook. have user system set using devise , can auth using facebook. i've spent several hours trying code behavior want 1 specific situation: user not logged in user has site account user authenticates via facebook i offer user 2 choices @ point create account (can dummy account no provided info) link facebook authentication existing account i'm having trouble latter option. user has authenticated still need him log in site account. have action in authenticationscontroller associate authentication logged in user. devise doesn't seem offer way me log user in while staying in same action, though. first attempt this class authenticationscontroller < applicationcontroller before_filter :authenticate_user!, :only => :auth_link_existing_user ... def auth_link_existing_user ... end however, using...

sockets - Optimal block size in java streams -

i have theoretical question. let's imagine have inputstream , outputstream . nead copy content 1 other , don't know size of content need transfer. best choice in general of block size in write method? the answer is: it depends. general solution, stop worrying , use library. common choices: apache commons io ioutils#copy() or copylarge() , or google guava 's bytestreams#copy()

c# - What are the real downsides of using ReaderWriterLock -

we have project targeted .net 2.0 rtm (yes, should .net 2.0 rtm, have orthodox clients). , i'm wondering downsides of readerwriterlock ? why bad tell "don't use it, try use else lock statement"? if use .net 3.5, use readerwriterlockslim , readerwriterlock i'm little scary these warning coming everywhere. measured performance or whatever? if there performance issues, under payload can encounter them? we have classic situation in terms of readerwriterlock main purpose, i.e. multiple reads , writes. using lock statement block readers. perhaps it's not awful issue us, if use readerwriterlock more satisfied. imo introducing several monitors very bad idea indeed. following few posts can provide ideas looking for. performance comparison of readerwriterlockslim readerwriterlock rico mariani on using readerwriterlock part post explains of costs , scenarios use readerwriterlock, check part 1 , part 2 jeffrey richter on alternative readerwrite...

wcf - Does recycling the IIS7 application pool kill any currently executing requests? -

does recycling iis7 application pool kill executing requests? or wait requests complete (like drain-stop)? i don't want recycling rules cause intermittent errors wcf sites. thanks no. by default, www service establishes overlapped recycle, in worker process terminated kept running until after new worker process started. this documentation iis6 , sure applies iis7. if web service requests long-running, might consider increasing shutdown timeout.

iphone - Are there any sites that show how to recreate specific iOS UI paradigms? -

idevrecipes awesome site goes detail on how popular , specific iphone components have been developed. wondering if crew knew of other sites similar this? great ios developers. i stumbled across custom controls ios last night , looks there links source code @ least few of custom controls on idev recipes, , there plenty more custom controls not featured on recipes site. guess it's not pedagogical recipes website, can still browse source code great way learn making own custom controls.

Entity Framework: Insert a new record and Update information of this record -

i don't know how can handle situation, can me ? a. i insert new record table var news = new news(); news.title = "hello world"; myrepository.insertnews(catid,news); in insertnews() function, call mydbcontext.savechanges(); , new record inserted database. in time, have id of new record. b. after have id of new records , need call other functions process business , data update new record. news.metadata = newdata; and call mydbcontext.savechanges(); my system displays error message. the property 'id' part of object's key information , cannot modified. please me resolve issue. thanks look @ thread : the property 'id' part of object's key information , cannot modified

reflection - Filling object fields value at runtime falls under which design pattern -

just having question in mind thought lets views expert. might silly question. actually using reflection mechanism fill of fields value of class @ run time. lets have class 5 fields. i'll set value of 2 fields @ compile time remaining 3 fields value i'll set @ run time. so question fall under design pattern? regards, mahendra athneria this close autofixture does. internal architecture big chain of responsibility . the builder pattern comes mind.

qt4 - why Mainwindow is closed during pressing the OK button of the messagebox -

i have mainwindow , button.i parsing 1 xml , rwesult displayed in messagebox...when pressed ok button of messagebox show next loop of xml...and @ end mainwindow closed.i dont want close mainwindow....how achieve it????? it seems mainwindow dialog. try change type of form (formborderstyle property). maybe, should change property acceptbutton.

Merging asp.net application with asp.net mvc -

what care need take when merging existing asp.net 3.5 application asp.net mvc 1.0 application? there some blog posts illustrating how mix asp.net mvc classic webforms.

arrays - PHP array_search -

is there function accomplish equivalent of array_search $needle array? like, ideal solution: $needle = array('first', 'second'); $haystack = array('fifth','second','third', 'first'); // returns key 1 in haystack $search = array_search( $needle, $haystack ); if no function, other functions accept needles may arrays can use create custom function? this might build function: $intersection = array_intersect($needle, $haystack); if ($intersection) // $haystack has @ least 1 of $needle if (count($intersection) == count($needle)) // $haystack has every needle

javascript - Remove everything after a certain character -

is there way remove after character or choose character? i'm getting value href , "?", , it's going different amount of characters. like this /controller/action?id=11112&value=4444 i want href /controller/action only, want remove after "?". i'm using now: $('.delete').click(function (e) { e.preventdefault(); var id = $(this).parents('tr:first').attr('id'); var url = $(this).attr('href'); console.log(url); } var s = '/controller/action?id=11112&value=4444'; s = s.substring(0, s.indexof('?')); document.write(s); sample here edit: i should mention native string functions faster regular expressions, should used when necessary (this isn't 1 of cases). 2nd edit: updated code account no '?': var s = '/controller/action'; var n = s.indexof('?'); s = s.substring(0, n != -1 ? n : s.length); document.write...

Common Lisp: non-nil arguments and their names to alist, how? -

i quite new common lisp , programming, , i'm trying write function turns non-nil args alist. way can think of far is: (let ((temp nil)) (if arg1 (setf temp (acons 'arg1 arg1 nil))) (if arg2 (setf temp (acons 'arg2 arg2 temp))) ... (if arg20-ish (setf temp (acons 'arg20-ish arg20-ish temp))) (do-something-with temp)) which not seem elegant, messy many arguments , when these need changed. i looking smarter way this , both sake of writing particular function , learning how think in lisp and/or functional programming. the tricky part me figuring out how names of arguments or symbol use, without hand coding each case. if &rest provided arg names easy filter out nils loop or mapcar, since doesn't, can't see how "automate" this. i'm totally interested in other solutions 1 described, if people think way unnatural. edit : below example of trying do: an object created, non-fixed number of dat...