Posts

Showing posts from September, 2012

java - Twitter4j : Search -

i use twitter4j status hashtag : configurationbuilder cb = new configurationbuilder(); cb.setdebugenabled(true) .setoauthconsumerkey("*******") .setoauthconsumersecret("****") .setoauthaccesstoken("*****") .setoauthaccesstokensecret("*****"); twitterfactory tf = new twitterfactory(cb.build()); twitter twitter = tf.getinstance(); query query = new query("source:twitter4j yusukey"); queryresult result; try { result = twitter.search(query); (status status : result.gettweets()) { system.out.println("@" + status.getuser().getscreenname() + ":" + status.gettext()); } } catch (twitterexception e) { // todo auto-generated catch block e.printstacktrace(); } i replaced *

crash - "GLib-ERROR **: Cannot create pipe main loop wake-up: Too many open files" on Qt -

i working on ubuntu. when run program after 1 hour received error : glib-error **: cannot create pipe main loop wake-up: many open files program has unexpectedly finished. when run gdb not crash. i don't understand why? , reason error ? thank much.. too many open files is pretty obvious. probalby have leak file descriptors, should check if code opens lots of files/filedescriptors doesn't close them properly. if fork process, should consider close them, before start actual process, might common mistake. the operating system has limited table of how many filedescreptors can maintain, , apparently exceeded limit.

cordova - Phonegap on Android: Can't access file from camera -

for quite time, use phonegap our app takes pictures , sends them server. until recently, used phonegap 1.4 , went well. now first switched 2.2 2.5, having problems in accessing picture after has been taken. camera responding file uri, when try access file, error 5. filesystem.root.getfile(file, {create: false}, ideacommitcopyfileentrytolocal, failopenfile); now looking advice, going wrong. ideas?

Not getting desired output in Oracle -

table creation query: create table students( student_no number, student_name varchar2(20), student_addres varchar2(25), student_dob date joining_time date ) insert query: insert students values (1,'ram','chittoor',to_date('02/04/2012','dd/mm/yyyy'),to_date('01:21:45','hh:mi:ss)) result:1 row inserted query check insert: select * students result: student_no student_name student_address student_dob joining_date .......... ............ ............... ........... ............ 1 ram chittoor 2-apr-2012 1-jul-2012 qhy time values not getting inserted properly? here working example if want time joining_time column your, select query should be select student_no, student_name, student_addres, student_dob, to_char (joining_time, 'hh:mi:ss') joining_time students

objective c - How to apply impulse on chipmunk body on a specific direction? -

i using: cpvect vector1=cpv(angle, 400); [body applyforce:vector1 offset:vector1]; but not working needed put correct angle using touch screen below line of code used getting angle -(void)cctouchesmoved:(nsset *)touches withevent:(uievent *)event { for( uitouch *touch in touches ) { cgpoint location = [touch locationinview: [touch view]]; location = [[ccdirector shareddirector] converttogl: location]; float angleradians = atanf((float)location.y/ (float)location.x-1); float angledegrees = cc_radians_to_degrees(angleradians); float cocosangle = -1 * angledegrees; angle = angledegrees + 30; } } thanks precious time give on that. found way achieve impulse on chipmunk body on specific direction. using below code. **angle = angle-90; //angle cctouchesmoved function float magnitude=shootpower; // magnitude range between 200 1000 cpvect impulse = cpv((cos(angle) * magnitude) , -(sin(a

expandablelistview - HorizontalScrollView in ExpandableList Android -

am trying implement horizontalscrollview in expandablelist group. group not expanding while clicking. when remove horizontalscrollview works normally. <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/boilerbg" android:layout_marginright="15dip" android:layout_marginleft="15dip" android:gravity="center_vertical" > <imageview android:id="@+id/tag_img" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_marginright="5dip" android:src="@drawable/group_down" /> <horizontalscrollview android:id="

asp.net mvc 4 - how to pass parameter to telerik Report using MVC 4 vs 2012 -

i want pass log ind person id parameter telerik report q1 2013 using mvc 4 vs 2012.and don't want send parameter through ui parameter. have done on aspx view is <script runat="server"> public override void verifyrenderinginserverform(control control) { // avoid server form (<form runat="server"> requirement } protected override void onload(eventargs e) { base.onload(e); var report = new immunizationrpt(); var instancereportsource = new telerik.reporting.instancereportsource(); instancereportsource.reportdocument = report; report.reportparameters.add("patientkey",telerik.reporting.reportparametertype.integer, 1); reportviewer1.reportsource = instancereportsource; reportviewer1.refreshreport(); } </script> but report shows record.it not getting filter record. my report showing records, because hadn't set report fil

android - Like a page in facebook from my application and getting feedback -

i've seen games , apps having feature enables app facebook page inside app. (or sharing app website link) i've read similar questions sharing on facebook intent , i'm enable share text on facebook now. question how can create button , how can feedback user has liked or shared app on facebook? please me in details because have little knowledge intents , facebook sdk.

android - MediaScannerConnection doesn't work -

public void onclick(view v) { // writing data file filewriter fw; try { fw = new filewriter(environment.getexternalstoragedirectory()+"/datalog.csv", true); bufferedwriter br = new bufferedwriter(fw); br.append(formatteddate + string.valueof(location.getlatitude()) + ";" + string.valueof(location.getlongitude()) + ";" + string.valueof(location.getspeed()) + ";" + string.valueof(location.getbearing()) + ";" + string.valueof(location.getaltitude()) + ";" + string.valueof(location.getaccuracy())); br.append("\r\n"); br.close(); fw.close(); // mediascanner scans file mediascannerconnection.scanfile(mainactivity.this, new string[] {fw.tostring()} , null, new mediascannerconnection.onscancompletedlistener() { @override public

casperjs - then() method only opening up the same link -

i have array of links , follow code supposed open each link in array of links. var x; var = 0; casper.start(url, function() { x = links.split(" "); // x array of links }); casper.then(function() { this.each(x, function() { this.thenopen((partialurl + x[i]), function() { this.echo(this.gettitle()); // display title of page i++; // change link being opened }); }); }); casper.run(); the problem opens first link , keeps opening link on , on again. it's i isn't changing. one of casperjs examples had same problem twitter followers, open link each twitter follower, display 1 name (the last 1 in list) entire time. here example: var users = ['subelsky','bmorejs']; var casper = require('casper').create(); var idx,data,user; var length = users.length; casper.start(); (idx=0; idx < length; idx++) { user = users[idx]; casper.thenopen('http://mobile.twitter.com/'

ember.js - How to access computed properties in a child controller from a parent resource -

say have routes like app.router.map(function() { this.resource('month', { path: '/:month_id' }, function() { this.route('summary'); }); }); i think /:month_id/summary route, default model/controller same /:month_id route, i'd have access correct month model , computed properties added monthscontroller . instead, find have add code: app.monthsummaryroute = ember.route.extend({ model: function() { return this.modelfor("month"); } }); app.monthsummarycontroller = ember.objectcontroller.extend({ needs: ['month'] }); this seems lot urls point same data, since plan on making many child urls of resource sharing data. is there better way this? want make sure i'm dong right way. i guess since using needs api correct , recommended way share data beetween controllers on right track. hope helps.

javascript - Create a function to send mail from a div -

i've several divs email icon. <div class="icon-send-mail" id="test1@email.com"></div> <div class="icon-send-mail" id="test2@email.com"></div> <div class="icon-send-mail" id="test3@email.com"></div> i want send email when user clicks on icon. $( document ).ready( function() { $('.icon-send-mail').click(function(email) { var mailto_link = 'mailto:'+email; var win = window.open(mailto_link,'emailwindow'); }); }); how can done? you're on right track: $( document ).ready( function() { $('.icon-send-mail').on('click', function(e) { var mailto_link = 'mailto:' + $(this).attr('id'); var win = window.open(mailto_link, 'emailwindow'); }); });

sql - facing error when trying to read using flat file source In SSIS -

Image
i trying read comma separated text file using flat file source in ssis package. text file has 1 column values. when select unicode codepage throwing error: the specified header or data row delimiter "comma{,}" not found after scanning 655536 bytes of file sample file:- styleid, 123456, 123456, 123456, can please tell me how resolve this. appears instead of rows have 1 long string. try setting row delimiter comma.

python - SQLAlchemy add columns to query() on mapped class -

i'm wanting pagination, i'm using postgresql. avoid doing query twice, i'm using feature described @ https://stackoverflow.com/a/8242764 how can add full_count column list of columns fetched in query. can use query.add_columns , column not accessible after calling query.all() is possible in sqlalchemy? can provide original code query want augment? using sqlalchemy core or declarative orm? latter this: from sqlalchemy import func items = session.query(model, func.count().over().label('full_count')).all() obj = items[0].model count = items[0].full_count

why is Android MotionEvent.getHistoricalX is thowing an exception -

i using gesturedetector.ongesturelistener in order implement pinch-to-zoom in android. extending textview class , therefore method settextsize() implemented. following code onscroll() . @override public boolean onscroll(motionevent e1, motionevent e2, float distancex, float distancey) { if(logging) log.v(module_name, "onscroll()"); float x, y; float olddist, newdist; if (e2.getpointercount() == 2 && ((e2.getaction() & motionevent.action_mask) == motionevent.action_move)) { x = e2.gethistoricalx(0, 0) - e2.gethistoricalx(1, 0); y = e2.gethistoricaly(0, 0) - e2.gethistoricaly(1, 0); olddist = floatmath.sqrt(x * x + y * y); if (olddist > 10) { if (logging) log.d(module_name, "starting zoom mode"); x = e2.getx(0) - e2.getx(1); y = e2.gety(0) - e2.gety(1); newdist = floatmath.sqrt(x * x + y * y);

html - My JavaScript if...else statement isn't working properly -

so i'm new javascript, , i'm trying use simple if...else statement toggle between showing , hiding div element. html page looks this: <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>test</title> <style type="text/css"> #fluffy { height:200px; width:200px; background-color:yellow; display:block; } #pepper { height:200px; width:200px; background-color:green; display:block; } </style> </head> <body> <div id="fluffy"></div> <div id="pepper" onclick="changestate()"></div> <script type="text/javascript"> function changestate() { var divstate = document.getelementbyid('fluffy').style.display; if (document.getelementbyid('fluffy').style.display == 'b

Matlab to C++ code generation (hdf5 format) -

there matlab function (h5write) lets user write output files in hdf5 format. seems work nicely when using matlab environment , matlab files. however, when try generate c++ code out of matlab files, conversion error arises. appears code generator (matlab coder) cannot convert h5write operation c++ code. is there way of getting around issue? efficiency important here since data sets need stored generated c++ executable large. if me out here, make day! :-) matlab provide interface converting code h5write c++ code. being said, can use matlab compiler build executable or dll. can use in c++ code, need mcr. if space not constraint, can this. otherwise, can use hdf5 api ( http://www.hdfgroup.org/hdf5/doc/cpplus_rm/ ) , write code writing hdf5 file format , use matlab coder link , compile.

javascript - BxSlider stopping on pagination click -

$(document).ready(function(){ $('#slider1').bxslider({ auto: true, pager: true }); i have code, , if click on page navigation bottons, slider stop auto. tried several solutions, no success! p.s.: bxslider v3! you can disable code line in bxslider.js: if (slider.settings.auto) el.stopauto(); //custom ken

sitecore6 - Email Adresses as Username in Sitecore -

my sitecore site requires usernames email address. i can create users in code whenever try create extranet users manually within sitecore cms on user manager throws valuation error email usernames user name not valid in selected domain. . appears @ symbol causes validation. anyone know how can update validation? you can use setting: <setting name="accountnamevalidation" value=".+" /> also, consider setting requiresuniqueemail of membership provider true can't have duplicate email addresses. more information: http://briancaos.wordpress.com/2013/04/22/sitecore-allow-email-adress-as-user-name/

java - Why is the square root calculation slower for larger numbers? -

this java code ask number printing square root without using math.sqrt() method: import java.util.random; import java.io.*; public class square { public static void main(string[] args) throws ioexception { final double tol = 0.5e-15; inputstreamreader reader = new inputstreamreader(system.in); bufferedreader input = new bufferedreader(reader); system.out.print("enter number aquare of it: "); double n = new double(input.readline()).doublevalue(); random random = new random(); double x = random.nextdouble(); { x = (x+n/x)/2; } while(math.abs(x*x-n)>tol*2*x); system.out.println("sqrt(" + n + ") = " + x); } } please run in computer , test several numbers. numbers below 30.1, runs , calculates square root quickly. when enter 30.2 or larger numbers, no square root calculated(at least feasible waitings)! interesting explanation behavior?! what

Switch status from android widget -

Image
i have app widget has switch on , class extends service manage content on widget. i'm using remoteviews access views edit them there somethings want dependant on sate of switch. there way state of switch? i've had through api , couldn't find way it. preemptively: can't use findviewbyid because not activity i can post code if needed. for clarity type of switch want use 1 are following app widgets guide ? don't think switch widget supported in remoteviews . anyways, since can't information on demand, need use setonclickpendingintent() , have click send intent update app widget. stick in intent specifying state button in (or state change when clicked, either one). in update logic, read extra, change ui, , set new pendingintent changed. public class myappwidgetprovider extends appwidgetprovider { public static final string action_update_switch = "myappwidgetprovider.update_switch"; public static final string extra_switch_

how to download file over ssl (https) on android -

i have app working using code below http, security reasons being changed https, causes download fail. tried changing httpurlconnection httpsurlconnection did not work. try { fileoutputstream f = new fileoutputstream(directory); url u = new url(fileurl); httpurlconnection c = (httpurlconnection) u.openconnection(); c.setrequestmethod("get"); c.setdooutput(true); c.connect(); inputstream in = c.getinputstream(); byte[] buffer = new byte[1024]; int len1 = 0 while ((len1 = in.read(buffer)) > 0) { f.write(buffer, 0, len1); log.d("downloader","downloading"); } f.close(); } catch (exception e) { e.printstacktrace(); log.d("downloader", "catch"); } there no particular passwords or needed connect computer , in fact if go browser on android phone , type in https url in question loads fine... cant figure out how in app. i have virtually no

Using Python's Requests library to navigate webpages / Click buttons -

Image
i'm new web programming, , have began looking using python automate manual processes. i'm trying log site, click drop-down menus select settings, , run report. i've found acclaimed requests library: http://docs.python-requests.org/en/latest/user/advanced/#request-and-response-objects , have been trying figure out how use it. i've logged in using bpbp's answer on page: how use python login webpage , retrieve cookies later usage? my understanding of "clicking" button write post() command mimics click: python - clicking javascript button my question (since i'm new web programming , library) how go pulling data need figure out how construct these commands. i've been looking [requestobject].headers, .text, etc. examples great. as always, help! edit::: make question more concrete, i'm having trouble interacting different aspects of web-page. following image shows i'm trying do: i'm on web-page looks this. there drop-down

vb.net - RaiseEvent between User Controls where there are multiple instances of the same controls on one page ASP.net -

i have problem i'm trying send string between user controls, "input.ascx" , "output.ascx", when have more 1 of each user control. here aspx parent page: <uc:input runat="server" id="input1" /> <uc:input runat="server" id="input2" /> <uc:output runat="server" id="output1" /> <uc:output runat="server" id="output2" /> user control input ascx: <asp:textbox id="textbox1" runat="server"></asp:textbox> <asp:button id="button1" runat="server" text="button" /> user control input vb.net: public shared event button1click(byval s string) protected sub button1_click(sender object, e eventargs) handles button1.click dim s string = textbox1.text raiseevent button1click(s) end sub user control output ascx: <%@ reference control="~/input.ascx" %> <asp:label id=&

android - MvvmCross IMvxGeoLocationWatcher never fires MvxGeoLocation success -

i'm using mvvmcross location plugin. on devices, mvxgeolocation success fires, on others never does. have seen other similar questions answers ( mvvmcross imvxgeolocationwatcher success action never fires on android ). however, not working on devices (rebooting), solution not valid. device i'm testing on right on android v 4.0.3, htc vivid. client reporting same issue on devices. below locationservice code, onlocation method never firing on these devices. public class locationservice : ilocationservice { private readonly imvxgeolocationwatcher _locationwatcher; private readonly imvxmessenger _messenger; public double latitude { get; set; } public double longitude { get; set; } public bool haslocation() { return (latitude != 0.0 && longitude != 0.0); } public locationservice(imvxgeolocationwatcher locationwatcher, imvxmessenger messenger) { _locationwatcher = locationwatcher; _messenger = messenge

objective c - Transfer values multiple text inputs to table view, add table view items as NSManaged Objects -

i getting started obj-c programming , cocoa. here trying accomplish , have gotten stumped on. i have single table view of managed objects in window1. have "add items" button calls window2 has blank table view (additemstableview) , series of form fields user fill in. when user fills in these fields , clicks add button in window2, string values of said fields input additemstableview show running list of items preparing add. when commit add, running list instantiate nsmanagedobjects do need seperate entity within coredata created objects added, transfer objects new entity upon add action? need save them in mutable dictionary , convert dictionary managed objects? it's important additemstableview contains data time period window open. when add commmited, window closes , table bound core data entity in window1 updates new results. if add items in window 1 pressed again, window2 called empty tableview again. i've been searching through , other forums days tryi

jira - How do I retrieve issues of specific status with JQL -

entering url, or running curl, like: https://<myurl>/rest/api/2/search?jql=project=<myproject>&status=closed&fields=id,key,status,project&maxresults=5 returns me 5 items in project statuses. reason can't query specific status. the output (part of it) is: { "expand": "schema,names", "startat": 0, "maxresults": 5, "total": 727, "issues": [ { "expand": "editmeta,renderedfields,transitions,changelog,operations", "id": "79577", "self": "https://<myurl>/rest/api/2/issue/79577", "key": "<myproject>-774", "fields": { "project": { "self": "https://<myurl>/rest/api/2/project/<myproject>", "id": "14421", "key": "<myproject>",

google apps script - Create Array of Images -

Image
i want create array of images using createimage() reads urls google spreadsheet. want ignore empty cell values in range , able read values on adjacent column of url. example: url, name, attribute. have far cannot multiple values in url range load different image spaces. function doget(e) { var app= uiapp.createapplication().settitle('not here') var abspanel= app.createabsolutepanel();//.setheight('100%').setwidth('100%'); var stackpanel=app.createstackpanel(); var grid = app.creategrid(8,8); var titlelabel= app.createlabel('not here'); titlelabel.setstyleattribute("text-align", "center"); titlelabel.setstyleattribute("font-size", "135%"); titlelabel.setstyleattribute("font-weight", "bold"); var insertlabel= app.createlabel('which schedule? (insert document key)'); var inserttxtbox=app.createtextbox().setid('txtbox').setname('ttbox').setmaxlength(44); var loadbtn=

Python: Write dictionary to text file with ordered columns -

i have dictionary d where: d = {'foo':{'meow':1.23,'mix':2.34}, 'bar':{'meow':4.56, 'mix':none}, 'baz':{'meow':none,'mix':none}} i wrote code write text file: def dict2txt(d, writefile, column1='-', delim='\t', width=20, order=['mix','meow']): import csv open( writefile, 'w' ) f: writer, w = csv.writer(f, delimiter=delim), [] head = ['{!s:{}}'.format(column1,width)] in d[d.keys()[0]].keys(): head.append('{!s:{}}'.format(i,width)) writer.writerow(head) in d.keys(): row = ['{!s:{}}'.format(i,width)] k in order: row.append('{!s:{}}'.format(d[i][k],width)) writer.writerow(row) but output ignores order = ['mix','meow'] , writes file like: - meow mix bar none 4.56 foo 2.34 1.23456 baz none none how write: - mix meow bar

cd - 1>&2 >/dev/null doesn't work right on Solaris -

i use command in script aix , rhel: cd - 1>&2 >/dev/null i know trying go previous directory after changing directory. while exact same logic works aix , rhel, it’s apparently not quite working on solaris, error got implying there’s no previous directory go to, when in fact script had change directory /etc/opt/esmsym . how make work on solaris? do have alternative? try running: cd $oldpwd that should take previous working directory. or, if doesn't work try using this: export path=$(pwd) cd ~/b/ cd $path this saves copy of current path $path variable , changes current directory ~/b/ , uses $path variable return previous working directory. just side-note, there's podp , pushd pushd $(pwd) cd /tmp popd taken popd(1) : pushd pushes directory onto directory stack. no arguments, exchange top 2 elements. +n rotate n’th entry top of stack , cd it. dir push current working directory onto stack , change

Communication between Class and Main Activity Android -

i new in android hope can excuse ignorance i made activity control bluetooth devices telephone, working generate new class activity, class take care of bluetooth communication. i have questions: first: in activty employed 1 broadcast receiver listen actions of bluetooth adapter state_on, bond_bonded... using actions update views, call methods , on. so, possible keep listening broadcast receiver inside class , send changes main activity update views , on? second: need send information bluetooth class main activity, information read devices, information broadcast receiver... so, best way pass information between class , main activity? well, lot :) the onreceive() method of broadcastreceiver called main thread: "this method called within main thread of process" ( http://developer.android.com/reference/android/content/broadcastreceiver.html#onreceive(android.content.context, android.content.intent) ). that means can update ui onreceive() method. need

postgresql - Return rows matching elements of input array in plpgsql function -

i create postgresql function following: create function avg_purchases( in last_names text[] default '{}' ) returns table(last_name text[], avg_purchase_size double precision) $body$ declare qry text; begin qry := 'select last_name, avg(purchase_size) purchases last_name = any($1) group last_name' return query execute qry using last_names; end; $body$ but see 2 problems here: it not clear me array type useful type of input. this returning 0 rows when do: select avg_purchases($${'brown','smith','jones'}$$); what missing? this works: create or replace function avg_purchases(last_names text[] = '{}') returns table(last_name text, avg_purchase_size float8) $func$ select last_name, avg(purchase_size)::float8 purchases last_name = any($1) group last_name $func$ language sql; call: select * avg_purchases('{foo,bar,baz,"}weird_name''$$"}'

selenium webdriver - X11: Start desktop manager inside daemon -

what i'm trying do: make screenshots of desktop , running program (firefox webdriver selenium, if it's important) in daemon (celeryd) in auto mode. , need desktop manager running, mandatory requirement. i'm trying use fluxbox can switch other manager. current progress: can start x-server (xvfb) in daemon , start selenium webdriver. fluxbox start succeeds when try make terminal, fails in daemon following errors in log: can't create directory failed load database: failed load database:/init retrying with: /etc/x11/fluxbox/init i tried specify init-file directly, can't create directory error still exists , fluxbox fails start. might daemon-mode restriction. question: possible run any desktop manager inside daemon? if yes, how can this?

knockout.js - KnockoutJs SELECT tag is Undefined -

i having issue dropdownlist part of model not binding correctly. not sure doing wrong. have simplified sample binding fine. in complete version, dropdownlist says "undefined". the model "employee" , has set of associated models of "contacts". relevant bits this: var employeeviewmodel = function() { var self = this; self.typesofcontact = ko.observablearray(['phone number', 'website', 'messaging', 'address', 'email address']); self.contactdetails = ko.observablearray(); self.contactdetails().push(new contactdetail(self.typesofcontact()[0], 'home phone', '', '', '', '', '', '', '')); /* snip bunch of other properties */ }; the relevant bits of contactdetail this: var contactdetail = function(contacttype, addresstype, contactfield, address1, address2, address3, city, state, postalcode) { var self = this; self.contac

javascript - How do I report on a session variable in google analytics? -

i new custom variables in google analytics. don't understand how grab session/post variables user. i trying capture $_session['usercountry'] , add ga data. displays country user signed up. from ga _gaq.push(['_setcustomvar', 2, // custom var set slot #2. required parameter. 'country', // name of custom variable. required parameter. '???', // value of custom variable. required parameter. // (you might set value default no) 2 // sets scope session-level. optional parameter. ]); do put in usercountry in have question marks? client-side javascript doesn't have access $_session , collection kept server-side. you'll need expose value javascript somehow. 1 option include in initial output php: <script> var usercountry = <? echo json_encode($_session['usercountry']) $>; </script> thi

scala - How can I find the definition of methods/operations defined in an implicitly-converted class? -

i'm looking @ else's source code (scala), see operator :+= being called on variable of type indexedseq . looking on scaladocs page class figure out operator does, not see it. i'm thinking either it's defined in class outside of indexedseq 's inheritance hierarchy, or else javascript on scaladocs page hiding somewhere can't see it. (actually it's neither; see answer below.) i've hit every button on scaladocs page trying unhide everything. i've looked in web-page's html code. there has got way operator documentation of class can applied. hasn't there? ( n.b. : looked operator using symbolhound , know operator means now. question scala documentation in general, not particular operator.) all operators in scala normal methods. you cannot find because compiler magic re-assignement, not operator. or way: looks operator of own, "an operator followed = character". the compiler magically turn assignment if operat

java - Jackson read json in generic List -

i'm using jackson in order read json messages. 1 of values i' trying parse list , value contains type of data in list. structure 've created in java. public class message<t> { private timestamp time; private restaction action; private string type; private list<t> data; } through class.forname(); can class represents data in list. question how can read list. if need map incoming json list can this string jsonstring = ...; //your incoming json string objectmapper mapper = new objectmapper(); class<?> clz = class.forname(yourtypestring); javatype type = mapper.gettypefactory().constructcollectiontype(list.class, clz); list <t> result = mapper.readvalue(jsonstring, type); edit something this, completly untested , never done public message<t> deserialize(jsonparser jsonparser, deserializationcontext arg1) throws ioexception, jsonprocessingexception { objectmapper mapper = new objectmapper(); objectco

php - Get Random values from mySQL -

i have table columns subjects,questions,exam,question id , table want random values display. for every every question have used: $singlesql = mysql_query("select * questions id='$question' order rand() limit 1"); for every subject: $singlesql = mysql_query("select * questions id='$question' , subject='ayooooo' order rand() limit 1"); i want display random questions when ever page loads , hen next question asked. quiz.php?question=' how should use here? javascript: function getquestion() {     var hr = new xmlhttprequest();     hr.onreadystatechange = function () {         if (hr.readystate == 4 && hr.status == 200) {             var response = hr.responsetext.split("|");             if (response[0] == "finished") {                 document.getelementbyid('status').innerhtml = response[1];             }             var nums = hr.responsetext.split(",");             documen

java - Retrieve values from class: custom methods or reflection? -

for take values ​​from class there primitive fields (no methods) list of key - value prefer use reflection (with dynamic iteration) or specific method return hashmap? prefer? at moment there fifty classes or in future can grow twenty or thirty (in regime) i reflection in case not necessary? the reflection-based approach cleaner, because not require classes implement additional methods, , not liable maintain these methods when new fields added existing classes. a hashmap -based approach not buy in terms of performance, because primitives must wrapped in objects inserted map - same way wrapped returned reflection-based calls.

mysql - PHP login conditon error -

i'm trying make simple login page in php, code echo "sorry, credentials not valid, please try again."...!! please help! :d <?php error_reporting(0); $user ='root'; $host = 'localhost'; $db = 'christcode'; $db_pass = ''; $con=mysqli_connect("$host","$user","$db_pass","$db"); // check connection if (mysqli_connect_errno($con)) { echo "failed connect mysql: " . mysqli_connect_error(); }else{ $username = $_post['username']; $password = $_post['password']; echo $username; echo $password; // insert data mysql $sql="select * users username='".$username."' , password='".$password."' limit 1"; $result = mysqli_query($sql); echo $result; if(mysql_num_rows($result) == 1) echo"you validated user."; else echo"sorry, credentials not valid, please try again."; } if(mysql_num_row

Why Can't I Assign Value to this Array in c#? -

i'm triying find out way can know users online on app, therefore data i'm saving text file, when try reading line line of text file, want pass array compare data better. here how doing it: string folder = application.startuppath; string file = "users.txt"; string str; string[] strarray; string[][] data; int rows = 0; streamreader lines = new streamreader(folder + file); while ((str = lines.readline()) != null) { strarray = str.split('~'); (int = rows; <= rows; i++) { (int j = 0; j < strarray.length; j++) { data[rows][j] = strarray[j]; // here error } } rows++; } as see, declared array of data in before, says can't use cause unassigned. thanks in advance. for explanation of error, need jagged arrays. key need initialize both outer array , inner arrays: int[][] jagged = new int[5][]; // initialized outer array jagged[0] = new int[3]; // initialized inner array howe

php - My code with str_replace don't work -

why code isn't working? trying rename, switch location , other, seems str_replace bug. nice, if told me, what's wrong... index.php <?php header('content-type:text/html;charset=utf-8'); session_start(); require_once ('inc/core.php'); $core = new core($_get['viev']); this core.php <?php class core{ var $template; var $view; public function __construct($view) { $this->template = $this->loadtemplate(); $this->view = $view; $this->loadview(); echo $this->template; } private function loadtemplate(){ if(file_exists('template/template.html')){ $template = file_get_contents('template/template.html'); } else{ $template = 'coś poszło nie tak z szablonem ;/'; } return $template; } private function loadview(){ global $core; $core = $this; if($this-&g

ios - how to get auto layout to work in Xcode -

Image
i looked http://developer.apple.com/library/ios/#recipes/xcode_help-interface_builder/articles/understandingautolayout.html explanations pretty vague. i'm on ios 6. have view controller 2 child views, 1 on top of another: i want use autolayout set views in such way if change top view's frame programatically, bottom view resize accommodate top view's new frame. is, if increase top view's height, bottom view's height should drecrease keep same separation between both views; opposite should happen if decrease top view's height. the default constraints these 2 views in xcode are: and if hold command , resize top (map) view, bottom (tableview) seems correctly shrink or expand vertically honor space constraint between them. however, minute try modifying top view's frame or bounds via code, instance: self.topview.frame = cgrectmake(0, 0, 320, 514); the bottom view doesn't shrink. missing? you can't modify self.topview.frame

uiimageview - Showing 5 random images, but everytime 2 the same images -

i'm developing game, don't know how proceed. i'm showing image , after 5 sec disappears , 4 images pop up. 3 different images , 1 image image disappeared. don't want show same images everytime, want random images shown everytime start application. how can make sure image disappears, shown in other 4 images? , possible change places of 4 images everytime? i hope will/can me! thanks!! you can : name images image0.png, .. image4.png etc.. create random no using -> nsinteger randomnumber = arc4random() % 5; generate no.s form 0 4. 3.now use image%@ %@ randomly generated number. mind pretty basic solution. there better solutions out there.

jquery mobile - IFrame player API only play audio with no video on samsung galaxy S3 -

i'm using jquery mobile + phonegap build android , iso applications. 1 of pages contains videos loaded youtube, page present thumbnail , while user click on i'm calling following method: onyoutubeiframeapiready(videoid, element){ player = new yt.player(element, { height: '100%', width: '100%', videoid: videoid, events: { 'onready': onplayerready } }); } note: in code i'm not using onyoutubeiframeapiready() customized 1 i'm directly calling. working fine! issue saw on samsung galaxy s3 (4.0.4) there can hear video cannot see unless i'm expanding video full screes. iframe player api uses compatible player why i'm facing issue here? can done?

c# - OpcNetApi DataChange Event does not fire -

i'm using opcnetapi connect opc server. able connect , read data without issues, however, when data changes need read again able see changes, i'm not being notified of changes event though have added handler datachanged event of subscription. is there special need work? opc.url url = new opc.url("opcda://localhost/archestra.fsgateway.3"); opccom.factory factory = new opccom.factory(); using (opc.da.server server = new opc.da.server(factory, url)) { server.connect(); console.writeline("server localid = {0}", server.locale); opc.da.subscriptionstate state = new opc.da.subscriptionstate(); using (opc.da.subscription group = server.createsubscription(new opc.da.subscriptionstate { name = "group1", updaterate = 40, deadband = 0, active = true }) opc.da.subscription) { //

VB.NET Datagrid Calculations (Visual Studio 2010) -

in datagrid table: calculate difference between 2 columns result in third column (performed automatically during runtime). null value 0 in budget , cost columns. budget - cost = difference. using visual studio 2010. if knows how in designer, please let me know.otherwise... budget = column7 cost = column8 difference = column 9 the budget column less cost column = difference column rows. please provide me code? have trashed mine...not worth posting. assuming using windowsforms: create dataset using designer create datatable 3 columns: budget, cost , calculated column, difference. instantiate datatable , fill it. bind datatable datagridview

Greenplum windows service for import data -

i have installed windows service on local machine , setup looks good. when read external table, http response code 500. create external temporary table ( smallint, b integer, c text ) location ('gpfdist://hostname:8081/filename.txt') format 'text' (delimiter ' ' null '' escape 'off') ; error message - error: http response code 500 gpfdist (gpfdist://hostname8081/filename.txt): http/1.0 500 session error (url.c:326) (seg538 slice1 sdw135:40002 pid=6237) (cdbdisp.c:1476) i not sure how resolve error possible chance of permission / access issues. check stream provisioning setup. user creating external table should have permission write , access directories on etl nodes you've started stream provisioning.

objective c - how to create a directory in /Library/Application Support -

i'm getting permission denied error when try create directory "my app name" in /library/application support/ //@"/library/application support/my app name/" nsstring *path = [[nssearchpathfordirectoriesindomains(nsapplicationsupportdirectory, nslocaldomainmask, yes) objectatindex:0] stringbyappendingpathcomponent:@"my app name"]; if(![[nsfilemanager defaultmanager] createdirectoryatpath:path withintermediatedirectories:yes attributes:null error:&error]){ nslog(@"%@", error); } i don't need sandbox app read sandboxing , adding special entitlements fix it. i tried adding exception entitlements file no luck <key>com.apple.security.temporary-exception.files.absolute-path.read-write</key> <array> <string>/library</string> <string>/library/application support/</string> </array> any ideas? edit: should note looking save file shared users. dont want each user have diff

twitter bootstrap - PHP/Laravel/Bootsrap fetch data -

i've got tiny little problem. i've got table in database called 'player_skills'. contains columns (example): player_id | skill_id | value | count 15 0 10 12 15 1 10 51 ... 15 8 10 12 the player_id id of player column 'id' under 'players' table. there 8 skills. value default value (which irrelevant in case). count value (the value of players skill). basically, want pull data bootstrap tabs (example): <div class="tabbable tabs-left"> <ul class="nav nav-tabs"> <li class="active"><a href="?skill0" data-toggle="tab">section 1</a></li> <li><a href="?skill1" data-toggle="tab">section 2</a></li> <li><a href="?skill2" data-toggle="tab">section 3</a></li>

android - Facebook LoginButton inside Dialog -

i'm working facebook sdk. i'm adding facebook loginbutton inside dialog, when click it, request doesn't work. public class startsfragment extends fragment { classicbutton classicbutton; dialog dialog; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.starts_fragment, container, false); final fragment startsfragment; startsfragment = this; button joinus = (button) view.findviewbyid(r.id.joinus); joinus.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { dialog = new dialog(getactivity(), r.style.userloginregisterdialog); dialog.setcontentview(r.layout.login_dialog_fragment); loginbutton lb = (loginbutton) dialog.findviewbyid(r.id.authbutton); lb.setfragment(getparentfragment()); lb.setreadpermissions(arrays.aslist("email",&

html - Div Disappears when given Fixed Position -

i working on website @ www.thejasonsanders.com , whenever try give div fixed position in of sections aside first 1 ("homepage"), div disappears. have tried can think of correct issue , nothing seems resolve it. so, turning number 1 resource in these types of matters! i testing image in "portfolio" section under divs "portdiv" , portdiv2" same styling main logo image. main logo image in homepage section fixed positioning , displaying correctly. again, when image placed in 1 of other sections things start acting weird. can please me figure out going on? thank time , help! when div given fixed position , it's outside of viewport doesn't exist. think that's problem you're facing. here's quick demo . notice when make browser window taller , shorter <img> s disappear. want use position: absolute ? sorry if i'm way off.

cordova - unable to download phonegap from github -

firstly don't know should ask question i tried downloading phonegap version 2.4.0 http://phonegap.com/install/ links https://github.com/phonegap/phonegap/archive/2.4.0.zip fail every single time. download few mb, , return network error. tried downloading using chrome , firefox fail. tried using download manager in firefox (orbit), still fail same message, network error. i can download files every other place in internet, files larger phonegap file. asked friend try , download file me location (but in same country, malaysia), receive same error. else faced problem? or country specific problem? have tried download file past 3 days , failed. (about month ago) have no problem downloading phonegap library. can shed light me why happening? *i need phonegap 2.4.0 since latest version have prob.. read in many threads problem go away phonegap 2.4. i've downloaded zip , re-uploaded server. have made available download here: http://www.ronalddiaz.net/phonegap-2.4.