Posts

Showing posts from September, 2010

node.js - node js Hapi js and heroku how to handle https -

i want allow https traffic hapi js server. in thread: node.js, express , heroku - how handle http , https? it accomplished by: if (process.env.node_env == 'production') { app.use(function (req, res, next) { res.setheader('strict-transport-security', 'max-age=8640000; includesubdomains'); if (req.headers['x-forwarded-proto'] && req.headers['x-forwarded-proto'] === "http") { return res.redirect(301, 'https://' + req.host + req.url); } else { return next(); } }); } this npm module this: https://www.npmjs.org/package/hapi-require-https

javascript - Add extra fields dependent of other query to query result in mongodb, using mongojs -

i need make mongodb query , add field each 1 of results. field values depend of result of query. i'm trying call nested query in server.js code. it's not working because res.json(data) called before data elements modified. suspect there's way want using nested query (or using foreach or aggregate ) in db.js code, lack of experience javascript/mongo didn't let me find solution. any appreciated. server.js app.get("/get_users_list", function(req, res) { db.getusersbycity(req.query.city, function(err, data) { if (err) { res.send(err); } else { for(var in data) { var rec = data[i]; db.checkvisitation({'user_id': req.query.user_id, 'friend_id': rec.user_id}, function(inner_err, inner_data) { if (inner_data) { rec["visited"] = "true"; } else { ...

sql - MySQL update query that uses aggregation subquery on the same table -

i have table named "tablea" contains "customer_id" , "name" fields. added new field "ref". want update table "ref" field set 1001 first item of customer_id=1, 1002 2nd item of customer_id=1, etc. , again 1001 first item of customer_id=2, etc. of course, i've got that-was-to-be-expected mysql error message "you can't specify target table 'tablea' update in clause". also tried using (select next_ref (select ... a_sub. customer_id = a. customer_id ) a_sub), mysql says "a. customer_id " isn't found. here's query: update tablea set a.ref = ( select coalesce(max(a_sub.ref) +1, 1001) tablea a_sub a_sub.`customer_id` = a.`customer_id` ) o.ref null; question is: can done in 1 query or have use temporary table? help! yes. need use update / join : update tablea join (select a_sub.`customer_id`, coalesce(max(a_sub.ref) +1, 1001) newref tablea a_sub ...

How to filter JSON array in C# -

i have spent lot of time find solution problem. in example, have 2 records in setnavrecords array. first 1 "artikelnummer" : "21700" , second 1 "artikelnummer" : "21701" each record have array "offlineverkaufspreis". important me field "location_code" in "offlineverkaufspreis" need hole informations 1 filtered location code. how can select data 1 location code, example "mh"? i using c# , newtonsoft class json parsing. i have tried versions linq without success. { "setnavrecords" : [ { "artikelbeschreibung" : "trikot \"home\" 2012/2013", "artikelbeschreibung2" : "weiß", "artikelnummer" : "21700", "artikelrabattgruppe" : "merch", "gutschein" : false, "mwstproduktgruppe" : "vollneu", "offlineverkaufspreis" : [ { "allow_line...

angularjs - json value getting it as "[object Object]" -

in angularjs ng-route since params dynamic i'm passing json shown below $scope.filmnames= { 'films': { 'film': [{ filmname: 'abcd', filmyear: '123' }, { filmname: 'bcd', filmyear: '145' }, { filmname: 'def', filmyear: '128' }] } }; '.../index.html#/admin?jsonobj='+$scope.filmnames ans succesffully sending like http://localhost:8000/index.html#/admin?jsonobj=[object object] but @ controller receiver when tried through using $routeparams like var jsonobj= $routeparams.jsonobj; console.log(json.stringify(jsonobj)); it been printing "[object object]" , instead of values can please tell me solutions this when convert o...

r - how to retrieve all the records from dataframe with a particular column having two values -

i have data frame called "specdata" this dataframe specdata consists: head(specdata) date sulfate nitrate id 1: 2003-01-01 na na 1 2: 2003-01-02 na na 1 3: 2003-01-03 na na 1 4: 2003-01-04 na na 1 5: 2003-01-05 na na 1 6: 2003-01-06 na na 1 tail(specdata) date sulfate nitrate id 1: 2004-12-26 na na 332 2: 2004-12-27 na na 332 3: 2004-12-28 na na 332 4: 2004-12-29 na na 332 5: 2004-12-30 na na 332 6: 2004-12-31 na na 332 the data frame contains id column 1 332 , sulfate has values other na's. when tried retrieve values of sulfate column id column==1, worked used below code that: subset(specdata$sulfate,specdata$id==1) what need should able retrieve values of sulfate column id = 1:20, didn't worked. i used below code that: ...

c# - double.ToString("G") but always include point? -

is there formatting code assumes "g" formatting specification ensures decimal point shown? for instance: 1 = "1.0" 123 = "123.0" 10000 = "1e+4" or need use following: string str = somedouble.tostring(); if (!str.contains('.') && !str.contains('e') && !string.contains('e')) str += ".0"; use can use n+count format count shows digit counts after . somedouble.tostring("n1")

html - Could this be possible? <img src="LINK WITHOUT IMAGE FORMAT" /> -

¿is there way insert html image element link without image format , watch , specific image of link? , happend if link has image? thanks no not directly supported. you call service, make picture of site (or make own) , provide link picture. for example: http://www.convertapi.com/web-image-api or take @ this: https://stackoverflow.com/a/6678156/2441442

gradle - FAILURE: Build failed with an exception. Could not expand ZIP -

microsoft windows [version 6.1.7601] copyright (c) 2009 microsoft corporation. rights reserved. c:\users\onergamer>e; 'e' not recognized internal or external command, operable program or batch file. c:\users\onergamer>e: e:>cd e:\project\minecraft\mcp\forge-1.7.2-10.12.1.1078-srce:\project\minecraft \mcp\forge-1.7.2-10.12.1.1078-src\decom2.bat filename, directory name, or volume label syntax incorrect. e:>cd e:\project\minecraft\mcp\forge-1.7.2-10.12.1.1078-src e:\project\minecraft\mcp\forge-1.7.2-10.12.1.1078-src>e:\project\minecraft\mcp\f orge-1.7.2-10.12.1.1078-src\decom2.bat e:\project\minecraft\mcp\forge-1.7.2-10.12.1.1078-src>gradlew setupdecompworkspa ce eclipse powered mcp: http://mcp.ocean-labs.de/ searge, profmobius, fesh0r, r4wk, zeux, ingiskahn mcp data version : unknown :extractuserdev skipped :getassetsindex :getassets :copyassets :extractnatives up-to-date :gensrgs skipped :downloadmcptools up-to-date :downloadclien...

sql - What does this tree look like? -

i have table ancestors , leaves describes tree. how directed graph like? can't seem diagram work. ancestor leaf ---------- ---------- 1 6 1 8 1 9 2 6 2 8 2 9 3 6 3 8 3 9 4 8 4 9 5 6 5 8 7 8 do know tree is? if draw graph above data see there several loops. can't tree.

python correct dictionary notation -

i need like {"a"=1,"b"=2,"c"=3,"d"=4} but python not able decode it, gives me error message. there way around that? thank you replacing "=" ":" should work...

android - Adapter nullpointexception when reload listview -

i spend 3 days on bug still can't why happen. in fragment oncreateview call asynctask: new getacceptedmeetings().execute(); getacceptedmeetings: private class getacceptedmeetings extends asynctask<string, string, string> { int shortanimtime = getresources().getinteger( android.r.integer.config_shortanimtime); @override protected void onpreexecute() { super.onpreexecute(); acceptedlv.setvisibility(view.gone); loadstatusview.setvisibility(view.visible); loadstatusview.animate().setduration(shortanimtime) .setlistener(new animatorlisteneradapter() { @override public void onanimationend(animator animation) { loadstatusview.setvisibility(view.visible); } }); } @override protected string doinbackground(string... params) { list<namevaluepair> meetingparams = new arraylist...

java - Can you return Annotations as objects? -

say wanted return version without having create variable, or perhaps serial or reference ( @see ), similar to: public @version getversion() { return /*the @version tag on class*/; } where @version runtime-visible annotation declared on class or method (and java 8, type annotations)? i'm not quite sure, perhaps you're looking this: @version(4) public class thisclass { public static version getversion () { return thisclass.class.getannotation(version.class); } } i'm not sure precise "version" annotation you're using, or if you're trying do, seems possible answer kind of problem you're trying solve.

html - CSS3 Scale property Blurs Result of animationin Google Chrome -

i doing simple animation using scale property facing following problem: it works fine in mozilla firefox browser blurs result in google chrome when scaled large. why happening? use -webkit- prefix google chrome. i have following code : <!doctype html> <html> <head> <meta charset="utf-8"> <title>free sorry ecard</title> </script> <style> .background-effect{ height:600px; width:800px; width:800px; position:absolute; overflow:hidden; display:block; z-index:1; } .b1-heart{ position: absolute; width: 100px; height: 90px; top:250px; left:350px; opacity:0; -moz-animation: heartbeat 4s linear 0s infinite; -webkit-animation: heartbeat 4s linear 0s infinite; } .b1-heart:before, .b1-heart:after{ position: absolute; content: ""; left: 50px; top: 0; width: 50px; height: 80px; background: #ff0066; -moz-border-radius: 50px 50px 0 0; border-radius: ...

javascript - how to assign the ajax return data to my variable? -

i trying unable set return data of ajax call variable $variable. remember working in js file var variable = {} $(document).ready(function () { jquery.ajax({ type: 'post', url: baseurl + 'port/skills', context: document.body, error: function (data, transport) { alert("sorry, operation failed."); }, success: function (data) { //var countries=data; $("variable").val(data); } }); }); use variable = data; instead of $("variable").val(data);

ruby on rails - Can params field that is not part of params.require.permit be modified by user? -

if have nested resources, such as resources :club resources :agenda end and relationships follow: club has_many agendas agenda belongs_to club if agenda's create action takes in params[:club_id] , assign agenda's club reference, safe assume user cannot modify field (club_id not part of params.require.permit )? what mean is, still need check whether club_id belongs current user before creating agenda params[:club_id] , or can trust params[:club_id] cannot tampered user. i'm worried user can create agenda club modifying params' hashes. fyi, related gems i'm using devise , cancan. first thing need read on authorization (great railscast here) system then need ensure system set correctly: if users cannot modify specific resources, need authorization before they're able edit / submit them. this, can use cancan gem determine whether user can edit / create resource @ controller level: #app/controllers/agendas_contr...

vb.net - How to shadow an interface property? -

i've got generic interface inherits non-generic interface. somehow compiler does't how i've done this. i'd appreciate in figuring out how accomplish inheritance in manner compiler doesn't whine about. public interface imessage property messagetype uint16 property payload object end interface public interface imessage(of t) inherits imessage shadows property payload t end interface public class message(of t) implements imessage(of t) ' <-- line highlighted in vs. public property messagetype uint16 = 0 implements imessage(of t).messagetype public property payload t = nothing implements imessage(of t).payload end class class 'message' must implement 'property payload object' interface 'imessage'. implementing property must have matching 'readonly' or 'writeonly' specifiers. shadows property payload t by using shadows , tell compiler payload prope...

php - Laravel Homestead -

i'm trying laravel homestead , running. believe did manual says. when run vagrant -command following error on os x 10.9: my homestead.yaml file following: --- authorize: /users/foo/.ssh/id_rsa.pub keys: - /users/foo/.ssh/id_rsa.pub folders: - map: /users/foo/projects to: /home/vagrant sites: - map: site.dev to: /home/vagrant/site/public and while executing vagrant up : bringing machine 'default' 'virtualbox' provider... ==> default: box 'laravel/homestead' not found. attempting find , install... default: box provider: virtualbox default: box version: >= 0 ==> default: loading metadata box 'laravel/homestead' default: url: https://vagrantcloud.com/laravel/homestead ==> default: adding box 'laravel/homestead' (v0.1.6) provider: virtualbox default: downloading: https://vagrantcloud.com/laravel/homestead/version/7/provider/virtualbox.box ==> default: added box 'laravel/home...

asp.net - Why 304 result getting instade of 200 when website is loading? -

Image
i developed 1 application www.smetiger.com whhen open or load web application , go network traffic capturing, hitting shift + f5 result tab shows 304 instead of 200 what reason resultcode 304 ? is 304 response result making website slower? an error code 304 means page not modified since last request. doesn't slow down page. in contrary, when statuscode 304 returned, browser uses data in cache. can read behaviour in http 1.1 specification . to analyze website can use developer tools. if you're using safari or chrome developer tools available. safari developer tools documented on apple page . in firefox can install addon firebug .

ios - Parse 122 error upload -

if save text without having text in field error message in parse.com: update failure - operation couldn't completed(parse error 122.) if press ok , try dismiss view cancel(a button item) app crashes. think valid file name @ parse.com has contain @ least 1 character. maybe can do stop user saving when not enter text? ideas? this code: - (ibaction)save:(id)sender { // create pfobject profile information pfuser *profile = [pfuser currentuser]; [profile setobject:nametextfield.text forkey:@"name"]; [profile setobject:titletextfield.text forkey:@"title"]; [profile setobject:locationtextfield.text forkey:@"location"]; // profile image nsdata *imagedata = uiimagejpegrepresentation(profileimageview.image, 0.8); nsstring *filename = [nsstring stringwithformat:@"%@", nametextfield.text]; pffile *imagefile = [pffile filewithname:filename data:imagedata]; [profile setobject:imagefile forkey:@"profil...

mysql - Copy all records between tables with the exception of a line -

this question has answer here: insert … select without detailing columns 9 answers i have syntax can copy records tables have same fields: insert table2 select * table1 id = '7' so know how keep copying values ​​except 'id' field (because him primary key , auto increment). you list columns: insert table2(col1, . . . coln) select col1, . . ., coln table1 id = '7'; under circumstances, should list columns explicitly. can run problems when tables have same columns in different order. (the 1 exception in code write in script table1 created table2 using create table as .)

sql - ORA-00979 not a group by expression -

i getting ora-00979 following query: select cr.review_sk, cr.cs_sk, cr.full_name, tolist(to_char(cf.fact_date, 'mm/dd/yyyy')) "appt", cs.cs_id, cr.tracking_number review cr, cs, fact cf cr.cs_sk = cs.cs_sk , upper(cs.cs_id) '%' || upper(i_cs_id) || '%' , row_delete_date_time null , cr.review_sk = cf.review_wk (+) , cr.fact_type_code (+) = 183050 group cr.review_sk, cr.cs_sk, cf.fact_date, cr.tracking_number order cs.cs_id, cr.full_name; i couldn't find examples had both group , order clauses in same query. tried removing each field group 1 @ time, still getting same error. you must put columns of select in group by or use functions on them compress results single value (like min , max or sum ). a simple example understand why happens: imagine have database this: foo bar 0 0 b and run select * table group foo . means database must return single row result first column 0 fulfill group by there 2 values of bar chose f...

Import localhost.sql backup phpMyAdmin -

Image
i'm using mamp (osx) test website local. because switched new macbook took backup database phpmyadmin. i did going phpmyadmin , click on export tab , selected databases , saved file localhost.sql (8,9mb). now when try import file (going phpmyadmin, selecting import tab , browsing localhost.sql file) show me error: 1046 - no database selected how can import of databases again phpmyadmin? if select "custom" export options radio buttons, down "object creation options" area, check box add create database / use statement . should add proper statements export. perhaps should default when exporting multiple databases, @ least enable move data around.

ruby on rails - Convert conditional opening html elements into haml -

i want convert following erb haml. <% if content_for?(:sidebar) %> <div id="right-column" class="col-lg-2"> <ul class="nav nav-pills nav-stacked content-bottom-padding"> <%= yield :sidebar %> </ul> </div> <div id="left-column" class="col-lg-10 content-bottom-padding"> <% else %> <div class="col-lg-12 content-bottom-padding"> <% end %> loads of code </div> ofcourse can start converting it: - if content_for?(:sidebar) #right-column.col-lg-2 %ul.nav.nav-pills.nav-stacked.content-bottom-padding= yield :sidebar #left-column.col-lg-10.content-bottom-padding - else .col-lg-12.content-bottom-padding but large block of code not evaluated inside div. how solve dry? partial tag output 1 of times haml less useful erb. here’s 1 possibility, sets id left-column if it’s sidebar content: -if content_for? :side...

android - AndEngine: java.lang.NullPointerException in onCreateResources() -

i got error when creating background in game. if use same code in project, works great. can't understand. here code: public class play extends simplebasegameactivity { bitmaptextureatlas bg_bta; textureregion bg_tr; @override public engineoptions oncreateengineoptions() { this.mcamera = new camera(0, 0, config.screenwidth, config.screenhieght); engineoptions option = new engineoptions(true, config.screenorientation_default, new ratioresolutionpolicy( config.screenwidth, config.screenhieght), this.mcamera); option.getaudiooptions().setneedsmusic(true); option.getaudiooptions().setneedssound(true); return option; } @override protected void oncreateresources() { // todo auto-generated method stub this.bg_bta = new bitmaptextureatlas(mengine.gettexturemanager(),1024, 1024, textureoptions.bilinear_premultiplyalpha); this.bg_tr = bitmaptextureatlastextureregionfactory.createfromasset(this.bg_bta, this.getassets(), ...

jsf - IF statement does not work inside Primefaces DataTable -

i want show row if have data it. code have is: <p:datatable id="comments" var="comment" value="#{agencybean.getcommentbyagency(agencybean.tagency)}" paginator="true" > <p:column> #{comment.author.name} </p:column> <p:column> <c:if test="${not empty comment.positivecomment}"> <p:row> <p:column> <p:graphicimage library="images" name="positive.png" /> </p:column> <p:column> #{comment.positivecomment} </p:column> </p:row> <br /> </c:if> </p:column> </p:datatable> but nevertheless have data, row not shown. how can implement logic? thanks! try place condition expression in <p:row> ...

javascript - Youtube Iframe Api not loading video -

i have page has empty div @ first , when clicking on button, open youtube video. html : <script src="public/js/yt-player.js" async="true"></script> <div class="bgcover">&nbsp;</div> <div class="overlaybox"> <div class="overlaycontent"> <div class="player"></div> </div> </div> js (in external file) : $(document).ready(function() { var isopen = false; // 2. code loads iframe player api code asynchronously. var tag = document.createelement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstscripttag = document.getelementsbytagname('script')[0]; firstscripttag.parentnode.insertbefore(tag, firstscripttag); // 3. function creates <iframe> (and youtube player) // after api code downloads. var player; window.onyoutubeiframeapiready = function() { player = new yt....

c# - WPF Databinding to combobox -

i'm having issues databinding combobox. other bindings work fine. tell me i'm doing wrong here. class bank { public string bankcode{get; set;} public string bankname { get; set; } public observablecollection <bankbranch> branches; } class bankbranch { public string branchcode { get; set; } public string branchname { get; set; } } bank b = new bank{ bankcode="1", bankname="bank1", branches = new observablecollection<bankbranch>(){ new bankbranch(){branchcode="11", branchname="location1"}, new bankbranch(){branchcode="11", branchname="location12"} }, }; bankpanel.datacontext = b; <stackpanel x:name="bankpanel"> <stackpanel orientation="horizontal"> ...

javascript - Facebook - what is the current access token? -

after logging in {scope:'publish_actions,manage_pages'} , request list of pages using graph api fb.api('/me/accounts', function(response) { ..... ..... gives me list of pages , page tokens } now question access token or page token future "/me" translated to? for example, refer 1) fb.api("/me",............) me refer user id or of page id's retrieved above? 2) fb.api("/platform",........) again page api read here? (i confused because don't see page-id being passed explicitly api function. fb.api( "/me",... .........) me refer user id or of page id's retrieved above? that depends of course on access token used make request – if it’s user access token, refer user, , if it’s page access token, refer page. (and if it’s app access token, result in error.) fb.api( "/platform", ........) again page api read here ? the 1 has username platform set of course. ( confus...

r - How to find the optimal number of clusters? -

i know question has been asked, failing implement decent plot following code: options(digits=1) set.seed(2014) mydata <- matrix(seq(1,360),nrow=10,ncol=36) wss <- c() (i in 1:19) wss[i] <- sum(kmeans(x=mydata,centers=seq(1,360,length.out=20)[i])$withinss) plot(1:9, wss, type="b", xlab="number of clusters", ylab="within groups sum of squares") it produces following error error in sample.int(m, k) : cannot take sample larger population when 'replace = false' kmeans assumes each row data observation. if have k rows in x , results of $clusters of lenth k . here test data has 10 rows. yet specifying centers=20 when i=2 there no way 10 observations can have 20 different clusters.

installation - InstallShield - using XCopyFile to copy folder from network to local directory -

i have question installshield. i'm trying copy files network folder local directory. created basic msi project , created script forks if source , target directory both on local maschine, if source network location, doe's not work. can me please. set custom action runs script runs after installfinalize. here code script , first sdir local, , second sdir network address // za program 2 #define sdir "c:\\isexampl\\source\\" //#define sdir "\\ch\bla\\" #define tdir "c:\\isexampl\\target\\" // include ifx.h built-in installscript function prototypes. #include "ifx.h" export prototype exfn_xcopyfile(hwnd); function exfn_xcopyfile(hmsi) string szsrcfile; number nresult; begin szsrcfile = "*.*"; if (xcopyfile (sdir ^ szsrcfile, tdir ^ "*.*", include_subdir) < 0) messagebox ("xcopyfile failed", severe); else messagebox ("sucess...

javascript - D3JS — my X axis grid line isn't showing up -

i'm @ loss why x axis lines showing fine, not y. ideas? i'm 99% sure has .attr("transform", "translate(0," + height + ")") line since every time adjust show x axis pieces, in wrong space. entire code follows: <html> <head> <style> /* set css */ body { font: 12px arial;} path { stroke: steelblue; stroke-width: 2; fill: none; } .axis path, .axis line { fill: none; stroke: grey; stroke-width: 1; shape-rendering: crispedges; } .grid .tick { stroke: lightgrey; opacity: 0.7; } .grid path { stroke: lightgrey; stroke-width: 0; } </style> </head> <body> <!-- load d3.js library --> <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> <h1>temperature chart on time</h1> <script> // set dimensions of canvas / graph var margin = {top: 30, right: 20, b...

postgresql - Race Condition with Authlogic and Rails 4.1.1 -

i upgrading app rails 4.1.1 , authlogic 3.4.2 , encountered problem race condition in integration test. i have page issues 2 ajax requests upon loading. both requests cause authlogic try update logged in user record's last_request_at column. not same exception, raised when app tries update same user record back. this not issue on rails 3 because used rack::lock in test environment. here snippet of logs: user load (0.6ms) select "users".* "users" "users"."id" = 2 limit 1 [50/1923] user load (0.8ms) select "users".* "users" "users"."id" = 2 limit 1 (1.5ms) begin (0.2ms) begin sql (0.3ms) update "users" set "last_request_at" = $1, "perishable_token" = $2, "updated_at" = $3 "users"."type" in ('medicalprofessional') , "user s"."id...

javascript - node.js monitoring for when a file is created -

i writing node.js program needs file name created in specific directory. doing repeated calls fs.readdir until see name of file, i'd rather more efficient. know of way this? look @ fs.watch (and fs.watchfile fallback) implementation, realize not perfect: http://nodejs.org/api/fs.html#fs_fs_watch_filename_options_listener caveats# the fs.watch api not 100% consistent across platforms, , unavailable in situations. availability# this feature depends on underlying operating system providing way notified of filesystem changes. on linux systems, uses inotify. on bsd systems (including os x), uses kqueue. on sunos systems (including solaris , smartos), uses event ports. on windows systems, feature depends on readdirectorychangesw. if underlying functionality not available reason, fs.watch not able function. example, watching files or directories on network file systems (nfs, smb, etc.) doesn't work reliably or @ all. you can sti...

python - Django models with same or similar fields -

i started learn django , have 1 question: kind of model creation better if tables have similar fields? 1) standart way form official tutorial like class place(models.model): name = models.charfield(max_length=50) address = models.charfield(max_length=80) class restaurant(models.model): name = models.charfield(max_length=50) address = models.charfield(max_length=80) serves_hot_dogs = models.booleanfield() serves_pizza = models.booleanfield() as see both models have same name , address fields. found in https://docs.djangoproject.com/en/1.6/topics/db/models/#multi-table-inheritance multi-table ingeritance works this: 2) class place(models.model): name = models.charfield(max_length=50) address = models.charfield(max_length=80) class restaurant(place): serves_hot_dogs = models.booleanfield() serves_pizza = models.booleanfield() as doc says: of fields of place available in restaurant, although data reside in different database table. w...

ios - Edit Programmatically plist in the App bundle at development time -

i have created plist on xcode have few values can't insert manually. want add values programmatically @ development time. seems can read plist can not save plist on app bundle, makes sense @ runtime.. when distribute app want have plist file that's why not saving on documents or cache. how can achieve want? from http://www.karelia.com/cocoa_legacy/foundation_categories/nsfilemanager__get_.m (pasted below) can build path within user's personal library -(nsstring *) pathfromuserlibrarypath:(nsstring *)insubpath method found there. for example, nsstring *editedplist = [self pathfromuserlibrarypath:@"my.plist"]; gets name of modified plist within user's library (even if plist doesn't exist yet). how read/write according kind of plist have, read dictionary with: nsmutabledictionary *theplist= [[nsmutabledictionary alloc] initwithcontentsoffile:editedplist ]; if unable read, detected by, example [theplist count] == 0 , instead call same i...

r - gvisAnnotationChart and zoomStartTime / zoomEndTime -

i'm having trouble zoomstarttime , zoomendtime parameters of gvisannotationchart googlevis package. specifically, running example three: a3 <- gvisannotationchart(stock, datevar="date", numvar="value", idvar="device", titlevar="title", annotationvar="annotation", options=list( width=600, height=350, zoomstarttime=as.date("2008-01-04"), zoomendtime=as.date("2008-01-05")) ) plot(a3) produces plot "undefined not function" in y scroll area. the documentation states "zoom time window, no y-axis ticks" has no other information. have seen several examples on jsfiddle of working, configuring google annotated timeline , can't translate r. appreciated.

c# - How can I convert Dataset column value to an integer -

public dataset ds = new dataset(); public sqldataadapter adapter = new sqldataadapter(); public int authenticateduserage(string user_name) { string sql = "select username, age tbldataprog (username ='" + user_name + "')"; ds = getdataset(sql); int = int.parse(ds.tables[0].rows[0]["age"].tostring()); return help; } public dataset getdataset(string sql) { sqlconnection connection = new sqlconnection(connstr()); sqlcommand cmd = new sqlcommand(); cmd.commandtext = sql; cmd.connection = connection; adapter = new sqldataadapter(cmd); connection.open(); adapter.fill(ds); connection.close(); return ds; } public string connstr() { return @"data source=.\sqlexpress;attachdbfilename='g:\עבודת גמר תכנות\v5\חדש תיקיה 1\v4\app_data\sitedb.mdf';integrated security=true;user instance=true"; } i need check value returned authenticateduserage number less 17 write hello te...

compare - comparing two columns in excel (VLOOKUP not working) -

i have been breaking head problem since morning , haven't found solution. please give valuable pointers if possible, can try find solution. i have 2 sets of data- old list , new list. wish compare new list( comparing name , country together) old list, since new list has few additional entries. later on, create new list common entries both old , new list , add new entries below common ones ( if possible, else manually later on excel tell me new entry). sorry, if has not been explained, maybe following illustration helps old list item no. name country 1 apples italy 3 banana spain 4 grapes slovakia 5 pineapple greece 8 banana czech republic 14 apples india 23 pineapple hungary 19 peach usa 2 strawberries france new list item no. name country 4 grapes slovakia mango pakistan 14 apples india oranges mexico ...

unix - Change permissions using chattr -

how can change permissions of directory using chattr? suppose, want change permissions of directory /path/to/dir 700 using chattr. possible? if yes please tell how. you should use chmod instead of chattr : latter has differerent purpose.

swing - How to deal with events in Java MVC -

i'm creating first "bigger" application in java. mvc pattern know, decided use it. there's wrong concept. for example. need action (or event) fired 2 places (from button in frame , menuitem ). has changes in @ least 2 places , in model. i've got ideas, seem wrong: pass controller object every view element, newly created actions use controller's methods modify rest of application. make controller static (for same reasons) make controller model listener please tell me how build it. or give me links easy analyse applications. source of project here, if wants have look: https://github.com/arrvi/colorextractor you correct use action encapsulate functionality use disparate components such menus , buttons. spectrum of examples cited here . regards mvc , recall swing uses separable model architecture , examined here . in effect, user controller, , not every interaction needs pass through application's controller.

Incorporate jquery into WordPress -

i trying incorporate simple audio player wordpress uses jquery control player , player control background image. there several instances of player on single page. i have no problem writing code html page, doesn't work inside wordpress page. i've been googling couple hours, haven't found specific, understandable answer need, apologize if has been covered elsewhere. i don't want write plugin, want able create little control on html5 audio player. the script code: $(document).ready(function(){ var allaudioels = $('audio'); function pauseallaudio(){ $('.gac_play').attr('src', 'play16.png'); allaudioels.each(function() { var = $(this).get(0); a.pause(); }); } $(".gac_play").click(function(){ var song = $(this).next('audio').get(0); if(song.paused){ pauseallaudio(); $(this).attr('src', 'pause16.png'); song.play(); }else{ ...

java - Can't access managed bean again... jsf -

i'm not sure doing wrong. had same problem project of mine not access managed beans. here facelet client: <?xml version='1.0' encoding='utf-8' ?> <!doctype composition public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ui:composition xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://xmlns.jcp.org/jsf/passthrough" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns="http://www.w3.org/1999/xhtml" template="./template.xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"> <ui:define name="left"> <h:form> <h:inputtextarea value="#{blogmanager.blogentity.text}" p:placeholder="tweet max 30 chars." style="width: 100%; height:150p...

arrays - How do I create a vector of objects in R? -

this question has answer here: returning separate txt files loop in r 2 answers i need calculate de implied volatility financial options using quantlib package r. i'm having trouble using iterations function "europeanoptionimpliedvolatility" because output object (called impliedvolatility). largo = nrow(call26) #number of rows in data set impl_vol= vector("list",largo) for(i in largo){ impl_vol[[i]] = europeanoptionimpliedvolatility(type="call", value=valor_opcion[i], underlying=st[i], strike=strike[i], dividendyield=dividendo[i], riskfreerate=rf[i], maturity=maturity[i], volatility=0.4) } the result of is: list(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, nu...