Posts

Showing posts from March, 2015

ruby on rails - Check if attribute contains 2 letters in RSpec -

what right way test if field contains 2 letter string rspec ? following old example guess worked in rails 2. creates new address instance, sets invalid value on it, , trigger valid? on instance , checks if errors report wrong. 'requires state of length 2' subject = address.new subject.state = 'cal' should_not be_valid subject.errors.on(:state).should_not be_nil end now, rails 3 doesn't have errors.on, tried subject.errors[:state].should_not be_nil but problem here errors[:attribute] empty array instead of nil . you can still subject.errors[:state].should_not be_empty

android - Not able to solve import on com.google.appengine.tools.cloudstorage.GcsFilename Eclipse -

i trying serve blob , take objects gcs , serve . in servlet need import: import com.google.appengine.tools.cloudstorage.gcsfileoptions; import com.google.appengine.tools.cloudstorage.gcsfilename i have downloaded cloud storage api link: https://code.google.com/p/google-api-java-client/wiki/apis#cloud_storage_api but somehow not able compile servlet. missing here!!..can please tell me steps on how add library in web application in eclipse? code need compile: private gcsfilename getfilename(httpservletrequest req) { string[] splits = req.getrequesturi().split("/", 4); if (!splits[0].equals("") || !splits[1].equals("gcs")) { throw new illegalargumentexception("the url not formed expected. " + "expecting /gcs/<bucket>/<object>"); } return new gcsfilename(splits[2], splits[3]); } the import not

asp.net - how to map a checkbox to update the database after submit. -

i need use session datatable email value @email , base dropdownlist. protected void page_load(object sender, eventargs e) { dropdownlist1.datasource = (datatable)session["dt"]; dropdownlist1.datavaluefield = "base"; dropdownlist1.datatextfield = "base"; dropdownlist1.databind(); } string str; protected void submit_click(object sender, eventargs e) { if (checkbox9.checked == true) { str = str + checkbox9.text + "x"; } } sqlconnection con = new sqlconnection(...); string sql = "update inquiry2 set question1 = @str email = @email , base = @base;"; con.open(); sqlcommand cmd = new sqlcommand(sql, con); cmd.parameters.addwithvalue("@email", session.dt.email); cmd.parameters.addwithvalue("@str", str); cmd.parameters.addwithvalue("@base", dropdownlist1.base); } }

grails - I want to provide a link to return the previous page on a 404 -

i have errorcontroller handles various application errors such 404, 500, etc. in these actions, render appropriate error pages. able provide link on these error pages takes user page prior receiving error. i've tried getting http_referer header null. request.forwarduri gives me current request causing error. suggestions? class errorcontroller { def notfound() { def backtopage = getpreviouspage // here render view: '404', mode: [backtopage: backtopage] } } you can use history.back() method . <script> function goback() { window.history.back() } </script> <input type="button" value="back" onclick="goback()">

actionscript 3 - Flash complied with Flex SDK very big file size -

i had simple flash video player compiling using adobe flash builder , compiling using flex sdk 4.6 . flash filesize 20kb when compling fb . 280kb . know adds swc files swf build , have disabled debug etc instructions provided here http://livedocs.adobe.com/flex/3/html/help.html?content=performance_06.html . possible somehow convert fla components without using mxml ? here mxml code <?xml version="1.0" encoding="utf-8"?> <mx:application backgroundcolor="#000000" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" minwidth="320" minheight="240" creationcomplete="initapp()"> <fx:script> public function initapp():void{ var p = new video_player(uic); } </fx:script> <mx:uicomponent id="uic" /> </mx:applicatio

javascript - Style new Chrome's alert window -

Image
is possible style new chrome alert boxes, added in version 29? run javascript in chrome's console: alert("this new") i ask because new window looks more dialog. it displays tooltip coordinates while being dragged. no, cannot style dialog boxes (including newly designed one). use js/html modal if need style popup instead.

mongodb - Directory For C# Library Download -

i trying set mongodb c# plugin on computer. use visual studio 2010 code. should extracted zip file moved to? in folder use development or specific file path type of library? use nuget package manager download mongodb c# driver. placed under packages folder @ solution root directory. how use nuget: either manage nuget packages... option in context menu of project references search driver online. or type install-package mongocsharpdriver in package manager console (located under tools > library package manager ). download latest stable version of driver solution , add assembly reference project.

c++ - Read from a file different types of variables (1 per line) -

i have app written in c++ gets parameters extern txt file. file has 1 variable per line , they're different kinds like: 0 0.8 c:\documents\textfile.txt 9 i tried (not don't have code now) file* f; char line[300]; f = fopen("parameters.txt", "r"); scanf(line, val1); scanf(line, val2); scanf(line, val3); fclose(f); but doesn't work, tried fgets , fgetc changes , didn't work. or idea? variables same number , have same types in each place (so think don't need while or loop). thank in newbie problem driving me crazy. edit: exact code saw @ solution here sscanf(line, "%99[^\n]", tp); sscanf(line, "%99[^\n]", mcl); sscanf(line, "%99[^\n]", pmt); sscanf(line, "%99[^\n]", amx); it didn't work, compiled program crashed changed scanf , didn't crashed variables empty. since you're using c++ (not c) suggest use standard iostreams library instead

How to handle transactions with Spring Data JPA? -

Image
i start creating new application , wanted feedback on approach plan on using. using spring , spring data jpa. can controllers call domain services , repositories or should controller make calls application , infrastructure services? if "ok" call domain services , repositories controller , domain service operation needs transaction, can/should put @transactional annotation on domain service method? or should have application service wraps call (not sure approach because end bunch of pass through methods)? if not "ok" call domain services , repositories controller need create application services wrap possible domain service calls(like said in 2 lot of pass through methods)? the best solution can come following: repositories have @transactional annotation propagation required when writing database , propagation set readonly=true , propagation set supports when reading database. application , domain services add @transactional annotation needed if co

neo4j - iterate all nodes in a path and comparing the property in adjacent nodes to output only the ones that match a certain conditions -

let's assume have path a(wt=80)->b(wt=100)->c(wt=110)->d(wt=160)->e(wt=170) want find out nodes in path has difference of wt>=20. in case should give me b , d. you can first start node , end node of each relationship, , use "where" return end nodes of relationships end nodes satisfy difference condition, this, match p = a-[:rel*]->e a.name?='a' endnode(last(relationships(p))) second, startnode(last(relationships(p))) first second.wt - first.wt >= 20 return second

android - SQLite Query Confusion, Less than Greater than -

i give function day , hour , want fetch column_day1=day , hour in between 2 text-not-null columns column_from1 , column_to1. weird thing if give hour 7, , from1 , to1 contain 6 , 9 respectively, return positive search. if give hour 12 , from1 , to1 containt 11 , 17 respectively search works. but, when give 7 , from1 , to1 contain 6 , 10 respectively search doesn't work. think it's related 10 being 2 digit , 6 being 1 digit or along lines. below cursor query use please help, , doing wrong? cursor cursor = database.query(mysqlitehelper.table_comments, allcolumns, mysqlitehelper.column_day1 +" ='" + day+ "' , " +mysqlitehelper.column_from1 + " <=" + hour+ " , " +mysqlitehelper.column_to1+ " >" +hour , null, null, null, null); edit: should return true when column_from1 contains 6 , column_to1 contains 10. function writes

sql - has_many join display issue -

newbie rails question... know there's better way this. need understanding why isn't working thought should. i'm doing simple join tables using "has_many" relationship pre-existing database. need keep "non-rails" friendly titles. here's output <%= room.levels %> seen in browser: [#<level name: "01 - first floor">] i'd see 01 - first floor without of other information. i have 2 tables. :rooms , :levels here's schema 2 tables: create_table "levels", :primary_key => "id", :force => true |t| t.integer "typeid" t.integer "designoption" t.string "name" t.float "elevation" create_table "rooms", :primary_key => "id", :force => true |t| t.integer "designoption" t.integer "phaseid" t.string "comments" t.float "volume" t.float "perimeter" t.integer "level" t.str

Sharing files between android apps? -

can suggest how can share file between n number of android applications? suggest me links, code etc? in advance !! look @ android.support.v4.content.fileprovider. component can share file 1 app other apps in system means of content uri , allows hosting app use uri (not file) permissions control file. means hosting app can set temporary access permissions instead of permanently changing file's permissions. there's no performance penalty, every time app needs file can content uri , temporary permissions. secure. fileprovider subclass of contentprovider, , works in same way. the current reference doc bit vague. i'll try summarize: hosting app needs declare provider in manifest: <provider android:name="android.support.v4.content.fileprovider" android:authorities=authority android:exported="false" android:granturipermissions="true"> <meta-data> android:name="android.support.file_prov

jquery - jqGrid autocomplete, select value and copy a value to another cell -

Image
i'm working on project visual studio 2010 asp.net mvc4 , jqgrid. when deploying autocomplete , user selects value need copy value cell can solve problem? attached image , code. this code, autocomplete works, how can copy value cell autocomplete? jquery(document).ready(function () { var lastselection; jquery("#tbfacturacompra").jqgrid({ url: '@url.action("datosfacturacompra", "rafacturacompra", new { area = "operacion" })', editurl: '@url.action("datosfacturacompraabm", "rafacturacompra", new { area = "operacion" })', datatype: 'json', mtype: 'post', postdata: { idorden: idorden, partipoorden: partipoorden }, colnames: ['del', 'nit', 'factura', 'autorizacion', '', 'cod. control', 'fecha', 'importe', 'estado', '', ''], colmode

asp.net - Content Controls Have to Be Top Level -

im making website sends information mysql server, using asp.net. code. problem im having when debug code , launch page, error: [httpexception (0x80004005): content controls have top-level controls in content page or nested master page references master page.] system.web.ui.masterpage.createmaster(templatecontrol owner, httpcontext context, virtualpath masterpagefile, idictionary contenttemplatecollection) +9633920 system.web.ui.page.get_master() +54 system.web.ui.page.applymasterpage() +14 system.web.ui.page.performpreinit() +45 system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +335 im not sure why, have error. have tried making new webpage , else. here code: default.aspx <%@ page title="home page" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codefile="default.aspx.cs"

Haskell main function doesn't print anything after it is run -

i have simple module this: module main import semantic main = let result = linearize [] print result after click on .hs file, says modules loaded , can't see final result. there don't know? how running code? normally, you'd use runhaskell compile , run, or can in 2 steps ghc --make . since it's saying modules loaded successfully, i'm guessing it's getting opened in ghci , interactive haskell shell, used testing , experimentation. try running file runhaskell .

google drive import xml log in -

i try import data secure site sigh spreadsheet in google drive. i can retrieve information title or menus, private content returns #n/a value. i have chunk of html, , need issues: <div class="gh-box-section"> <ul class="gh-ul-aa"> <li> <div class="gh-group"> <em>bug:</em> 37 </div> </li> <li class="gh-summary"> <div class="gh-group"> <em>total issues:</em> 37 </div> </li> </ul> i guess can not sensitive information permission or login, try retrieve information opening session in 1 chrome tab , make import in tab, did not work. so, question: there way start session site google drive , import sensitive data html code?

java - Why this alertView does not generate and causes the application to crash? -

i want know wrong code, or missing in code. here scenario: i have listview , customadapter data derived baseadapter. i've made custom view each item. in custom view ( aka cell ) have applied longclicklistener. on pressing cell long time, method of long click gets called successfully. no problems till here. but moment add code generating alertdialog in method, alterdialog never generate , crash whole application. i tried creating method outside in class holds alertdialog generation. call outside method longclicklistener's interface method. still same crash. then tried creating whole alertdialog via runnable , started runnable after 1 second via handler, still alertdialog never generates , causes application crash. following code till now: void called() { handler h = new handler(); runnable r = new runnable(){ @override public void run() { log.d("mx", "about run!");

sql server 2005 - TSQL remove decimal under certain condition -

i have problem database in user has inputted decimal comma go on frequent basis. work on correcting issue going forward need fix 100 plus records entered. mix of correct location , incorrect locations small example: 153.30 129.30 152.709 153.308 108.777 21.369 i want preserve entries decimal indicating cents, , remove decimal should have been comma such. 153.30 129.30 152709 153308 108777 21369 i think you're going have real hard time here, , may quickest spot check 100 rows , fix them manually. here's why: declare @x table(m money); insert @x select 153.30 union select 153.300; select m @x; results: m ------ 153.30 153.30 sql server present identical. couldn't figure out way convert string (or binary, or other type), either implicitly or explicitly, tell 2 values apart once arrived in table. now, may able narrow down, three-digit decimals don't end in zero: declare @x table(m money); insert @x select 153.30 union select 153.300

jquery - Closing <iframe> pages using javascript -

i newbie javascript. have 9 .php pages showing in single php page using <iframe></iframe> this: <iframe id="alertmaintenance" style="border-style: none; border-color: inherit; border-width: 0px; width:55%; margin-left:10px;" src="total_dashboard.php" align="left"></iframe> <iframe id="delayreason" style="border-style: none; border-color: inherit; border-width: 0px; width:47%; height:250px; margin-left:10px;" src="customer_orders.php" align="left"></iframe> <iframe id="delayreason" style="border-style: none; border-color: inherit; border-width: 0px; width:50%; height:250px; margin-right:10px;" src="unpaid_invoice.php" align="right"></iframe> <iframe id="alertmaintenance" style="border-style: none; border-color: inherit; border-width: 0px; width:47%; height:250px; margin-left:10px;" src=&

jboss7.x - JBoss Managed Domain "Virtual Directory" or Subcontext -

we migrating web application weblogic cluster jboss cluster , i'm running issue configuring virtual directory serve out generated documents. on weblogic, used virtual directories set url location users download pdfs generated application. jboss not have concept of virtual directories, they offer workarounds . i've been able work on standalone server, can't find way of doing in managed domain configuration. specifically, don't think can create symbolic link in deployment directory, deployments in domain cluster are stored in binary format . in tomcat, can done creating subcontext (see item #2) in configuration directory. is there way "virtual directory" or "subcontext" jboss configured way? details: jboss version 6.1 eap (as7) os linux three servers used, 1 domain controller , 2 "regular" servers servers configured managed domain after lots of research, looks jboss removed in as7. see this question discussion.

javascript - Is there a way to load a json file along with all the other js files? -

this question has answer here: html/javascript: how access json data loaded in script tag src set 5 answers i"m wondering if there's way load json file without having use ajax jquery. have json file in folder, seem bit wasteful load file after else loaded ajax. folders this: css/ font/ html/ img/ config.json so have data available js available instead of having use jquery or method fetch later. in advance. (without declaring variable no var foo = {...} ) add variable assignment json file , use standard js script tag.

c# - Hide Panel on Child MasterPage Inside MasterPage ContentPlaceHolder using Child Content Page -

i've tried find solution everywhere, unable make work. i have following code. masterpage.master: <%@ master language="c#" autoeventwireup="true" codefile="masterpage.master.cs" inherits="my_masterpage" %> <asp:contentplaceholder id="contentplaceholder1" runat="server"></asp:contentplaceholder> childmasterpage.master: <%@ master language="c#" masterpagefile="~/masterpage.master" autoeventwireup="true" codefile="childmasterpage.master.cs" inherits="my_childmasterpage" %> <%@ register tagprefix="uc1" tagname="filedirectoryorganizer" src="~/controls/my.ascx" %> <asp:content id="content7" contentplaceholderid="contentplaceholder1" runat="server"> <asp:panel id="sidenav" runat="server"> <aside id="sidebar"> there

html - IE8 doesn't retain my spaces between the string -

i build selectbox through javascript , append div element innerhtml text value options has 2 spaces in between string value. string comparison set selected value fails in ie8 because strips out 1 white space in between. below demo html , script describes issue <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script> function buildselect() { $('#mydiv').html('<select id="listoption1" name="listoption1"><option value="1234">30.0 x 80.0 in</option><option value="12345">32.0 x 80.0 in</option><option value="123">36 x 80 in</option></select>'); } </script> </head> <body onload="buildselect()&qu

ruby - Where can i find towitoko library? -

i tried install gem ctapi: gem install ctapi fetching: ctapi-0.2.3.gem (100%) temporarily enhancing path include devkit... building native extensions. take while... error: error installing ctapi: error: failed build gem native extension. c:/railsinstaller/ruby1.9.3/bin/ruby.exe extconf.rb using default library towitoko! checking main() in -ltowitoko... no on site of gem says: you need install driver library, supports ctapi interface extension link against. newest version of towitoko library, required drive towitoko chipdrive micro, extern, extern ii, intern, twin, , "kartenzwerg", can download @ url: http://www.geocities.com/cprados the problem url not avaible! know antoher place can find libaries? debian seems have mirror of source code here: http://packages.debian.org/en/sid/libtowitoko-dev direct link towitoko_2.0.7.orig.tar.gz : http://ftp.de.debian.org/debian/pool/main/t/towitoko/towitoko_2.0.7.orig.tar.gz

asp.net mvc - Backbone save, model data not recieved on the server -

i'm using backbone asp.net mvc. want save model server. folder model folder = backbone.relationalmodel.extend({ url: "/savefolder", relations: [ { type: backbone.hasmany, key: 'files', /*key should match json name*/ relatedmodel: 'filemodel', collectiontype: 'filecollection', } ], idattribute: "folderid" }); folder saving code in view var newfolder = new folder(); newfolder.set("foldername", newfoldername); newfolder.set("editablebyothers", "n"); newfolder.save({ success: function(model, response, options) { alert("success"); //not reached }, error: function (model, xhr, options) { alert("error"); //not reached } }); note: success , error alerts never fire. when check in fiddler, json being sent - {"files":[],"foldern

image - Alt Tags not working on my site -

i trying figure out why alt image tags not working on site www.slickcar.com. have reviewed alt= tag , looks correct when @ in ie, chrome or firefox not display when hover on images. the alt attribute not meant tooltip. serves text alternative image, e.g. screen reader or text browser users, search engines etc. value of alt attribute should describe content (= image), can understand meaning/purpose of image without seeing it. the value of title attribute typically shown tooltip. should give additional (and not alternative) information.

clojurescript - Calling a ".done" JS callback -

i'm having trouble wrapping js library because can't .done callback work correctly. in javascript code this: db.values("inventory").done(function(item) { console.log(item); }); so tried couple (very dirty) clojurescript methods translate this: (defn log [] (console/log "working?")) (defn stock [] (#(.done % log) (.values db "inventory"))) and (defn stock [] (js* "db.values('inventory').done(function(item) { console.log(item); })")) but neither of these worked. error message like: db.values(...).done not function are there protocol extensions (or else) used here cover js callback? otherwise, can goog.async.deferred somehow intercept callback again? maybe helps you! i've done node must work browser little details first demo code i've prepared mock js lib simulate yours (my_api.js) this my_api.js console.log("my_api.js"); var db={}; db.item=""; db.values=f

linux - In Sublime Text 3, can I send a selection of a do file to Stata? -

this question led me try sublime text 3 replacement stata's file editor on linux (full instructions here ). syntax highlighting works , ctrl+b shortcut sends whole file stata. is there way send selection of lines stata? yes can. first need find name of python function it. sublimestata enhanced package , corresponds function text_2_statacommand in file text_2_stata.py. second, need add shortcut function in key binding user file, put function name in command field (the suffix command must removed , separations indicated underscores instead of capital letters). { "keys": ["super+shift+b"], "command":"text_2_stata", "context": [ {"key": "selector", "operator": "equal", "operand": "source.stata"},] },

sql server 2008 - pyodbc - what username/password is passed here? -

i have following code: import pyodbc cnxn = pyodbc.connect("driver={sql server};" +"server=somesqlserver2008.example.com;" +"database=exampledatabase;") cursor = cnxn.cursor() #do stuff... the above code runs fine. have reason believe, though, code passing form of credentials 'behind back' (so speak). example, code: cnxn = pyodbc.connect("driver={sql server};" +"server=someothersqlserver2008.example.com;" +"database=exampledatabase;") cursor = cnxn.cursor() returns: traceback (most recent call last): file "c:\users\<my username>\documents\sql_connect_test1.py", line 27, in <module> +"server=someothersqlserver2008.example.com;") error: ('28000', "[28000] [microsoft][odbc sql server driver][sql server]login failed user '<user name appears here>'. (18456) (

cocoa - NSView with layer is drawn over all content -

i have nsview, change properties give make rounded rectangle, gray color, , add view (behind everything) float gray = 60.0f/255.0f; nsview* background = [[nsview alloc] initwithframe: self.iconcontainer.frame]; calayer *viewlayer = [calayer layer]; [viewlayer setbackgroundcolor:cgcolorcreategenericrgb(gray, gray,gray, 1)]; //rgb plus alpha channel [viewlayer setcornerradius:5.0f]; [background setwantslayer:yes]; // view's backing store using core animation layer [background setlayer:viewlayer]; // place view behind other views [self.iconcontainer addsubview:background positioned:nswindowbelow relativeto:nil]; however no matter try, particular view drawn above else. usually, behaviour caused use of core animation layers on subview, while superview hasn't any. enabling core animation layers on superview should fix issue, subviews drawn using cora animation layers, making drawing process respect order of subviews.

db4o - how do I get a distinct list of classes contained in a .db4o DB file? -

say open .db4o file. java code (psuedo) generate list of unique java classes/types contained in database? i sure write code it, afraid quite slow. there way without querying every object in database? use sort of index? i'd rather not rely on stored metadata database, i'd rather rely on true information objects stored within. you can use (c# can converted java :) const string databasefilename = "c:\\temp\\learning.odb"; static void main(string[] args) { using (var db = db4oembedded.openfile(databasefilename)) { var classes = db.ext().storedclasses(); foreach (var @class in classes) { console.writeline(); console.writeline(@class.getname()); foreach (var field in @class.getstoredfields()) { console.writeline("\t{1} {0}", field.getname(), field.getstoredtype().getname()); } } } } note have more interesting methods in extob

Django session id on android -

we have django framework setup , login in django working. need session-id on android , not sure how can this. if make http post android need session id django can use future post , requests user. to achieve need maintain session. , maintain session there 2 posibilities 1) use single defaulthttpclient request . this approach not work if want call multiple request simultaneously. 2) sync common cookies among multiple defaulthttpclient connections. public static list<cookie> cookies; read session cookies after login. httpresponse wsresponse = httpclient.execute(httppost); try { cookies = httpclient.getcookiestore().getcookies(); sync(); } catch (exception e) { } public static defaulthttpclient gethttpclient() { httpparams httpparameters = new basichttpparams(); httpconnectionparams.setconnectiontimeout(httpparameters, timeout); httpconnectionpa

android - Keeping data in memory for the lifetime of an app -

i have data accessible number of different activities. in fact data kept in memory lifetime of app. is possible? data structure using (i populating linkedhashmap on app launch) sometimes, not always, when linkedhashmap accessed activities, returned object null. cannot reproduce myself, know it's happening @ it's logged google analytics. if use type of class... public class global { public static linkedhashmap<string, fsflight> flightsmap = new linkedhashmap<string, fsflight>(); public global() { // todo auto-generated constructor stub } } is possible? that depends upon definition of "the lifetime of app". if mean "the lifetime of process", use static data member. sometimes, not always, when linkedhashmap accessed activities, returned object null. since there no "returned object" in code, impossible assist on point.

javascript - Hover highlight child should not highlight parent -

i trying highlight element when hover on (adding class). have nested elements on page. want is, if hover on element, immediate element gets highlighted not parent ones. here snippet $("body *").hover(function (e) { $(this).addclass('test'); }, function () { $(this).removeclass('test'); });` http://jsfiddle.net/3zgqr/1/ try $(document).ready(function (){ $("body").mouseover(function (e){ $(e.target).addclass('test'); }).mouseout(function (e) { $(e.target).removeclass('test'); }); }); demo: fiddle

oracle11g - In Oracle Stored Procedure I am passing parameter as String to check the IN condition. This is not yielding results -

pincon passing ('1','2') create or replace procedure proc1 ( pincon in varchar2, p_recordset out sys_refcursor ) begin open p_recordset select col1,col2 table1 col1 in pincon; end proc1; but when select, seeing values. pls help assuming intention pass in multiple values rather single string contains single quotes, commas, etc. best option pass in actual collection. like create type num_table table of number; create or replace procedure proc1( p_in in num_table, p_recordset out sys_refcursor ) begin open p_recordset select col1, col2 table1 col1 in (select column_value table( p_in )); end; if need pass in string of comma-separated values rather collection, parse string passed in collection in stored procedure. tom kyte has canonical post on handling variable in lists walks through approach. it possible use dynamic sql. has numerous downside

osx - Can't click Menu Bar Items in Eclipse -

i opened adt (eclipse) today , had issue couldn't click item in menu bar above program. i'm running mac osx 10.9 mavericks dev preview here's screen shot: http://i.imgur.com/9s0cjde.png things i've tried. restarting program, restarting computer, reinstalling adt scratch, , tirelessly googling issue. any great. the latest mavericks preview messes java - had same issue. fix installing this: http://support.apple.com/kb/dl1572?viewlocale=en_us&locale=en_us

Refactoring a simple script to clean a mysql database in ruby -

i created following script wipe mysql database (and reset primary keys of each table). i'm wondering how should refactor it, , how pull in pluralize activesupport. code: model_dir = file.expand_path("app/models") dir.chdir(model_dir) files = dir.glob(file.join("**", "*.rb")) files.map! |file| file[0..-4] + "s" end print "this wipe database. continue? (y/n): " if $stdin.gets.chomp.downcase == "y" files.each |f| puts "wiping #{f}.." activerecord::base.connection.execute "truncate table #{f};" end else puts "terminating script..." end my logic this, every file in models directory without .rb , pluralized represented table in database, that's how got list of tables relevant application. i run command: rails runner script/cleandb.rb how should refactored, , how can pull in pluralize? based on rails conventions, should able achieve in safer way (for exam

Yii register form does not work -

i write user form register in usermodel don't set rules. the log said: 04:24:19.273058 warning application failed set unsafe attribute "username" of "user". in d:\xampp\htdocs\2013819\shop\protected\controllers\usercontroller.php (59) in d:\xampp\htdocs\2013819\shop\index.php (16) 04:24:19.273178 warning application failed set unsafe attribute "password" of "user". in d:\xampp\htdocs\2013819\shop\protected\controllers\usercontroller.php (59) in d:\xampp\htdocs\2013819\shop\index.php (16) 04:24:19.273281 warning application failed set unsafe attribute "user_email" of "user". in d:\xampp\htdocs\2013819\shop\protected\controllers\usercontroller.php (59) in d:\xampp\htdocs\2013819\shop\index.php (16) 04:24:19.273381 warning application failed set unsafe attribute "user_qq" of "user". in d:\xampp\htdocs\2013819\shop\protected\controllers\usercontroller.php (59) in d:\xampp\htdocs\2013819\shop\

version control - Git, and moving between development machines -

i have github account , have been pushing stuff there months. don't know how use git, hasn't been problem since 1 working on project. (i thought getting account start experience version control...) anyhow, work desktop go travelling need laptop working. a few months ago same thing went laptop, got connected github, , cloned repository. that's did though, since trip got cancelled. after reading around web today went laptop , did git pull origin master . seemed going ok, halted saying local changes overwritten merge, listing files. happy overwrite these changes, i'm not sure how it. basically, date have been issuing following commands desktop: git add . git commit - m 'my message here' git push origin master i able to: pull code down laptop , modify it push changes github pull changes down desktop (where return travels!) (repeat above whenever travel again...) ideally i'd able exclude files being tracked (e.g. htaccess) since depe

asp.net - how to send js library to client dynamically? -

i have string variable contains javascript codes. i want send these codes client javascript file attached! like: <script type="text/javascript" src="/lib/some.js"></script> but some.js file not exist on server! how can in asp.net mvc3? you can add string variable model ("myjavascriptcode"), output contents inside script tag on view. html.raw outputs content encoding it. <script type="text/javascript"> @html.raw(model.myjavascriptcode) </script>

Windows 8 WinJS Sqlite -

i want implement windows 8 winjs sqlite in application. best approach implement sqlite in winjs windows 8 application? how increase app performance using sqlite? take @ library it: https://github.com/doo/sqlite3-winrt

ios - How to update CorePlot Y range with animation? -

in app, there 100 x-points in scatter plot, , plot xrange length 5, mean show 5 points in 1 screen. want update yrange dynamically animation based on visible points. for example, visible points x: {1,2,3,4,5}, y: {15,25,35.45,55}, y range [cptplotrange plotrangewithlocation:cptdecimalfromfloat(15) length:cptdecimalfromfloat(5)] . after scrolling plot x values change {8,9,10,11,12} , y values {100,200,300,400,500}, hence new y range changes [cptplotrange plotrangewithlocation:cptdecimalfromfloat(100) length:cptdecimalfromfloat(5)] . want change happen animation. how add animation update plot range? here's code use vertical range animation. note need take care several points (global , local y range, axis labels). - (void)updateverticalmaingraphrange { cptxyplotspace *plotspace = (id)maingraph.defaultplotspace; cptxyaxisset *axisset = (id)maingraph.axisset; float animationduration = 0.3; if (([[nsapp currentevent] modifierflags] & nsshiftkeymask)

java - want to create tree node and print following pattern on console -

Image
b1 a1 b2 c1 a2 c2 want print pattern dynamically. tried using node represent positions left,right node<integer> root = new node<integer>(2); node<integer> n11 = new node<integer>(7); node<integer> n12 = new node<integer>(5); node<integer> n21 = new node<integer>(2); node<integer> n22 = new node<integer>(6); node<integer> n23 = new node<integer>(3); node<integer> n24 = new node<integer>(6); node<integer> n31 = new node<integer>(5); node<integer> n32 = new node<integer>(8); node<integer> n33 = new node<integer>(4); node<integer> n34 = new node<integer>(5); node<integer> n35 = new node<integer>(8); node<integer> n36 = new node<integer>(4); node<integer> n37 = new n

.net - It is possible to code this on PHP? -

Image
i coded vb.net application, security use hwid security method... vb.net code generate unique key is: dim hwid string = system.security.principal.windowsidentity.getcurrent.user.value it return unique key every pc this s-1-2324-34242fdf-sdwq3q-q3wr4cwrwce1321sxs32 currently learning & developing php scripts... i want know possible generate same unique key using php??? let's break down. system.security.principal.windowsidentity.getcurrent() is method returns current user. .user.value is calling: .user.tostring() the method actually: system.security.principal.windowsidentity.getcurrent().user.tostring() this user's security identifier (sid) . running wmic useraccount name,sid returns sids found on machine. now, mean php? since php ran on server only, doubt number change based on visitor visits. using number in php pointless, same. a better approach generating random id uniqid . check out this information on how sid deriv

javascript - Need help converting from prototype to jQuery -

i need converting below code. have software uses prototype really conflicts jquery. have used online auto scripts translate code, did nothing, tried manually don't have enough knowledge, , tried using $.noconflict had no effect, , no help. - please if can code below: var menulist = new array(); var buttonlist = new array(); var scriptlist = new array(); /* ajax post request */ function scriptdoloadpost(scripturl, scriptform, scriptpos, scriptargs, noloading) { if(!scriptargs){ var scriptargs = ''; } scriptargs = $(scriptform).serialize() + scriptargs; myajax = new ajax.updater(scriptpos, scripturl, { method : 'post', parameters : scriptargs, evalscripts : true, onloading: function(request){ showloadingicon(scriptpos, noloading); }, insertion : insertion.append }); } /* ajax request */ function scriptdoload(scripturl, scriptpos, scriptargs, noloading) { myajax = new ajax.updater(scriptpos, scripturl,