Posts

Showing posts from April, 2012

amazon web services - Connecting to AWS EC2 Win8 Instance from Ubuntu with Remmina -

i'm real beginner in subject. job wants me connect our server on aws - have created win8 server there. i have dns, username , password - thats all. understand easy if have win machine (like of workers here) i'm running ubuntu 12.04. how on earth connect instance? dns have is: ec2-<server>.eu-west-1.compute.amazonaws.com do need remmina or can terminal? i'd connect server, , see gui version of server's desktop. if linux server it'd enough me connect console, windows figure need gui... when try putting dns,username,password in remmina message: unable connect rdp server <server>.eu-west-1.compute.amazonaws.com do need know else server? need .pem key? - i've read posts , written check/delete in ~/.freerdp/certs file - file doesn't exist on computer, when ls in ~/.freerdp/ directory -> empty. please don't know how connet remote server, , sadly couldn't find info on connection ubuntu win8 on aws. bonus help: how ins

javascript - upload form file with ajax -

this question has answer here: is possible use ajax file upload? 7 answers i want upload file , save on server jquery ajax. i've tried didn't work. doesn't want process it. do: html code <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="submit_file" id="submit_file" required > <input type="text" name="submit_message" id="submit_message"> </form> <a href="javascript:upload();" ><img src="img/join_btn.png" /></a> validation , ajax <script type="text/javascript"> function upload() { var $submit_file = $("#submit_file").val(); var $submit_message = $("#submit_message").val();

symfony - Symfony2, Trailing slash -

i'm facing issue don't know how solve. have route: www.mysite.com/news/{news} on local machine, don't have problem accessing it, on live-server trailing slash gets added, , ofc route doesn't exist = error. why slash added? how prevent it? other routes work fine, no "/" added there. happens in app.php ... app_dev.php works fine. i've tried remove trailing slash via mod_rewrite, route doesn't work. ( fosuserbundle /register 1 ....). does know, why there's trailing slash on live-server, not on local machine? same .htacces , 000-default.conf . , stated above app_dev.php works fine well. regards

c# - How to place one form just above another in winforms? -

im creating winforms application notified every , of messages or occurrences. notification style i'm expecting of gtalk, if user sends message shows notification on bottom right of screen, , if there message user @ same time new notification window shown above previous one. new window wont overlap or eclipse older one. so far have achieved few things getting window on bottom right of screen wasnt big task using code in constructor rectangle workingarea = screen.getworkingarea(this); this.location = new point(workingarea.right - size.width, workingarea.bottom - size.height); but once form named "notify" opened @ bottom right of screen. when new notification comes overlaps previous form. there can that. missing obvious? this parent form button, creates new notification forms: public partial class parent_form : form { public static list<form> activenotifications = new list<form>(); public parent_form() { initial

c# - REST - Good design practice -

i new in windows phone development , trying write app retrieves data server , displays them user. have several resources on server, lets user, quest , activity. use restsharp lib retrieve data server. example of user: public void get(string id, lifehunt.mainpage.userready userready) { var client = new restclient(deployd.rest_url); var request = new restrequest(resource + "/{id}", method.get); request.addurlsegment("id", id); client.executeasync<user>(request, response => { if (response.statuscode == system.net.httpstatuscode.ok) { userready(callback.data); } }); } once user retrieved, call userready method passed callback , user mainpage display it. now, have repeat whole process crud (insert, get, getall, update, delete) functions users, quest , activity. means need 15 different callback methods, think not software design. the other way 1 callback method , check type of parameter passed in callb

sql server - playframework 2.X JPA to MSSQL Unable to build Hibernate SessionFactory -

i want using jpa connect mssql,using sample computer-database-jpa can access h2 sql ,but when change mssql ,it's put error message "persistenceexception: [persistenceunit: defaultpersistenceunit] unable build hibernate sessionfactory" can me thanks! my application.conf # database configuration # ~~~~~ # can declare many datasources want. # convention, default datasource named `default` db.default.driver=net.sourceforge.jtds.jdbc.driver db.default.url="jdbc:jtds:sqlserver://127.0.0.1:1433;databasename=tcgw;selectmethod=cursor:sendstringasunicode=true" db.default.user=qqqq db.default.password=qqqq #db.default.driver=org.h2.driver #db.default.url="jdbc:h2:mem:play" db.default.jndiname=defaultds applyevolutions.default=true hibernate.use_sql_comments=true my persistence.xml <persistence-unit name="defaultpersistenceunit" > <provider>org.hibernate.ejb.hibernatepersistence</provider> <non-jta-data-source>

php - How to set application version for Symfony WebProfiler? -

according this commit can set own application name , version webprofiler. i'm asking myself (and ^^) what's intended way this? /** * constructor. * * @param string $name name of application using web profiler * @param string $version version of application using web profiler */ public function __construct($name = null, $version = null) { $this->name = $name; $this->version = $version; } the collector defined in configdatacollector of httpkernel component , constructor has 2 parameters defaulting null . service configured in collectors.xml of frameworkbundle , there's no way set parameters. i've overriden collector class setting data_collector.config.class in app/config/config.yml , injecting application's version way... totally feels wrong. do miss something? the commit message says (emphasis mine): [webprofiler] added possibility override application name/version in wdt i presume way way did it, is, use

cordova - _gwt$exception : Cannot read property 'uuid' of undefined -

i working on mgwt-phonegap application. i using code: final phonegap phonegap = gwt.create(phonegap.class); phonegap.addhandler(new phonegapavailablehandler() { @override public void onphonegapavailable(phonegapavailableevent event) { //start app - phonegap ready window.alert("phonegap ready"); }}); phonegap.addhandler(new phonegaptimeouthandler() { @override public void onphonegaptimeout(phonegaptimeoutevent event) { //can not start phonegap - setup window.alert("can not start phonegap"); }}); phonegap.initializephonegap(); when using compiled code target folder, phonegap i.e assets/www folder , running phonegap application. giving me error: _gwt$exception : cannot read property 'uuid' of undefined this script using on index.html page: <script type="text/javascript" language="javascript" src="cordova.js"></script> <sc

block - Avoid people from entering my site using anonymous proxy -

avoid people entering site using anonymous proxy. possible? have wannabe hacker trying enter joomla site. joomla site has plugin warns me email every login attempt , shows me ip of computer trying enter. ip different every 5 or attempts. check similar topic joomla forum http://forum.joomla.org/viewtopic.php?f=267&t=295854 in short suggests is if(isset($_server['http_x_forwarded_for']) || ($_server['http_user_agent']=='') || ($_server['http_via']!='')){ die(" "); this code put in index.php under joomla root, right after line define( '_valid_mos', 1 ); you see more information on topic in article http://www.wikihow.com/block-proxy-servers in last one, there suggested following .htaccess rule rewriteengine on rewritecond %{http:via} !^$ [or] rewritecond %{http:forwarded} !^$ [or] rewritecond %{http:useragent_via} !^$ [or] rewritecond %{http:x_forwarded_for} !^$ [or] rewritecond %{http:pro

linux - Qemu install make failed, lost .deps/pixman-access.Tpo -

this met when install qemu-1.7.1 on ubuntu 13.04. configure right, failed in make section. the last error is making in pixman /usr/bin/perl ./make-combine.pl 8 < ./pixman-combine.h.template > pixman-combine32.h || ( pixman-combine32.h; exit 1) /usr/bin/perl ./make-combine.pl 8 < ./pixman-combine.c.template > pixman-combine32.c || ( pixman-combine32.c; exit 1) /usr/bin/perl ./make-combine.pl 16 < ./pixman-combine.h.template > pixman-combine64.h || ( pixman-combine64.h; exit 1) /usr/bin/perl ./make-combine.pl 16 < ./pixman-combine.c.template > pixman-combine64.c || ( pixman-combine64.c; exit 1) make all-am cc pixman-access.lo mv: can not get".deps/pixman-access.tpo" file status(stat): cannot file or directory make[4]: *** [pixman-access.lo] error 1 make[3]: *** [all] errot 2 make[2]: *** [all-recursive] error 1 make[1]: *** [all] error 2 make: *** [subdir-pixman] error 2 please me out of this. don't know fault is.

ajax - How to get response of Python Script in Sencha Touch? -

i have written python script named abc.py prints json array. code given below import urllib2 import json json_object={"key":"value"} print json_object the output follows: {'key': 'value'} now want retrive json in sencha touch application. making ajax call. code written below: ext.ajax.request({ url: 'resources/startup/abc.py', contenttype: 'application/json', reader: { type: 'json', }, success: function(response) { console.log(response); }, } }); but when running application, not getting json object. instead getting raw code written inside abc.py. output: import urllib2 import json json_object={"key":"value"} print json_object where doing mistake??? appreciated. this python bug. rename abc.py filename.

formula - Algorithm for this format -

i trying develop program compute tax given base salary, believe given format of income tax table have, there should formula or algorithm calculate tax given base salary. below sample format of income tax table. can lookups think algorithm or formula might best approach. annual salary monthly ranges tax due 18,000.00 0.00 1,500.00 0.00 18,060.00 1,500.01 1,505.00 0.25 18,120.00 1,505.01 1,510.00 0.50 18,180.00 1,510.01 1,515.00 0.75 18,240.00 1,515.01 1,520.00 1.00 ..... 27,960.00 2,325.01 2,330.00 41.50 --last line of first format 28,020.00 2,330.01 2,335.00 41.83 -- start of second format 28,080.00 2,335.01 2,340.00 42.33 28,140.00 2,340.01 2,345.00 42.83 i able find formula first part , working find in program can't make second part work. the formula first part below : the tax 0.25 on every 5.00 or

php - Input data from android to database in mysql -

i have code: <?php include('konek.php'); $entid=$_post['entid']; $entsender=$_post['entsender']; $enttitle=$_post['enttitle']; $entdate=$_post['entdate']; $entsagrade=$_post['entsagrade']; $entreason=$_post['entreason']; $entproblem=$_post['entproblem']; $enttime=$_post['enttime']; if($row_num != 0) { $ins=mysql_query("insert tblentry(entid,entsender,enttitle,enttime,entsagrade,entreason,entproblem) values('$entid','$entsender','$enttitle',curtime(),'$entsagrade','$entreason','$‌​entproblem')"); echo "added"; } else { echo "added."; } ?> my problem is, when input data in android simulator, not adding. problem in code? and here code in android: public class addentry extends activity { button buttonsave; edittext ent1, ent2, ent3, ent4, ent5, ent6 ; httppost httppost; httpresponse response; httpclient httpclient; li

bash - Output Shell Script Variable to HTML -

rather new coding, looking little having variable output local html file. both script , html on same machine. script pulls signal level modem , have displayed local html loading screen. signal script: #!/bin/bash modem=/dev/ttyusb3 modemcmd=at+csq { echo -ne "$modemcmd"'\r\n' > "$modem" if [ $? -eq 1 ] echo "error"; exit; fi { while read -t 1 if [[ $reply == +csq* ]] arr1=$(echo "$reply" | cut -d' ' -f2) arr2=$(echo "$arr1" | cut -d',' -f1) echo "$arr2" exit; fi done echo "error"; } <"$modem" } 2>/dev/null would output of display in table on html. thanks! when host own web server, cgi protocol allows server-side programming in any language like; including bash. here's simple example serves web page displays current date , time, , refreshes every 10 seconds. pu

asp.net - mvc pagedlist page number not incrementing -

i'm using mvc 5 along pagedlist.mvc 4.5.0.0, have data coming , displaying on table, along pager controls showing up. when click next though, pager continues send page = 1 function, see while debugging. my page has: <div class="pagedlist" data-otf-target="#contractlist"> @html.pagedlistpager(model, page => url.action("index", new { page }), pagedlistrenderoptions.minimalwithitemcounttext) </div> my method sends data action is public ipagedlist<contractviewmodel> getallcontracts(int page = 1) { var lstcontractviewmodel = new list<contractviewmodel>(); using (contractrepository contractrepos = new contractrepository(new unitofwork())) { var activecontractlist = contractrepos.all.orderbydescending(x => x.id); foreach (var activecontract in activecontractlist) { mapper.createmap<d

ruby - Paperclip Rails error when trying to refresh -

my user model: class user < activerecord::base has_attached_file :avatar, :styles => { :profile => "200x200>", :collab => "300x200>", :msg => "50x50>" }, :default_url => "missing.png" validates_attachment_content_type :avatar, :content_type => /\aimage\/.*\z/ ... i have added :msg , :profile styles , i'm trying refresh them show in views. i've tried running: rake paperclip:refresh class=user and error: rake aborted! argumenterror: wrong number of arguments (0 1) /home/jrile/rails/cs480/app/models/user.rb:44:in `hash' /home/jrile/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment_registry.rb:42:in `names_for' /home/jrile/.rvm/gems/ruby-2.1.0/gems/paperclip-4.1.1/lib/paperclip/attachment_registry.rb:16:in `names_for' /home/jrile/rails/cs480/lib/tasks/paperclip.rake:15:in `obtain_attachments' here's line 44 of user.rb (not sure why has paperclip) def

gdb - How to get Control Register (CR2) value? -

do have way find value of cr2 core of x86-64 ? info registers doesn't show it. (gdb) info registers rax 0x7fc9ca854000 140504662884352 rbx 0x119ad58 18459992 rcx 0xa0000 655360 rdx 0x7fca99045300 140508127318784 rsi 0x1 1 rdi 0x120 288 rbp 0x7fc9d0104e40 0x7fc9d0104e40 rsp 0x7fc9d0104c70 0x7fc9d0104c70 r8 0x0 0 r9 0xc0 192 r10 0x0 0 r11 0x7fca1432b2e0 140505898988256 r12 0x7fc9c95e5d80 140504643558784 r13 0x800a0003 2148139011 r14 0x0 0 r15 0x7fc94537d198 140502426440088 rip 0x666831 0x666831 eflags 0x10206 [ pf if rf ] cs 0x33 51 ss 0x2b 43 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 st0 0 (raw 0x00000000000000000000

c++ - Namespace function linker error when used in multiple classes -

i writing function want use in code debugging without throwing exceptions. want defined variable debug_mode when set true causes function print given message , when set false prints nothing. want available class imports file without having create class, i.e. include "debug.h" , can call debug::log(string message). i read advantages of using namespace functions wrote such perhaps don't understand proper usage of namespace functions. when include header file namespace function in 1 class works great, when use in 2 classes in 2 different files linker error: error 1 error lnk2005: "void __cdecl debug::log(char const *)" (?log@debug@@yaxpbd0@z) defined in foo.obj... here code namespace functions: #pragma once #include <cstdio> // important: set true if want debug logging, false otherwise #define debug_mode true namespace debug { void log(const char* message) { if (debug_mode) printf(message); } void log(co

sql - MySQL LOAD DATA Error (Errcode: 2 - "No such file or directory") -

i trying load data table of mysql database, , getting error. load data local infile 'c:\users\myself\desktop\blah blah\load data\week.txt' table week; reference: this the path hundred percent correct, copied pressing shift , clicking "copy path as" , checked many times. so tips on appreciated . . my research: seeing this answer, tried changing c:\users c:\\users . did not work me. secondly, is there way use kind of relative path (rather absolute path) here? i don't know version of mysql using quick google search found possible answers both questions. below excerpts mysql 5.1 reference manual : the file name must given literal string. on windows, specify backslashes in path names forward slashes or doubled backslashes the local keyword affects file expected found: if local specified, file read client program on client host , sent server. file can given full path name specify exact location. if given relative path n

How to get MAC Address of device using Wifi in Android -

i want access mac address of phone using wifi. somehow not right. have written following code. context=this; setcontentview(r.layout.activity_main); try{ wifimanager wifi=(wifimanager)this.context.getsystemservice(context.wifi_service); wifi.setwifienabled(true); wifiinfo info=wifi.getconnectioninfo(); string address=info.getmacaddress(); if(address==null){ toast.maketext(context, "null", toast.length_long).show(); } else{ new asyncclass(mainactivity.this,address).execute(); } }catch(exception e){ toast.maketext(context, e.tostring(), toast.length_long).show(); } when run on phone, give me error "unfortunately application stopped" when run program on imulator, gives address null. please me rid of it. in advance. my manifest file below: <uses-permission android:required=&

php - Username MUST exist in database to create login -

i created login page of dreamweaver, , want make username field must match username in sql database in order create password. not familiar , unsure on need require existing username , add password username row in database. here php code created dreamweaver: connection database exists, know not present in below code. works fine normal registration page, don't want being able register. <?php if (!function_exists("getsqlvaluestring")) { function getsqlvaluestring($thevalue, $thetype, $thedefinedvalue = "", $thenotdefinedvalue = "") { if (php_version < 6) { $thevalue = get_magic_quotes_gpc() ? stripslashes($thevalue) : $thevalue; } $thevalue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($thevalue) : mysql_escape_string($thevalue); switch ($thetype) { case "text": $thevalue = ($thevalue != "") ? "'" . $thevalue . "'" : "null"

time - achartengine - timechart or linechart? -

i visualize achartengine series of measurements. have double values ​​in compare results , still string time. use line graph results , number. replace time number. unfortunately, not know how , find no suitable examples. edit okay, have found example , work. how can make flexible normal label? there plenty examples of using achartengine apis in official demo application. see these instructions in order figure out how download demo source code.

gruntjs - Disable tag completion in (grunt-contrib-)htmlmin -

i have rather typical php project in header/footer parts of pages reused , therefore placed in separate files require main file. this means, however, _header.php -file ends in open <article> tag (which "closed" @ beginning of _footer.php ). the problem htmlmin interprets error on part , adds closing article , body , html tags in _header.php . how 'disable' that? i've read through github pages of grunt-contrib-htmlmin and html-minifier without luck. my task config htmlmin: { dist: { options: { minifyjs: true, removecomments: true, collapsewhitespace: true }, files: { 'staging/index.php': 'index.php', 'staging/support/index.php': 'support/index.php', 'staging/inc/_header.php': 'inc/_header.p

c# - The name 'HttpUtility' does not exist in the current context (winform) -

iget following error: the name 'httputility' not exist in current context i building winform app code using framework 4 client profile , can't find system.web reference: string longurl = "https://test.com/currentaccount/pages/current.aspx"; var uribuilder = new uribuilder(longurl); var query = httputility.parsequerystring(uribuilder.query);//error query["ltfrom"] = fromdate; query["ltto"] = todate; query["ltfilterselected"] = "none"; uribuilder.query = query.tostring(); longurl = uribuilder.tostring(); what problem? httputility cannot accepted clientprofile - change .net version full.

c# - How Do You Programmatically Go To The End Of The A NotePad File If Opened By A Windows Form Application -

i creating windows form application , want user able open log file on request, after selecting option on menu strip. i can open file within notepad recent entries @ end of file. how make application start @ end of file save user job? my current code: public static void opencurrentlog() { process process = new process(); processstartinfo startinfo = new processstartinfo(); startinfo.filename = environment.getenvironmentvariable("windir").tostring() + "\\system32\\notepad.exe"; startinfo.arguments = environment.getfolderpath(environment.specialfolder.applicationdata) +"\\" appname + "\\" + "\\logfiles\\logfile.log"; startinfo.windowstyle = processwindowstyle.normal; process.startinfo = startinfo; process.start(); process.waitforexit(); } any appreciated. relatively new c#. if send ctrl (^) - end ({end}) through move bottom of notepad file se

python - submitting a form using mechanize, [TypeError: ListControl, must set a sequence] -

for instance, let take facebook signup page trying submit sign form : br.set_handle_robots(false) br.open('http://www.facebook.com/r.php') print br.response() f in br.forms(): print f br.select_form(nr=1) br['firstname']='watever' br['lastname']='kafle' br['reg_passwd__']='abhibandu' br['reg_email__']='watever@gmail.com' br['reg_email_confirmation__']='watever@gmail.com' br['birthday_month']='01' br['birthday_day']='20' br['birtday_year']='1990' br['sex']='2' br.submit() print br.response() q1)i getting "typeerror: listcontrol, must set sequence" error. doing wrong ? q2)p.s. can suggest how reload/refresh page everytime after form submission(like if want create multiple fb accounts) ? thanks in advance! here error message getting: traceback (most recent call last): file "c:\users\ninja\desktop

java - Import Ant project into Eclipse? -

Image
i new ant. have existing ant project , imported eclipse without issues. my actual project structure below outside eclipse: but after importing eclipse, can see src folder , build.xml , referenced libraries folder. not see other folders inside eclipse. web application , ear file created. do need convert project eclipse project see folders? eclipse:eclipse maven projects there command ant projects? please me. thanks!

html - create four box with hoverover feature -

i create 4 boxes (2 on top , 2 below it), have in centere of page when person hoverover box should move bit , change box colour. each boxes should contain text inside option1, option2, option3 , option4: 4 boxes: <div class="selectbox" > <div class="firsttwooptions"> <div class="foo" id="option1" style="background-color:green;"></div> <div class="foo" id="option2" style="background-color: black;"></div> </div> <div class="lasttwooptions" style="display:block; clear:both;"> <div class="foo" id="option3" style="background-color:yellow; "></div> <div class="foo" id="option4" style="background-color:blue;"></div> </div> </div> my css: .foo { float: left; width: 200px; height: 200px; m

MYSQL database deadlock between update and select command -

i getting deadlock situation in mysql db. select query waiting lock hold update query , update query waiting lock hold select query. pasting db deadlock logs below. please go through logs , tell me 1) why update command needs lock on table(server_registry) when updatinng 1 table(service_status) 2) why there deadlock bwteen select , insert command.both of them needs use different locks. select needs use read lock , update needs use write lock. please help. in advance. ------------------------ latest detected deadlock ------------------------ 140422 19:49:35 *** (1) transaction: transaction 58c06, active 1 sec starting index read mysql tables in use 2, locked 2 lock wait 5 lock struct(s), heap size 320, 4 row lock(s) mysql thread id 808, os thread handle 0x36fc, query id 707213 gemsoft 10.127.127.214 gemsoft sending data /* criteria query */ select this_.id id53_1_, this_.creation_date creation2_53_1_, this_.last_modified last3_53_1_, this_.server_registry_id server5_53_1_, t

wpf - How can I add a separator between tabs in a tabcontrol? -

i'm styling tabs displays header text want add separator between them. right tabs like: content1 content2 is there way can add separator between tabs looks like: content1 | content2 i can style vertical separator can't figure out how place in between tabs. don't want use tab border fake divider , stay away using <tabitem header="|" isenabled="false" /> fake too. there elegant solution this? this have far: <tabcontrol background="transparent" borderthickness="0"> <tabitem header="content1"> <!--content1--> </tabitem> <tabitem header="content2"> <!--content2--> </tabitem> <tabcontrol.resources> <style targettype="{x:type tabitem}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:typ

c# - IPagedList.MVC, set the total size? -

i building application using asp.net mvc 5 , have grid working ipagedlist.mvc version 4.5.0.0, automapper , entity framework. in project have businesslayer action talks to, don't want action method talk entity framework directly. bll has following method: public ipagedlist<activecontractviewmodel> getallcontracts(string regnumfilter, int page) { var lstcontractviewmodel = new list<activecontractviewmodel>(); using (activecontractrepository activecontractrepos = new activecontractrepository(new unitofwork())) { var activecontractlist = activecontractrepos.all.orderbydescending(x => x.id).include(c => c.contractor); if (regnumfilter.trim().length > 0) { activecontractlist = activecontractrepos.all.where(x => x.registrationnumber.contains(regnumfilter)).orderbydescending(x => x.id).include(c => c.contractor); } foreach (var activecont

angularjs - Dynamic class name ngRepeat root element -

i trying use model add class names each root element of ngrepeat. need each li have unique class name. there anyway this? class="{{item.clazz}}" <nav id="main-menu"> <ul> <li ng-repeat="item in menus[0].items" class="{{item.clazz}}"> <a class="dropdown-toggle" href="#" slidedown-toggle><i class="{{item.icon}}"></i><span>{{item.name}}</span></a> <ul class="dropdown-menu"> <li ng-repeat="link in item.items[0].items"> <a href="{{link.link}}">{{link.name}}</a> </li> </ul> </li> </ul> </nav> items: [{ title: 'about us', icon: 'icon-about', clazz: 'about-us-menu', items: [{ name: &

java - Regex to get rid of content after the first ">" -

regex rid of content after first ">" in string below. , putting whatever there after first ">" in string . eg: string input = <img alt="" src="http://abchdfgjd.com/-430.jpg" width="650" height="430" /> have seen <a href="http://www.funnyordie.com/between_two_ferns" target="_blank">between 2 ferns</a>? desired output: ans1 = <img alt="" src="http://abchdfgjd.com/-430.jpg" width="650" height="430" /> ans2 = have seen <a href="http://www.funnyordie.com/between_two_ferns" target="_blank">between 2 ferns</a>? can me ? unless misunderstand question, should (using indexof ) public static void main(string[] args) throws ioexception { string input = "<img alt=\"\" src=\"http://abchdfgjd.com/justin-bieber-ferns-650-430.jpg\" " + "width=\&

javascript - How to create a custom event listener for Respond.js -

i'm using respond.js ensure bootstrap 3 compatibility 1 of projects in ie8. i'm loading large css file respond.proxy.js. after css has been loaded , ripped respond, i'd have initialize jquery plugins rely on css. i'd able jquery $(document).ready() . is possible create custom event listener eg. $(respond).finished(...) gets called after respond has finished it's work? need initialize plugins in different scripts , files. since respond.js doesn't trigger events or provide way of applying callback function, option modify respond.js have trigger event. i suggest modifying line: https://github.com/scottjehl/respond/blob/master/src/respond.js#l298 if (requestqueue.length) { var thisrequest = requestqueue.shift(); ajax(thisrequest.href, function (styles) { translate(styles, thisrequest.href, thisrequest.media); parsedsheets[thisrequest.href] = true; // wrapping recursive function call in settimeout //

sql - Postgresql SELECT DISTINCT ON -

in query below i'm trying select data need distinct on columns book.title , orderdate. have tried using distinct on multiple results post below. sorry if question bit trivial. i'm in process of learning sql i'm bit of noob when comes obvious have missed. how change query results formatted so: month | title | quantity | total_value -----------+---------------------------------------------+----------+------------- february | internet , world wide web: how program | 15 | 899.70 march | c how program | 4 | 183.92 march | core servlets , javaserver pages | 13 | 856.70 march | internet , world wide web: how program | 21 | 1071.58 the query constructed: select distinct on (orderdate, book.title) book.title, to_char(orderdate, 'month') "order date", orderline.quantity "order quantity", (sum(quantity*uni

sql - SELECT maximum and minimum value from a table -

i trying fname , lname of person makes money , person makes least. i looking solution uses 1 query select fname, lname employees salary =51,000 , salary =$28,000; i tried figure out not. it using subqueries , having hard time figuring out. said use 1 query. select fname, lname, salary employees salary = (select min(salary) employees) or salary = (select max(salary) employees) edit: if know values of top/bottom salary, use this: select fname, lname employees salary =51,000 or salary =$28,000; emphasis on or.

mysql - how to get average of rows that have a certain relationship -

i have bunch of data stored pertaining county demographics in database. need able access average of data within in state of county. example, need able average of counties who's state_id matches state_id of county county_id of 1. essentially, if county in virginia, need average of of counties in virginia. i'm having trouble setting query, , hoping guys give me help. here's have written, returns 1 row database because of linking county_id of 2 tables together. select avg(demographic_data.percent_white) avg_percent_white demographic_data,counties, states counties.county_id = demographic_data.county_id , counties.state_id = states.state_id here's basic database layout: counties ------------------------ county_id | county_name states --------------------- state_id | state_name demographic_data ----------------------------------------- percent_white | percent_black | county_id your query returning 1 row, because there's aggregate , no group by. if w

algorithm - Solving the similar recurrence: T(n) = 3T(n/3) + n/3 -

given.. t(0) = 3 n <= 1 t(n) = 3t(n/3) + n/3 n > 1 so answer's suppose o(nlogn) .. here's how did , it's not giving me right answer: t(n) = 3t(n/3) + n/3 t(n/3) = 3t(n/3^2) + n/3^2 subbing t(n) gives.. t(n) = 3(3t(n/3^2) + n/3^2) + n/3 t(n/3^2) = 3(3(3t(n/3^3) + n/3^3) + n/3^2) + n/3 eventually it'll like.. t(n) = 3^k (t(n/3^k)) + cn/3^k setting k = lgn.. t(n) = 3^lgn * (t(n/3^lgn)) + cn/3^lgn t(n) = n * t(0) + c t(n) = 3n + c the answer's o(n) though..what wrong steps? t(n) = 3t(n/3) + n/3 t(n/3) = 3t(n/9) + n/9 t(n) = 3(3t(n/9) + n/9) + n/3 = 9t(n/9) + 2*n/3 //statement 1 t(n/9)= 3t(n/27) + n/27 t(n) = 9 (3t(n/27)+n/27) + 2*n/3 // replacing t(n/9) in statement 1 = 27 t (n/27) + 3*(n/3) t(n) = 3^k* t(n/3^k) + k* (n/3) // replace k log n base 3. t(n) = n t(1) + (log n) (n/3); // t(1) = 3 t(n) = 3*n + (log n) (n/3); hence , o (n* logn)

Apache Server .htaccess rewrite with wildcard -

is possible create rewrite code includes wildcard? for example request for: http://example.com/something1/something2/* would redirect to: http://example.com/newthing and will matter in .htaccess file place rewrites? this should work you: rewriteengine on rewriterule ^something1/something2/(.*)$ /$1 [r=302,l] it should change http://example.com/something1/something2/test http://example.com/test edit: rewriteengine on rewriterule ^shirts/(.*)$ /clothing.html [r=301,l]

Determining if users are facebook friends (Parsing) -

i'd find out if current user friends root node user, using koala, , if so, print statement saying: friends. problem parsing of data returned facebook. user.rb def facebook @facebook ||= koala::facebook::api.new(oauth_token) block_given? ? yield(@facebook) : @facebook rescue koala::facebook::apierror => e logger.info e.to_s nil # or consider custom null object end def facebook_friend facebook.get_connection("me", "friends/#user.user_id") end profile.html.erb <% if current_user.facebook_friend.include?(@user.uid)? %> <p> friends</p> <% else %> <p> not friends</p> <% end %> output: <%= current_user.facebook_friend %> will return: [{"name"=>"elizabeth", "id"=>"100008217009369"}] <%= @user.uid %> will return: 100008217009369 thanks!!! it easier thought: in user model simple used koala method: def fa

rest - Disable Hypertext Application Language (HAL) in JSON? -

using spring data rest jpa in version 2.0.2.release. how can disable hypertext application language (hal) in json ? http://stateless.co/hal_specification.html i have tried many things already, no avail. example, have set accept , content-type headers "application/json" instead of "application/hal+json" still receive json content hyper links. for example, i'd like: { "name" : "foo", "street" : "street bar", "streetnumber" : 2, "streetletter" : "b", "postcode" : "d-1253", "town" : "munchen", "country" : "germany", "phone" : "+34 4410122000", "vat" : "000000001", "employees" : 225, "sector" : { "description" : "marketing", "average profit": 545656665, "average employees": 75, "average profit per employe

ruby on rails - Upload image using paperclip, fog and rackspace -

i need upload logo image rackspace using fog & paperclip. paperclip::attachment.default_options.update({ :path => "images/:class/:id/:attachment/:style/img_:fingerprint", :storage => :fog, :fog_credentials => { :provider => 'rackspace', :rackspace_username => 'blablabla', :rackspace_api_key => 'blablabla', :persistent => false }, :fog_directory => 'blablabla', :fog_public => true, :fog_host => 'http://blablabla.rackcdn.com' }) i have settings in config/initializers/paperclip_defaults.rb but how initialize logo catch settings. please me in confusion here. you don't need initialize logo "catch" settings let me explain how works: paperclip creates entry db, , stores file on rackspace. accessing file, paperclip case of ensuring paperclip able load rackspace url correctly i this: #config/application.rb config.paperclip_defaults = {