Posts

Showing posts from May, 2012

android - How can i search more than one Username by UserSearchManager in openfire using smack -

i creating chat app using smack library , openfire server xmpp protocol . first searched username usersearchmanager , got jid. working good. but have lot of username , want search username usersearchmanager. can calling 1 one hit server again , again. please suggest me how can search username @ 1 time search hit. this code using search single username. usersearchmanager search = new usersearchmanager(connection); form searchform = search.getsearchform("search." + connection.getservicename()); form answerform = searchform.createanswerform(); answerform.setanswer("search", "rahul rawat"); answerform.setanswer("username", true); reporteddata data = search.getsearchresults(answerform, "search." + connection.getservicename()); system.out.println("\nthe jids our each of our hits:"); iterator<row> rows = data.getrows();

python - Connecting to MySQL DB on RDS -

i've encountered phenomenon absolutely baffled me. far, i've been connecting without problem amazon rds instance running mysql. right now, i'm trying migrate db in free tier - running on microsoft express edition. i've set security of instance , can connect through sql explorer in visual studio 2012. however, can't access through python (mysqldb - same credentials, , same script worked first db): 2013, lost connection mysql server @ 'reading initial communication packet', system error 104 nor through mysql-front - connection failure. i can't wrap head around - missing obvious? same thing happens on 2 machines - vs can connect, while nothing else can. ideas? python connection attempt: db = mysqldb.connect(host = "yep-my-endpoint.us-west-2.rds.amazonaws.com", user="user",passwd="mypasswd", port=1433, db="yep-db-name") is there maybe setting have set in connection work?

ios - Creating a vertical spacing autolayout constraint -

i've got autolayout constraint attaches view above tab bar. specifics of aren't important, works fine. nsdictionary *views = @{@"view":self.collectionselectioncontainer, @"bottomlayoutguide":self.bottomlayoutguide}; nsdictionary *metrics = @{@"offset":@(tabbarheight)}; [self.view addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:[view]-offset-[bottomlayoutguide]" options:0 metrics:metrics views:views]]; however, want create constraint using other method: [nslayoutconstraint constraintwithitem:attribute:relatedby:toitem:attribute:multiplier:constant:] i've tried various ways unsuccessfully. can show me how? thanks i figured inspect nslayoutconstraint returned array constraintswithvisualformat! great way figure out , build method there: the answer this: self.collectionselectionbottomconstraint = [nslayoutconstraint constraintwithitem:self.bottomlayoutguide attribute:nslayoutattributetop relate

facebook graph api returns blank data -

i'm using facebook sdk api, in class return public facebook pages posts. returns blank, doesn't throw error. var client = new facebookclient(); dynamic result = client.get("oauth/access_token", new { client_id = facebook_appid, //app id client_secret = facebook_appsecret, //app secret grant_type = "client_credentials" //client_credentials }); var accesstoken = result.access_token; var facebookclient = new facebookclient(accesstoken); jsonobject pagepost = facebookclient.get("/thepagename/posts") jsonobject; string html = ""; foreach (var account in (jsonarray)pagepost["data"]) { html += (string)(((jsonobject)account)["message"]); } what missing?

neo4j - Cypher Editor does not link to Database Graph in Neoclipse -

i running neoclipse-1.9.1-win32.win32.x86_64, downloaded last week. in database graph tab,i can see root node , extend other nodes clicking "+" button. in cypher editor tab, can execute cypher query start root=node(0), l=node(100) match root-[:branch]-n-[:objcol]-m-[r]-l return root, l; and see results in "results" sub tab. when switch database graph tab, not automatically show nodes , pathes executed cypher query. what need make cypher query executed in cypher editor tab show in database graph tab? the graph tab doesn't sync query have executed cypher editor tab. can configure depth of graph through options > neo4j > maximum traversal depth

c# - Regular Expression: Search key validation -

please regular expression. working on validating string. value should not contain % , if there % length should more 3 characters including %. % can anywhere in string (dot included). i come this. validation should happen when % in string. if there no % no validation necessary. @"^[a-za-z0-9'.]*%"; //{3,}$"; thanks, naveen examples: "%" - fail "%12" - fail "%123" - pass "%1234" - pass "12%3" - pass "abc%" - pass "abc" - pass "a" - pass "abc" - pass i don't think needs regex solve, string methods ok: var valid = !input.contains("%") || input.length > 3; if want use regex , here are: ^([^%]+|.{4,})$

c# - GO statements blowing up sql execution in .NET -

i have simple c# command shell app executes sql script generated sql server scripting schema , data. it's blowing on "go" statements. error message: incorrect syntax near 'go'. here full sql script: /****** object: table [gym].[membershipstatus] script date: 9/3/2013 9:24:01 ******/ set ansi_nulls on go set quoted_identifier on go set ansi_padding on go create table [gym].[membershipstatus]( [membershipstatusid] [tinyint] identity(1,1) not null, [name] [varchar](75) not null, [description] [varchar](400) not null, [allowcheckin] [bit] not null, [includeincollections] [bit] not null, [schedulefutureinvoices] [bit] not null, constraint [membershipstatus_pk] primary key clustered ( [membershipstatusid] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go set ansi_padding off go set identity_insert [gym].[membershipsta

c++ - QFileDialog "destroys" the name of the files -

right i'm working on gui suite of console applications used bioinformatics , i'm doing first tests first project using qt. i'm using qtdesigner making gui , works except qfiledialog converts end of file name strange character, although i'm not sure if qfiledialog, or conversion qstring into const char . here code: qstring file=qfiledialog::getopenfilename(this, tr("open file"),"/home/",tr("any file (*.*)")); qstring fastqdumpdir = "/home/nsg/downloads/sratoolkit.2.1.16-centos_linux32/bin/" fastqdumpdir=fastqdumpdir+"./fastq-dump "; qstring cmdstr =fastqdumpdir + file; const char* command = cmdstr.tostdstring().c_str(); system(command); the fastq-dump program ends because says filename not correct, , after debugging, see file name goes /home/nsg/downloads/srr502947.sra /home/nsg/downloads/srr502947.sra[] , /home/nsg/downloads/srr5029[] any ideas why happening or how fix it? your problem calling qst

java - Maven finds artifact but cannot compile -

when run mvn compile list of errors compilation package missing have dependency in pom.xml. pom.xml `<dependency> <groupid>com.fortysevendeg.android</groupid> <artifactid>swipelistview</artifactid> <version>1.0-snapshot</version> <type>apklib</type> </dependency>` error error: package com.fortysevendeg.swipelistview not exist i appreciate on one. have been banging head against while now. looks mvn not able pull package ( com.fortysevendeg.swipelistview ) repository. figure out, check-out package code repository ( i.e svn, github ) work space. recheck pom.xml exact name & mvn install. link: read downloading remote repository downloading in maven triggered project declaring dependency not present in local repository (or snapshot, when remote repository contains 1 newer). by default, maven download central repository. during mvn compile first in local workspace &

objective c - monitor changes on NSManagedObject similar to NSFetchedResultsController -

i implemented class similar nsfetchedresultscontroller - call dkdataarray . unlike nsfetchedresultscontroller doesn't fetch objects database gets them relation of object. i want extend in way monitors changes in fetched objects , propagates changes delegate - nsfetchedresultscontroller does. this delegate method i'd support: @protocol dkdataarraydelegate @optional - (void)dataarray:(dkdataarray *)dataarray didchangeobject:(id)anobject atindex:(nsinteger)index; @end how can that? thanks in advance! you can register nsmanagedobjectcontextobjectsdidchangenotification of managed object context. documentation: posted when values of properties of objects contained in managed object context changed. notification posted during processpendingchanges , after changes have been processed, ... notification object managed object context. userinfo dictionary contains following keys: nsinsertedobjectskey , nsupdatedobjectskey , , nsde

c++ - Why does std::is_function evaluate to false when using on a dereferenced function pointer? -

i trying use std::is_function determine if variable function pointer. when running following code #include <iostream> #include <typeinfo> using namespace std; int main() { typedef int(*functionpointer)(); functionpointer pmain = main; cout << typeid(functionpointer).name() << " "<< is_function<functionpointer>::value << endl; cout << typeid(decltype(pmain)).name() << " " << is_function<decltype(pmain)>::value << endl; cout << typeid(decltype(main)).name() << " " << is_function<decltype(main)>::value << endl; cout << typeid(decltype(*pmain)).name() << " " << is_function<decltype(*pmain)>::value << endl; return 0; } the output is pfive 0 pfive 0 5 1 5 0 can insight explain why last expression of std::is_function evaluates false? (code tested under g++4.7, g++4.8 , cla

actionscript - Action Script 2, I want to stop the counting down to 0 -

i need action script 2.0 i have scoreboard system 2 buttons 1 count number , other count down if need to. however, problem count down button. count down button code: on(release) { score.text = 0; score.text = scorebk _root.scorebk--; if score 9 example when count down adds 1 , counts down normally, when score 0 goes -1...etc. not want that. how can stop button going minus? , counts normally. you have check value greater 0 before decrement: on(release) { if(scorebk > 0){ scorebk--; } score.text = scorebk; }

amazon web services - Simple Workflow SWF for local testing -

i looking aws (amazon web service) swf (simple workflow) service can run locally testing , development purposes. i've not seen available aware of elasticmq implements subset of aws sqs base component needed build swf clone. i've looked @ apache activemq starting point. is aware of local service used local testing , development of application using swf? have eucalyptus 3.3 instances of rest of requirements (s3, ec2, iam, etc). i'm not aware local implementation of aws swf. service business logic pretty involved creating such component nontrivial. if using aws flow framework (available in java , ruby) can test workflows using provided integration unit testing frameworks. see helloworldtest java example.

ruby on rails - Understand Test-Driven Development with Rspec and FactoryGirl -

here spec file: require 'spec_helper' describe user, "references" { should have_and_belong_to_many(:roles) } { should belong_to(:account_type) } { should belong_to(:primary_sport).class_name("sport") } { should belong_to(:school) } { should belong_to(:city) } end describe user, "factory" before(:each) @user = factorygirl.create(:user) end "is invalid no email" @user.email = nil @user.should_not be_valid end "is valid email" @user.should be_valid end end factory: factorygirl.define factory :user email faker::internet.email password "password" password_confirmation "password" agreed_to_age_requirements true end end the part trying "test" , not sure how 100% checking make sure when user created email address not nil. shoulda provides validation helpers test validations. it { should validate_presence_of(:email) } i

How can I use commercial at sign in Objective-C macro? -

how can use commercial @ sign in objective-c macro? i know not recommended, seems possible somehow? since libextobjc provides @weakify , @strongify , etc... libextobjc uses preprocessor trickery make think it's @command . #define weakify(...) \ try {} @finally {} \ metamacro_foreach_cxt(ext_weakify_,, __weak, __va_args__) note missing @ on try . @weakify expands @try {} @finally {} [injected code] . you use same trick, suggest stick plain macros.

google app engine - Search API, create documents and indexes -

i need in search api i brazilian , i'm using google translator communicate. my question is: for each item in datastore persisted create document , index? , objects persisted in datastore, go bank create document , index each, if want search search api? using java. it's reasonable use search api search objects stored in datastore. can create search document each datastore entity (so there's one-to-one correspondence between them). don't need use separate search index each one: search documents can added 1 index. or, if have huge number of documents, , if there natural partitioning between them, distribute them on modest number of indexes. assuming can know via external means (single) index choose searching, preventing them getting big can performance. i've tried answer question think you're asking. it's difficult me understand english google translator has produced. in particular, "i go bank ..." mean?

Passing items from CGridView to another view in Yii -

i have view cgridview has filtering. i'd pass items cgridview (or ids) view (of same controller) they'll processed. i've found this post exporting data, there's jquery selector, guess should pass ids action in controller. how done? you can try using bulk actions of tbextendedgridview in yiibooster http://yiibooster.clevertech.biz/extended-grid.html#extendedgridview i'm using project well.

asp.net - Set IP address of HttpWebRequest -

i have site fixed ip address, , make c# calls backend data server methods via httpwebrequest. backend system set permit incoming requests site's ip fixed address. is there way set ip address of httpwebrequest site's ip (i suspect cloud host or .net somehow permitting other ips being used)? i'm not trying spoof ip; want ensure asp.net code uses site's own dedicated ip, or @ least check see ips may using when makes requests. use httpwebrequest.servicepoint.bindipendpointdelegate property: request.servicepoint.bindipendpointdelegate = delegate { return new ipendpoint(ipaddress.parse("10.0.0.3"), 0); }; example: using system; using system.net; using system.io; class program { public static void main () { var request = (httpwebrequest)httpwebrequest.create ("http://smsc.vianett.no/ip/"); request.servicepoint.bindipendpointdelegate = delegate { return new ipendpoint(ipaddress.parse(&quo

php - ignore last row of csv file -

we use ignore 1 lines ignore 1st row of csv file. ignore clause in load data local query ignore last row of csv file? and 1 more question,what query include field @ last row given in csv file http://temp-share.com/show/dpfsmga5w right i've php-mysql code: load data local infile '$url' table buzz fields terminated ',' enclosed "" lines terminated '\n' ignore 1 lines (day,exposures,clicks,earning,ctr,cpc,cpm) try this: <?php $filename = "file.csv"; //set csv file name $lines = file($filename); $count = count($lines); $count--; //decrease 1 remove last line for($i=0; $i<$count; $i++) { echo $lines[$i]; } ?>

android - Sherlock Action Bar: Apply style for 3.0 and 2.3 -

i trying add style action bar have in code. want them identical on platforms. issue right buttons, alertdialogs, , action bar (to name few) not same 2.3 4.1. i want have same theme holo.light theme , want apply action bar style both 2.3 , 3.0. here code action bar <?xml version="1.0" encoding="utf-8"?> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="mytheme" parent="theme.sherlock.light"> <item name="android:windowtitlesize">35dip</item> <item name="actionbarstyle">@style/mytheme.actionbarstyle</item> <item name="android:actionbarstyle">@style/mytheme.actionbarstyle</item> </style> <style name="mytheme.actionbarstyle" parent="widget.sherlock.actionbar"> <item name="titletextstyle">@style/mytheme.actionbar.titletex

c# - MVC3 JQuery modal dialog retains content on close and reopen -

i have jquery modal renders partial view when data entered view, , closed (not saved, close dialog) content retained in view. so, next time modal opened, same when closed first time around. is there way of forcing modal render original partial view or make this? i've not posted partial view content it's simple form fields on. view <div id="client-detail-modal" title="add new address"> @html.partial("_address", address) </div> jquery $("#client-detail-modal").dialog({ modal: true, autoopen: false, height: 'auto', width: 600, position: ['middle', 20], buttons: { "add address": function () { $(this).dialog("close"); }, cancel: function () { $(this).dialog("close"); } } });

java - Android: Unable to instantiate activity ComponentInfo -

i'm getting following error , don't no do. cleared projects 100 times, removed jars buildpath, deleted bin , gen.....but nothing worked me. please find below error code: 09-03 19:43:17.326: e/trace(800): error opening trace file: no such file or directory (2) 09-03 19:43:17.546: d/androidruntime(800): shutting down vm 09-03 19:43:17.597: w/dalvikvm(800): threadid=1: thread exiting uncaught exception (group=0x40a71930) 09-03 19:43:17.629: e/androidruntime(800): fatal exception: main 09-03 19:43:17.629: e/androidruntime(800): java.lang.runtimeexception: unable instantiate activity componentinfo{com.example.firsttravel/com.example.firsttravel.mainactivity}: java.lang.classnotfoundexception: didn't find class "com.example.firsttravel.mainactivity" on path: /data/app/com.example.firsttravel-2.apk 09-03 19:43:17.629: e/androidruntime(800): @ android.app.activitythread.performlaunchactivity(activitythread.java:2106) 09-03 19:43:17.629: e/androidruntime(800): @

c++ - How do I set up the linking order in code blocks? -

i tried run program on opencv got following error: test_1.cpp:(.text+0x44): undefined reference `cv::imread(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)' i learnt order of sources , libraries on link line matters so, running g++ -o test_1 test_1.cpp pkg-config opencv --cflags --libs works. however, how can setup code blocks when build code, applies correct order?

Slight trouble converting tables to div's/CSS -

i'm in process of taking out tables entire site, , switching them css div's. here's link of first 1 i'm trying: http://www.torelloengineers.com/legal_investigations.html the problem content right being put below picture left, rather being right next it. i created in css file: container, row, , left, right, , middle table cells. couldn't paste here because text box wasn't allowing formatted code. <div id="row"> <div id="left"> <h4><img src="picts/torello-safety-design.jpg" width="400" height="301"></h4> </div> <div id="right"> <h4>lacking safety design - missing guardrail. plainville, ct</h4> <p>while returning parked vehicle after using atm.... </p> </div> </div> i "dived" content wanted left , right on main page wanted it, right content won't line left.

c# - Create Images from existing image and display them in a PictureBox -

i have image like image<bgr, byte> imageframe = capture.queryframe(); (actually webcam-stream shown in picturebox) and want "extract" single rectangles (the coordinates given) , want display parts in seperated picturebox @ moment have mental block. can give me hint? i assume using emgucv , haven't tested these things..but may give lead. instead of using picturebox use imagebox provided emgucv.so there won't need image conversion. if want convert image,from emgucv documentation the image class has tobitmap() function return bitmap object, can displayed on picturebox control using windows form now have bitmap,if want select particular region bitmap,then followings links you. crop image using c# how cut part of image in c#

linux - Using HDMI port as network protocol interface? -

i wondering if it's possible use 10.2 gb/s hdmi port on several computers backbone networking interface home made cluster? is there kind of hdmi switch? can hdmi transport arbitrary data? can access hdmi port in *nix device eth0 , pipe it? can hdmi port on computers receive data, or outgoing (graphics card -> display)? this cool. if doesn't exist, logistics of implementing this? theoretically, newer versions of hdmi can support "ethernet channel", functions regular network connection. however, have not been able find graphics cards feature. if graphics card supports this, may have letters hec beside hdmi port. additionally, ethernet channel limited 100 mbit/s, not fastest option available. i did find hdmi switches, made wiretek . hdmi supports auxiliary channel, used carrying control signals between devices. though slower ethernet channel.

javascript - Trying to add websites to localstorage in chrome extension options page -

i want able add websites chrome extension options page. have text box "save" button , want able save multiple websites ability edit or remove them later. this: enter url: | _ __ _ __ _ __ | | _ save _ | edit remove - www.google.com edit remove - www.msn.com edit remove - www.yahoo.com once enter website , click save, add list of websites there. i've been trying scavenge internet try figure out how accomplish this, don't know enough complete it. i'd recommend chrome.storage instead of localstorage : http://developer.chrome.com/extensions/storage.html it's fantastic. can choose store data online in google profile (100kb max). otherwise offline (100mb max, think). api super simple too: chrome.storage.local.get('websites', function(items) { console.log('websites:', items.websites); }); unlike localstorage , it's async, you'll using callbacks. it's lightning fast, ui won't notice. what i'd not ke

php - Upload an image AND send text with $_POST through an android app -

i have upload image server send text. ive done, doesn't work: string uploadimage(bitmap bm) { string resp = null; try { bytearrayoutputstream bos = new bytearrayoutputstream(); bm.compress(compressformat.jpeg, 75, bos); byte[] data = bos.tobytearray(); httpclient httpclient = new defaulthttpclient(); httppost postrequest = new httppost("myserver.com/add.php"); string rndname =generatesessionkey(15); list<namevaluepair> namevaluepair = new arraylist<namevaluepair>(1); namevaluepair.add(new basicnamevaluepair("filename",rndname)); namevaluepair.add(new basicnamevaluepair("email",email)); urlencodedformentity form; form = new urlencodedformentity(namevaluepair); form.setcontentencoding(http.utf_8); try { postrequest.setentity((httpentity) new urlencodedformentity(namevaluepair,"utf-8")); } ca

c - invalid type argument of unary '*' -

i'm week intro programming class, , i'm having trouble fixing what's supposed relatively simple code. keep getting invalid type argument of unary '*' error. #include <stdio.h> #define pi 3.14159; int main() { float r; float area; scanf("%f", &r); area = pi * r * r; printf("area %f", area); return 0; } could explain this, , how fix it? #define pi 3.14159; ^ drop semicolon. leaving in, code expand to: area = 3.14159; * r * r;

ios - Where is this vertical spacing coming from in UILabelView? -

Image
i'm creating ios view displays various static text elements. xib looks this: it uses 4 labels title, timestamp, body, , footer. every view anchored sibling view above vertically , anchored left/right of parent view. labels have fixed height except body has >= height , number of lines set 0 "word wrap" line wrapping style. parent view uiscrollview. on iphone looks fine: however on ipad looks this: huh? vertical space in body label coming from? xib , view controller identical between iphone , ipad (there no custom ipad code @ moment). i've found vertical space directly related how many line-wraps label renders. if no lines wrap, no vertical space. if few lines wrap, there's little vertical space. if every line wraps, well, that's looks like. first of ideas on why uilabel behaving way? second of all, if can't make stop doing how can work around it? i've tried few things. if call [bodylabel sizetofit] within -viewdidlayoutsubvi

c# - Getting mp3 file length -

i trying write audio player in c#. using bass library deal playing music have small problem getting length of song. well have read bass doc , found way: "all" need int stream = bass.bass_streamcreatefile(filepath,....); int length = bass.bass_channelbytes2seconds(stream, bass.bass_channelgetlength(stream)); and in of cases valid length of song. , here problem starts. far know stream creation operation quite expensive (correct me if mistaken) , creating stream length of song looks little silly. so question is: there other way without creating steam file (not being expensive). thinking later reading id3 tags. creating stream "evil must done no matter what" , if try other library same thing? you can use microsoft.windowsapicodepack.shell : using microsoft.windowsapicodepack.shell; then code so: string file = "myfile.mp3" shellfile = shellfile.fromfilepath(file); double 100nanoseconds; double.tryparse(so.properties.system.media.durat

Ruby mechanize clicking divs -

i'm trying search page divs containing specific class , click on them. each of these divs containing class have onclick event on them. my current code looks so, home_page = agent.get('http://mysite.com') home_page.search(".//div[@class='arrow up']").each |i| i.click end the div looks on website. <div class="arrow up" onclick="$(this).uparrow(u.config.places, null, event)" role="button" aria-label="uparrow" tabindex="0"></div> now there no click method because nokogiri object, here ask possible mechanize click on div this? current code can find divs match class name, cannot figure out how click on it. no there's no way that. need @ onclick attribute , try figure out it's doing. or use watir.

c# - My connection class doesn't read inputs values? -

i have below classes , 1 mainform. want user login inputs , connect oracle database. when track in debugging mode user inputs not assigned getters , setters so, when called helper class connect database null values passing connection string inside connection class... , can not access database. doing wrong? you don't set values. this: accessorclass s = new accessorclass(); ... = connectionclass.connection(s.db, s.id, s.password); // ^^ ^^ ^^^^^^^^^ - no values in these use initialization list set them: accessorclass s = new accessorclass() { db = "database", id = "id", password = "password" }; edit: your update won't work either. you're creating accessorclass object, calling method. in method.. you're new 'ing accessorclass . this: accessorclass s = new accessorclass (); s.db = txtdatabase.text; s.id = txtid.text; s.password = txtpassword.text; helperclass.get(s); //

javascript - 12AM time lost/not displaying in mapping interface -

the time values being displayed in our arcgis api javascript mapping service correctly except midnight 12am (it not display time, date). displaying datetime1 field in our mapping service. displaying est. the polygons stored in sql server table. in our sql server datetime1 field midnight 1/1/13 contain: 2013-01-01 00:00:00.0000000 and 1 a.m: 2013-01-01 01:00:00.0000000 i'm not entirely sure begin. javascript issue or need store times differently in sql server? thank you. new current job , have inherited large project. may take me bit find files/code. here query achieve this: select convert(varchar(20),getdate(),120) also, if want additional zeros @ end: convert(varchar(20),getdate(),120)+'.0000000'

c++ - Oracle OCI, bind variables, and queries like ID IN (1, 2, 3) -

succinct version: i'm looking c++ oci adaptation of following java technique, code able bind array of numbers (the array size can vary) non-pl/sql select statement , use resulting array in where id in (...) style check. http://rafudb.blogspot.com/2011/10/variable-inlist.html original question: we have c++ app talks oracle via oci. we're trying fix old code generates sql queries concatenating text; instead want use bind variables as possible. 1 particular case has come don't have solution for. select * mytable id in (1, 4, 10, 30, 93) where (1, 4, 10, 30, 93) part comes vector<int> or other flexibly-sized container of data. if knew 5 values, do: select * mytable id in (:1, :2, :3, :4, :5) but might 1 entry, or ten, or maybe zero. obviously, if building query string, can append many numbers need, goal avoid if possible , stick bind variables. is there way accomplish this? instance, in oci, can bind array , sub-select out of it? select * myt

jquery - using Fancybox with 2 ids the same -

i have 2 fancybox iframes same , both on same page - in different places (yes, both necessary). @ present, referenced jquery code: $(function() { $("#index").fancybox({ 'width' : 615, 'height' : 450, 'autoscale' : true, 'autodimensions' : true, 'transitionin' : 'elastic', 'transitionout' : 'fade', 'overlaycolor' : '#111', 'type' : 'iframe' }); }); // index2 $(function() { $("#index2").fancybox({ 'width' : 615, 'height' : 450, 'autoscale' : true, 'autodimensions' : true, 'transitionin' : 'elastic', 'transitionout' : 'fade', 'overlaycolor' : '#111',

c# - Regex skipping matches -

i trying select multiple matches in string looks like: 123 blah end 45 blah end ideally return 2 matches of starting digit sequence , ending end string. using following: regex splitter = new regex(@"^\d{2,3}(.*)end", regexoptions.singleline); foreach (match res in splitter.matches(content)) { console.writeline(res.tostring()); } however above pattern returning entire input string in 1 match. have feeling 'singleline' option. doing wrong? change * quantifier lazy form (with (.*?) syntax). @ moment attempts match many symbols in string possible - , succeeds in doing that, of course, have several blocks ending end . with ? added, engine attempt match pattern few symbols possible, finishing (.*?) match right before first end encounters.

list all folder names in directory - unix shell script -

how can list of folder using shell script, directory present in hdfs. here have tried : #!/bin/ksh echo " loading folders..." count=0 folder in `hdfs dfs -ls -d /user/data/*` if [ -d "$folder" ] count=`expr $count + 1` echo ${d} fi done echo ${count} this value of count variable 0 @ end of program. you need ask hdfs if folder directory, not bash. if hdfs dfs -test -d "$folder";

Why does jQuery's animate method not support the CSS "display" property, or other CSS properties? -

<div id="content"> <div id="ev1" class="evnt_imgs"><img src="images/e1.jpg" /> </div> <div id="ev11" class="evnt_desc">this text purely related event</div></div> $('#ev11').animate({height:'auto',width:'100%',borderradius:'20px',display:'block'},600); ev11.style.margin="auto"; ev11.style.background="#333"; ev11.style.display="block"; } for more clarity on question posted check url http://bhaswara2k13.com/events.php to animate fading in , out , display there special method in jquery. because display property can have set of values, not numeric. here do: $('#myitem').show(2000); and hide it: $('#myitem').hide(2000);

javascript - What's the simplest way to change the color of a div by clicking it? -

i'm trying change background color of div when clicked. code i've written: <div style="background-color:red" onclick="this.style='background-color:blue'"></div> for reason, hasn't been working. i'm sure it's syntax problem. can help? thanks! the background color can referred dom property : this.style['background-color'] <div style="background-color:red" onclick="this.style['background-color']='blue'">demo text</div> or js property : this.style.backgroundcolor <div style="background-color:red" onclick="this.style.backgroundcolor='blue'">demo text</div> the later more popular. browser ensures both dom property & js property in sync. check demo :

php - Translating a web.config setup into .htaccess -

i have working config file on host's .net server wanted move php 5.3 can use wordpress. anyway, guy. (it set 2 different subdomains redirecting same subfolder , keeping subdomain name in dir bar). <rule name="atmittens.com.ar" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{http_host}" pattern="^(www.)?aastudio.com.ar$" /> <add input="{path_info}" pattern="^/aastudio/" negate="true" /> </conditions> <action type="rewrite" url="\aastudio\{r:0}" /> </rule> <rule name="studioaa.com.ar" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{http_host}" pattern="^(www.)?studioaa.com.ar$" /> <add input="{path_i

xml - Relationship in php array -

i using gdata api youtube video , comments. reply in xml contains array inside it. for video id , comments xml response different. example getting array id video id array , 1 id 1 or many comments in array. array of both video id , comments follow: foreach ($array $entry) { $videoid = basename($entry); $video[] = $videoid; $logger->info('response youtube:videoid=>' . $videoid); } $this->view->videoid = $video; $author = array(); $content = array(); $arraycnt = array(); foreach ($video $id) { $comment = "http://gdata.youtube.com/feeds/api/videos/".$id."/comments"; $sxml1 = simplexml_load_file($comment); $entries = $sxml1->entry; foreach ($entries $a) { $author[] = $a->author->name; $content[] = $a->content; } } and particular view follow: <table> <tr> <td> <?php for($i=0;$i<$length;$i

gtk+: how to refresh canvas immediately (closed) -

followed layout in gtk+ . +----------------------------+------+------+------+ | |page 1|page 2|page 3| | +------+------+------+ | | | | | | | canvas area | | | | | | | | | | | | | | | | | +------------------+---------+ | | | button | | | +---------+ | | | | | | | | | | | | | +----------------------------+--

why python shell is behaving like this? -

when trying print function python shell giving me output this, correct. >> simplify(~a | (c & (~(b & ~c) | a))) >> ~a | c i trying same thing in manner using python file res = simplify(~a | (c & (~(b & ~c) | a))) print res it giving me output. | ~a c

How to use code block in Ruby? -

i have following code animals=['lion','tiger','zebra'] animals.each{|a| puts a} i wanted print tiger in array wrote this animals.each{|a| if a==1 puts animals[a]} but it's not working why? the wrong did in case:- animals.each{|a| if animals[a]==2 puts a} inline if statement put in wrong way. #each passes element of array,not index. animals[a] not work. throw error no implicit conversion of string integer (typeerror) . do below using array#each_index animals=['lion','tiger','zebra'] animals.each_index{|a| puts animals[a] if animals[a] == 'tiger' } # >> tiger

in app purchase - Play Store Beta Testing, Android Keystore, and Hired Developer -

so have several " issues ". i hired developer apps, , needs live access play store alpha / beta testing . testing in-app purchasing , , cannot tested on device. i granted him permission (from dev console) access alpha/beta sections. 1 thing don't want give him keystore / signing key, along password. play store wants apk signed original key beta testing (or they?) so how go it? and question - how teams multiple devs deal these issues? if don't want give him keys have these options: you need build , sign every single apk wants upload google play. set build server jenkins , let jenkins build + sign on every git push. make resulting signed apk available team. create internal signing service developers can submit apk file , signed.

In PHP, how to save words separated by space and lines and put words in array -

i need help. have variable name $thetextstring contain 9 words separated line breaks , spaces fetched html form. $thetextstring = "alpha bravo charlie delta echo foxtrot golf hotel india" ; how can tokenize php string $thetextstring remove lines , spaces , put 9 words inside array this $thetextarray[0] = "alpha"; $thetextarray[1] = "bravo"; $thetextarray[2] = "charlie"; $thetextarray[3] = "delta"; $thetextarray[4] = "echo"; $thetextarray[5] = "foxtrot"; $thetextarray[6] = "golf"; $thetextarray[7] = "hotel"; $thetextarray[8] = "india"; i need php code handle this. thank in advance! here want, removed additional new line , space. $thetextstring = "alpha bravo charlie delta echo foxtrot golf hotel india" ; $thetextstring = preg_replace("#[\s]+#", " ", $thetextstring); $words = explode(" ", $thetextstring); print_r($words); (

iphone - How to crop the video? -

i want crop video @ particular portion.given height,width,x , y ,i want crop particular region on video.does have idea. i have done lot of research didn't find fruitful.i tried cropping using gpuimage cropfilter taking time. i want perform operation quick possible,please suggest me technique or example how it. in advance you can use avmutablecomposition , avassetexportsession available in avfoundation framework for more detail visit apple's reference library avmutablecomposition class reference , avassetexportsession class reference avasset* asset = // create asset source video url avmutablecomposition *videocomposition = [avmutablecomposition composition]; avmutablecompositiontrack *compositionvideotrack = [videocomposition addmutabletrackwithmediatype:avmediatypevideo preferredtrackid:kcmpersistenttrackid_invalid]; avassettrack *clipvideotrack = [[asset trackswithmediatype:avmediatypevideo] objectatindex:0]; avmutablevideo

iphone - Wayfinding app for iOS -

i not sure possible, have request our marketing department create wayfinding iphone/ipad app our building. in other words, want people able pull map , app track location , show them on map , how places. unfortunately, have huge campus includes multiple buildings , multiple floors on each building along vast amount of indoor/outdoor locations. nice disadvantage no 1 on our team experienced ios. here are, couple of morons, trying figure out best way tackle problem , use guidance. question is, have advice/experience building app this? , if provide strategy on how solved problem. we had couple ideas, weren't sure if possible since don't write apps everyday: 1) nfc? scan points throughout hospital check location. 2)we have multiple switches/hubs/repeaters throughout organization, don't know if can grab nearest few , measure distance between vectors create location? thank help, appreciated. you can use qr codes, posted on walls everywhere in hospital. in qr

debugging - Cannot resole symbol in android sdk source code -

Image
i'm newer android develop. debugged android app on androidstudio today , got logcat below: 09-04 11:39:46.730 1859-1878/com.tsf.shell i/dalvikvm: rejecting re-init on previously-failed class lcom/flurry/android/d; v=0x0 09-04 11:39:46.730 1859-1878/com.tsf.shell w/system.err: java.lang.noclassdeffounderror: com/flurry/android/d 09-04 11:39:46.773 1859-1878/com.tsf.shell w/system.err: @ com.flurry.android.s.q(sourcefile:1772) 09-04 11:39:46.773 1859-1878/com.tsf.shell w/system.err: @ com.flurry.android.s.p(sourcefile:1726) 09-04 11:39:46.773 1859-1878/com.tsf.shell w/system.err: @ com.flurry.android.s.b(sourcefile:1715) 09-04 11:39:46.773 1859-1878/com.tsf.shell w/system.err: @ com.flurry.android.dd.a(sourcefile:1706) 09-04 11:39:46.773 1859-1878/com.tsf.shell w/system.err: @ com.flurry.android.bw.run(sourcefile:45) 09-04 11:39:46.773 1859-1878/com.tsf.shell w/system.err: @ android.os.handler.handlecallback(handler.java:725) 09-04 11:39:46.773 1859-1

ruby on rails - undefined method `delay' for UserMailer:Class -

i getting following error while writing mail notification process asynchronously using delay method. nomethoderror in samplecontroller#create undefined method `delay' usermailer:class i have following code in controller. usermailer.delay.idea_author_notification(self,nfication) i have installed delayed_job gem started delayed_job using jobs:work rake task. shall need other changes using delay method executing mail related code in background ? please me on asap.. thanks in advanced... the method delay not existed any action mailer class. can not call method usermailer:class . for can check methods mailer class in rails console. i.e usermailer.methods , check particular method existed or not, run following line. usermailer.methods.include?(:delay) above line returns false or if want use delayed jobs, please go through following link in github. you. delayed_jobs_for_rails2.x.x

ms word - webdav tomcat configuration -

Image
i want open files in serverside , edit , save there itslef ex : http://localhost:8080/webdavtestdemo/mydocument.doc i'have configured webdav in tomcat mentioned here . i'm able open file , able edit aswell(i'm sure document not opened in read-only mode). the problem when try save ,i'm getting strange error . see below "there has been network or file permission error. network connection may lost." is there faced issue? how resolve issue?? webdav protocol usage in ms office has been changing rapidly on recent years, , necessary webdav servers continue being developed maintain compatibility. i'm not sure how active tomcat servlet is, , whether been keeping up. my webdav server project bit more complex tomcat webdav servlet, actively maintained full compatibility major webdav clients - http://milton.io

vb.net - DataGrid export to excel -

i have datagrid control fills data se t. i don't show fields of data set in datagrid control. i want create excel file datagrid . how solution? (windows form , vb net 1.1 ) try link or try this imports excel = microsoft.office.interop.excel dim excel new microsoft.office.interop.excel.applicationclass dim wbook microsoft.office.interop.excel.workbook dim wsheet microsoft.office.interop.excel.worksheet wbook = excel.workbooks.add(system.reflection.missing.value) wsheet = wbook.sheets("sheet1") wbook .sheets("sheet1").select() .sheets(1).name = "nameyoursheet" end = 0 datagrid1.rowcount - 1 j = 0 datagrid1.columncount - 1 wsheet.cells(i + 1, j + 1).value = datagrid1.rows(i).cells(j).value.tosring next j next wsheet.columns.autofit()

field - MySQL : How to know which table that record belongs to in UNION result -

lets want records 2 table using union. how add field each record tell me table belongs to? : id | title | link | table ----------------------------------------------------- 1 | title 1 | somelink.html | articles1 2 | title 2 | link2 .html | articles2 3 | title 3 | link3 .html | articles1 thanks in advance? select some_column, 'union_1' from_where table1 union select some_column, 'union_2' from_where table2

java - HashSet storing Singleton object twice -

i store singleton object through 10,000 threads in hashset (i.e. 10,000 times). surprisingly hashset can't recognize object singleton , stores same object instance 2 times. , sometimes, stores object once size() method returns value 2 or 3. my singleton class is:- public class singleton { private singleton() { system.out.println("singleton--- runs once"); } private static class stagesingletonholder { static singleton instance = new singleton(); } public static singleton getinstance() { return stagesingletonholder.instance; } } the runobject provides run method main class' threads:- import java.util.hashset; import java.util.set; public class runobject implements runnable{ singleton singleton; public static set<singleton> set = new hashset<singleton>(); public void run(){ singleton = singleton.getinstance(); set.add(singleton); } public int numberofsingletons(){