Posts

Showing posts from May, 2012

java - How to save file as pdf -

Image
i have website that's not ready production yet. when user purchase product generating receipt. need want give option user save pdf. on click of icon receipt has downloaded. have no idea this. here sample receipt: on click of "save pdf" need download receipt. can me in this. your problems can broken down following pieces. when user clicks "save pdf" generate pdf: itext comes handy in doing (its free & open source). here example of generating tabular data in pdf. there tons of example itext download pdf. once pdf generated, same can send user via response object file. here example of downloading text file. same can used downloading file. hope helps.

php - Unable to insert data -

i newbee codeigniter , php. trying insert data using form , display on same view page using mvc pattern given codeigniter. view is: <html> <head> <title>my form</title> </head> <body> <? echo form_open('books/input'); ?> <? echo $id; ?>: <? echo form_input('id'); ?> </br> <? echo $title; ?>: <? echo form_input('title'); ?> </br> <? echo $body; ?>: <? echo form_input('body'); ?> </br> <? echo form_submit('mysubmit','submit!'); ?> <? echo form_close(); ?> </body> </html> and controller is: <? class books extends controller{ function books(){ parent::controller(); } function main(){ $this->load->model('books_model'); $data = $this->books_model->general(); //$this->load->view('books_main',$data); } ...

Drools: using rule "exists" for a Map(Scala) -

i have class "records" has map[string,double](scala) attribute "payorders" , want find out whether map contains value larger 50. rule wrote this: rule "user1" dialect "mvel" no-loop when $user:records($pay:payorders.values) exists(number(doublevalue > 50) $pay) system.out.println("user1") end the problem there no error rule doesn't work! no outputs. then, tried print $pay . output $pay:maplike(300.0) . first thought drools can't analyze type, revised $user:records($pay:payorders.values) $user:records($pay:payorders.values.tolist) . still prints nothing. seems once added exists line, rule don't work. can me? thanks!

php filter_var fails with zero on FILTER_VALIDATE_INT -

i'm confused following throws exception: if (!filter_var(0, filter_validate_int)) throw new exception("non numeric field passed " . $field . " when expecting number: " . $variable . " passed instead"); anything positive works fine? i've tried intval(0) , still nothing. 0 not integer? filter_var returns filtered data , or false if filter fails. filter_var(0, filter_validate_int) returns int(0) , , falsy value, !filter_var(0, filter_validate_int) true.

java - How to programmatically change the background image of an Android Activity -

i have been able change colour of activity background (see this post ). requirement same background image. mean can click button, select option , change current activity background image new one. here have done: private sharedpreferences prefs; private static final string selected_item = "selecteditem"; private editor sharedprefeditor; btnchangecolor = (imagebutton) findviewbyid(r.id.btnchangecolor); btnchangecolor.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { final charsequence[] items={getstring(r.string.default),getstring(r.string.pix1), getstring(r.string.pix2))}; alertdialog.builder builder = new alertdialog.builder( contentview.this); builder.settitle((getresources().getstring(r.string.color_switch))); builder.setpositivebutton((r.string.ok), new dialoginterface.onclicklistener() { @override public void onclick(dialoginterface dialog, int which) { } }); ...

php - How to get upload image for particular user -

database tables: [a].registationform [b].login total file (1)registrationform.php (2)login.php (3)profile.php in file details: (1)html fields: upload profile picture , other details. (2)username, password only registrated user allow use of session problems: (3)profile.php display details own picture. how can get picture form "registrationform" table . dbtable olny image name there , file in upload folder. my query $order = "select * `registrationform` user_id='$id'"; $result = mysql_query($order); while($data = mysql_fetch_row($result)) { echo("<tr><td>fistname:$data[1]</td></tr> <tr><td>lastname:$data[2]</td></tr> <tr><td>image:$data[5]</td></tr>"); } can give me suggestion thank you. you may use following statement:---- $order = "select * `registrationform` user_id='$id'"; $result = mysql_query($o...

python - Django belong to field or parents field -

i'm using django 1.6 , trying make field parent field , parent field can have several children field? i make db containing drop down list contains (computer, scanner, printer ) if user choose computer , can added things related such monitor .. is possible make django? yes, possible. need use foreignkey task. example: # models.py django.db import models class gadget(models.model): """ model you'll add gadgets computer, printer, etc. """ name = models.charfield(max_length=100) class property(models.model): """ model adding monitor, etc. gadgets models. """ gadget = models.foreignkey(gadget) property = models.charfield(max_length=100) something_else = models.charfield(max_length=100)

How to create a regex in ruby to (1)filter out everything after a string and to (2) filter something in the middle of a line? -

case 1: consider line: [2014-03-05 17:21:39 -0800] this.computer.name - select file: f7de1.png i need filter out after "select file: ". in need filename sentence above. case 2: consider line: [2014-03-05 17:21:39 -0800] this.computer.name - cycle: 12345 file: f7de1.png i need filter cycle number here, 12345 for both these cases here, filename can different lengths different cycles. first case: str = "[2014-03-05 17:21:39 -0800] info this.computer.name - select file: f7de1.png" str[/file: (.+)/, 1] => "f7de1.png" second case: str = "[2014-03-05 17:21:39 -0800] info this.computer.name - cycle: 12345 file: f7de1.png" str[/cycle: (\d+)/, 1] => "12345"

javascript - How to get url for D3.json dynamically using input tag type=file? -

am using d3.js input json file , graphically plot it. here's js required: function loadjson(url) { d3.json("url", function(data) { dataprocessor(data); }); } here's html required: <body> <div><h1>chart 101</h1></div> <input id="source" type="file"> <button id="clickhere" onclick="loadjson()">click here</button> <script src="../js/d3.v3.min.js"></script> <script src="../js/chartfactory.js"></script> </body> bascially d3.json requires url of file selected . check here since mozilla doesnt allow path visible using "inputid.value",i cant seem move forward this. is there solution or work around this? it not possible file full path on client machine using browser , javascript. have upload file server using form , file.

ios - Reference view controller from custom UITableViewCell class -

i have class called magradecell that's custom uitableviewcell class. before had class , setting cell inside view controller ( macontroller ), configureheadercell 'd self (which resolved viewcontroller. now have custom class uitableviewcell , can't refer viewcontroller self . mean should alloc , init new viewcontroller? or have super or import viewcontroller , interface property or something? try this, in magradecell.h typedef void (^yourcallback)(magradecell *cell); //you may or may not use cell parameter according need create property @property (readwrite, copy) yourcallback callback; in magradecell.m - (void)someaction { if (self.callback != nil) { self.callback(self); } } in cell configuration method magradecell *cell = .... ..... cell.callback = ^(magradecell *gradecell) { //do stuff };

java - how to make List of of mutable objects Immuatable -

hi asked interview question have list of objects in immutable class, class immuatable, can modified , how can prevent it. gave below solution. public final class a{ final list<b> listofb; // b mutable public list<b> getlistofb(){ return collections.unmodifiablelist(this.listofb); } } now says after getting getlistofb() can change 'b' instances , wanted me avoid also. said. public list<b> getlistofb(){ list<b> ret; for(b b: this.listofb){ ret.add(b.clone()); // make deep copy of 'b' return list } return ret; } the interviewer did not respond saying right or wrong. this solution definately works. there better way of doing it, approach clumsy , requires additional memory. ps: assume b cannot made immutable. assuming b interface or implementation of interface a , wrap each element of listofb using java.net.proxy of b or a respectively, intercepts modifying calls throwing unsupportedope...

webview - Xposed hook onto Android resource -

i trying use xposed on android hook onto android resource, in particular, webview's loadurl. code below hooks onto loadurl , if successful, prints message onto log. findandhookmethod("com.example.webview.mainactivity", lpparam.classloader, "android.webkit.webview.loadurl", new xc_methodhook() { @override protected void afterhookedmethod(methodhookparam param) throws throwable { xposedbridge.log("we in loadurl!"); } however, doing throws error: java.lang.nosuchmethoderror: android.webkit.webview#android.webkit.webview.loadurl()#exact is possible hook onto android resources xposed? you use "hookallmethods" xposedbridge.hookallmethods("com.example.webview.mainactivity", "loadurl", new xc_methodhook() { @override protected void afterhookedmethod(methodhookparam param) throws throwable { xposedbridge.log("we in loadurl!"); }...

java - Error: Data source rejected establishment of connection, message from server: "Too many connections" -

i created application writes data database every 5 minutes. however after time error appears: error: data source rejected establishment of connection, message server: "too many connections" i've been searching around , tells close connection database after every request side. i tried this: conexao.close(); but gives me error: no operations allowed after conection closed. i apologize if question not formulated. thanks help ---------------------what tried didn't work--------------------------- add finally{ if(conexao!=null) conexao.close(); } class.forname("com.mysql.jdbc.driver"); connection conexao = (connection) drivermanager.getconnection("jdbc:mysql://localhost/bdteste", "root", "root"); statement stm = conexao.createstatement(); bufferedreader reader = new bufferedreader(new filereader("c:/users/rpr1brg/desktop/test.txt")); string dados[]...

haskell - As OOAD is to OOP what is the equivalent for functional programming? -

i've forayed world of functional programming (fp) , wondering how "think functionally" moderately sized applications? w.r.t. analysis , design of fps. with oop we're trained think in terms of objects, attributes , relations. model our analyses/designs using class , sequence diagrams. however, same models seem bad fit when designing fps. equivalent modeling paradigms functional programming? seems dfds maybe fit maybe wrong. for example: thinking of designing simulation of monopoly, board game using haskell, learn language. when doing ooad come classes board contains items have attributes/methods attached it. have player , various other objects , associated relations can captured in class diagram. , interactions in sequence diagram. however, these modeling paradigms doesn't seem transfer functional programs. "how" model functionally ? note: i'm looking concrete references/examples can explain how analyze , design functional programs given ...

java - How to zip files from my result? -

this question has answer here: creating zip archive in java 7 answers i need know how can zip files result, files older 30 jan in folder , need zip them, can do?? please see code: package agefilefilter; import java.io.file; import java.io.filefilter; import java.io.ioexception; import java.util.date import java.util.gregoriancalendar; import org.apache.commons.io.filefilter.agefilefilter; public class agefilefiltertest { public static void main(string[] args) throws ioexception { file directory = new file("c:\\users\\kroon_000\\desktop\\files"); gregoriancalendar cal = new gregoriancalendar(); cal.set(2014, 0, 30, 0, 0, 0); // january 30th, 2014 date cutoffdate = cal.gettime(); system.out.println("\nbefore " + cutoffdate); displayfiles(directory, n...

ruby - String manipulation using MD5 in rails 3 -

i have big string approx 4000 characters i want encrypt , decypt using md5 because of want convert in small string please me lot of finding found base64 not our solution please 1 me my_string="abcdefghhhhhhhhhhhhhhhhhhhhhh" base64.encode64(my_string) it gives lengthy string. encrypting string not make smaller, @ best same length. think looking way compress string. aside, md5 one-way hashing algorithm, means designed, there way of recovering source string (it turns out designed rather poorly ).

apache - Website in lan with virtual host? -

i have specefic problem, have more websites on localhost server (xammp), has virtul host, want access websites trough lan or wlan because can test on mobile devices. if call ip on other device see xammp control panel, don't know how can call websites in lan like: "site1.local, site2.local, site3.local", here static ip's needed? on router dhcp enabled. read few topics , clear me, problem access on sites trough network. read topics: how set apache virtual host such http://home/, http://office/, etc accessing localhost (xampp) computer on lan network - how to? how set apache virtual host such http://home/, http://office/, etc apache: see named virtual hosts lan find ip of server machine. if uses windows, press start type search bar cmd. when command promt comes type in ipconfig , hit enter. "ipv4-address" , right of local ip of computer. then can use computer on wireless lan or wired connection. type in ip of computers local ip xamp, , go!...

php - Laravel and Twitter API - Any suggestions on how to post tweets? -

recently started looking laravel 4 , wanted make little application post tweets me. can't seem find library though, or perhaps not using them properly. does have suggestions on twitter api library use laravel, , how use it? there tutorial using thujohn/twitter-l4 package. the tutorial can found here: http://creative-punch.net/2014/02/post-random-tweets-laravel-twitter-api/ it goes in-depth on using library create application post random tweets laravel 4 , should cover asked for.

Windows explorer force excel to import -

i want add context menu item windows explorer (windows 7) in order import selected file excel , start import dialog. i managed add entry following guide: http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/ but when opens file, import dialog skipped , file opened in spreadsheet. edit: searched exe switches, ones found kind of useless this! edit2: more background asked electricllama extra background: need import lot of text files excel. not csv fixed width, sure change in immediate future. i'm opening them convert them , add information columns. program x generates table white space spacing ----> excel format table , add information ----> program y opens excel file directly so made option in windows registry (using regedit) have launch python script handle parsing , calling excel.exe. file type files without extension , python in path windows variable. regedit export escapes quotes (if wondering that): wi...

extjs4.1 - Extjs form populating with grid record -

i'm trying grid record data through loadrecord(record). double clicking on record opens new window. want record data displayed in text field of form. var fg1 = ext.create('ext.form.panel', { title: 'grid selection', hieght: 500, width: 500, margin: 20, xtype: 'container', layout: 'fit', items: [{ xtype: 'grid', itemid: 'grid1', seltype: 'rowmodel', store: store, listeners: { //afterrender: function(win) //{ handler: function (rowmodel, record, index, eopts) { var u = this.getrecord(); u.applytofields(record); loadrecord(record); } }, listeners: { itemdblclick: function (view, record...

c++ - OpenCv Error in C Wrapper for imread: QNativeImage: Unable to attach to shared memory segment -

here code running. i'm using ubuntu trusty g++ in emacs. i'm getting errors @ bottom of page use figure them out. program works, uses c wrappers imread , imshow above main in code. picture comes right after window opens long string of code below...it must wrappers because c++ imread , imshow work perfect..the wrappers written software analyst though inclusion in opencv i'm not sure issue is. googling brings vlc, ubuntu, , qt bugs none opencv. wrappers made other languages wrap around , cv_imread isn't working. reason decided debug running them. discovered this. rebuilt , reinstalled opencv 1 of steps got same message. appreciated. #include "opencv2/highgui/highgui.hpp" #include "opencv2/highgui/highgui_c.h" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/imgproc/imgproc_c.h" #include <iostream> using namespace cv; using namespace std; mat* cv_imread(string* filename, int flags) { return new m...

java - Get loading percent from InputStream .read method -

i have problem in parsing inputstream , getting loading percentage of data. mean, method needs parse inputstream, put stringbuffer, total of bytes parsed , returns string based on stringbuffer. private string processpercent(inputstream content, httpresponse response) throws ioexception { inputstream in = content; int totalbytes = integer.parseint(response.getfirstheader("content-length").getvalue()); int processedbyte; int loaded = 0; stringbuffer sb = new stringbuffer(); while((processedbyte = in.read()) != -1) { sb.append((char) processedbyte); if(this.asynctask instanceof iprogresspercent) { lastprocessed = processedbyte; loaded += processedbyte; float percent = ((100*loaded) / totalbytes); this.progresspercent = (int)percent; this.asynctask.doprogress(this.progresspercent); } } in.close(); return new string(sb); } the problem wh...

Delphi win32 application to work with Oracle -

i have create win32 client on delphi, can work database on oracle. problem task client have demand "zero administration". in other words user downloaded our site , ran without installing oracle client , tuning tnsnames.ora. my first aproach install apache on server side connection oracle. our win32 client case web brouser works oracle via https. it works performance not expected. delay in reaction between clent , server side long. is there way acheve goal (zero adminstration client enough performance)? the product odac (oracle data access components) devart has "no oracle client needed" mode. easiest solution. include oracle instant client product , use oracle's "ezconnect" syntax don't have configure on client. using ezconnect allows connect oracle database without using tnsnames.ora file.

maven - Missing artifact org.primefaces.themes:cupertino:jar:1.0.9 -

i'm working on project using liferay 6.1.1 , maven! have error message in pom.xml: missing artifact org.primefaces.themes:cupertino:jar:1.0.9 even if jar file there! when tried deploy project, goes ... warning persists if project works good. idea? pom.xml <?xml version="1.0"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <groupid>com.octave.portlet</groupid> <artifactid>octave-portlet</artifactid> <version>2.0.0</version> <relativepath>../pom.xml</relativepath> </parent> <modelversion>4.0.0</modelversion> <groupid>com.octave.portlet.presentation</groupid> <artifactid>octave-presentation-portlet</artifactid> <packaging>war</packaging...

Always prefix a Django form -

i know prefix argument can pass while instantiating form. requirements different. i have 2 forms this class twitterform(forms.form): friends = forms.charfield(...) class fbform(forms.form): friends = forms.charfield(...) they present together, means can guarantee need prefix them. there way add prefix @ class level rather @ object creation time. override __init__() , add keyword argument before calling parent's method.

sql server 2008 r2 - MSSQLSERVER agent from Services.msc -

quick question conversation colleague, restart things mssqlserver agent sscm, colleague asking difference starting restarting service services.msc. it never occured me if there impact restarting service here opposed sql server configuration manager, best practise thing? sql server 2008 r2 on windows server 2008 r2. thoughts on if there any adverse effects starting/restarting services.msc? thanks in advance andy it best practice. restarting through windows services work may lead slippery slope. using sscm out of habit helps avoid temptation make changes services through windows services registry settings may out of sync.

hibernate - HQl query to get week of the year -

i need make following mssqlserver query gets number of changes made in current weeek select count(1) audit_tbl datepart( wk, action_time)=datepart( wk,getdate()) i strucked functiondatepart( wk, action_time)=datepart( wk,getdate()) there equivalent in hql. also there way date(2014-03-24) part 2014-03-24 20:56:26.297 in hql update: select dateadd(day,datediff(day,0,action_time),0) actiondate, count(1) total server_tbl year(action_time) = year(getdate()) group dateadd(day,datediff(day,0,action_time),0) it gives records group actiontime(stored in db timestamp) i don't think there week() function in hql. , cannot mix hql , sql. therefore, can either use sql query or switch criteria queries , implement own sqlcriterion produce exact sql fragment want (see javadoc here ) update: option missed extract() function. first, must configure hibernate use sqlserverdialect (or 1 of subclasses). extract function translated datepart in sql , following clause should...

java - All textView are modify in Custom ListAdapter after AlertDialog -

i fill arraylist <'hashmap <'string, string>> asynctask , set adapter custom adapter , , creat each view in getview() . until here , works. pet listener on linear_layout open alertdialog edittextfield. , when want change textview after have clicked , textview change , when scrool , come , start value (that in asynctask) appear. it's if value not save @ position. this getview() method : @override public view getview(int position, view convertview, viewgroup parent) { if (convertview == null) { holder = new customlistingcrossholder(); convertview = m_inflater.inflate(r.layout.list_type_tournee, null); holder.miscellaneous = (textview) convertview.findviewbyid(r.id.miscellaneous); holder.infos = (textview) convertview.findviewbyid(r.id.infos); holder.linear_divers = (linearlayout) convertview.findviewbyid(r.id.test); convertview.settag(holder); } else { holder = (customlistingcrossholde...

android - Wowza Media Server Live Video Streaming Delay for IOS devices? -

wowza media server running live video streaming. when view live video using rtmp , hls streaming using wowza examples has live video players flash , ios. able view video both whenever camera moved rtmp url shows live video without delay hls stream shows delay of 10 seconds. then tried running mobile application using cordova(phonegap) ios devices. using html video tag in cordova application , able view live video on ipad simulator using hls streaming whenever camera moves there delay of 25 seconds while viewing live video on ipad. can please let me know configuration needs done on wowza server side reduce delay in live video streaming ios devices? and can please advice other player other html video tag cordova application? three chunks required ios devices streaming begin. each chunk set 10 seconds default.if use keyframe interval of 1 frame per second can lower cupertinochunkdurationtarget 1 second(1000) , latency down closer 3 seconds. please check here more : ...

excel - Combobox does not open dropdown list -

suddenly during work got problem 1 userform in excel. comboboxes on userform not open more if click on arrow show list. they filled values programmatically. if enter text in combobox, selects correct entry. it working fine before. added button userform. why can't open dropdownlist more? i tried change 'showmodal'-property if userform false, did not help. if want see, here code fills comboboxes: with frmplanselect.cbxlist .clear until rs.eof .additem .column(0, i) = rs.fields("id_item") .column(1, i) = rs.fields("name") = + 1 rs.movenext loop end thank hint! ok, after closing excel , opening makro workbook again, comboxes worked again. still not know caused behaviour because work interrupted suddenly. but, ok now.

Java: Json in a Heroku project -

i'm exploring simple way: creating simple server: public class simpleserver { public static void main(string args[]) { serversocket s = null; printwriter writer = null; bufferedreader reader = null; try { s = new serversocket(9999); system.out.println("server started, listen on " + "port 9999"); } catch (ioexception e) { e.printstacktrace(); } while (true) { try { socket s1 = s.accept(); outputstream s1out = s1.getoutputstream(); bufferedwriter bw = new bufferedwriter (new outputstreamwriter(s1out)); bw.write("hi client, server!"); system.out.println("messagge sent " + s1.getinetaddress()+"--"+ s1.getinputstream()+"--" ); bw.close(); s1.close(); } catch (ioexception e) { e.printstacktrace(); ...

django - Filtering related objects for each item in a queryset -

i have model (we'll call 'item') can tagged users. tags specific each user. so, example, item can have multiple tags multiple users. need display list of items user. within list i'd able show tags each item logged in user owns. i'm hoping there easy way of achieving this, i've been unable find helpful in docs. in advance. class item tags = manytomanyfield('tags.tag') class tag user = foreignkey('auth.user') so collect queryset of items display on page, , list through them in template. i'd able show tags owned logged in user each item in queryset. {% item in items %} {% tag in item.tags %} display tags owned logged in user {% endfor %} {% endfor %} this i'd achieve ^ one approach add property item class, user_tags can set in view , filter tags match logged in user. # models.py class item(models.model): ... user_tags = [] ... # views.py items = item.objects.all().selec...

oop - Char passing in C++ with pointers -

im having unclear image of pointers , char passing functions. please can tell me im doing wrong , brief idea pointers?ex : should use them, etc... #include <iostream> using namespace std; class book{ private: char *cname; int cfee; int nopeople; int income; public: void setdata(char &x,int y,int z){ cname = &x; cfee = y; nopeople = z; } void calincome(){ income = cfee * nopeople; } void viewincome(){ cout<<income; cout<<cname; } }; int main(){ book b1; b1.setdata('dise',20000,30); b1.calincome(); b1.viewincome(); } im getting error in code //b1.setdata('dise',20000,30); "non-const lvalue reference type 'char' cannot bind temparory of type 'int'" you should change setdata() declaration void setdata(const char *x,int y,int z) as you're doing expecting reference single char parameter, canno...

android - how to get toggle button on when it set text as on -

how toggle button on when set text on.it displaying text changed green light not coming when set. edittext=(edittext)findviewbyid(r.id.device_text); light=(togglebutton)findviewbyid(r.id.light); alarm=(togglebutton)findviewbyid(r.id.alarm); db = new databaseadapter(this); intent = getintent(); if(i.hasextra("dname")) val = i.getstringextra("dname"); if(i.hasextra("dlight")) slight=i.getstringextra("dlight"); if(i.hasextra("dalarm")) salarm=i.getstringextra("dalarm"); log.v("___edit class____________", "__light text_____________"+slight); log.v("_____edit class_____________", "___alarm text____________"+salarm); //edittext.settext(val); if(i.hasextra("daddress")) pos=i.getstringextra("daddress"); log.v("___________edittext", "_______________"+edit...

installation - Windows 8.1 freezes while installing WP8 SDK -

i installing wp8 sdk *.iso image visual studio 2012 , on final installation step (wp8 emulator configuring) after 20-30 minutes pc freezes cant anything. image on screen remains motionless , can turn mu pc off unplugging power source. here pc stats: amd fx-8350 4ghz 8core gigabyte ga-990fxa-ud3 motherboard 8gb of ram gtx 460 1gb i had same "issue" when installed wp8 sdk, downloads lot of data, can take hours finish installation. had wait 3hrs finish it, don't worry, patient. here, @ link , size of package 1.6gb (english version).

Postgresql gist index is not hit -

i using postgresql version 9.3. i learned normal b-tree indexes can not used queries 'x%x%x' wildcards , find gist , gin indexes make wildcard queries hit index. so decided use indexes , added btree-gist extension using command in postgresql; create extension btree_gist; after added gist index table , ; create index ix_bras_interface_name on bras_interface using gist (name); after added this, see added; table_name | index_name | column_name ----------------+-------------------------------------------+------------------- bras_interface | bras_interface_context_id | context_id bras_interface | bras_interface_domain_id | domain_id bras_interface | bras_interface_managed_object_id | managed_object_id bras_interface | bras_interface_name_59ec675d0b9537ac_uniq | context_id bras_interface | bras_interface_name_59ec675d0b9537ac_uniq | name bras_interface | bras_interface_name_i...

jquery - Selecting nth level child to manipulate width of the DIV -

i'm working on zoom-in , zoom-out section of site. issue i'm facing i'm not being able <div> class=product-view . below html code have: <div id="tabs-1" aria-expanded="true" aria-hidden="false"> <div class="drag-drop-box ui-droppable"> <div class="component ui-draggable dropped" style="position: relative;"> <div class="product-view"> <a href="#"><span>c</span> us-east-1c</a> </div> </div> </div> </div> and jquery code i'm using: $("#zin").click(function(){ var wid = $('div[aria-hidden="false"]').width(); var getid = $('div[aria-hidden="false"]').attr('id') alert(wid); alert(getid); $('#'+getid > div > div).children('.product-view').css('width','90px'); }); can...

Returning max value in a DC.js / Crossfilter group -

i wondering how return max value dc.js group. for example: var datedim = data.dimension(function(d) {return d.page_id;}); var hits = datedim.group().reducesum(function(d) {return d.commodity_id;}); this return bar chart plotting page_ids on x axis, against commodity_ids on y axis. however, return amount of commodity_ids on particular page on y axis. would accomplished similar max , min dimension functionality? var mindate = datedim.bottom(1)[0].page_id; var maxdate = datedim.top(1)[0].page_id; apologies if description unclear. thanks i'll attempt @ least point in right direction. the following lines of code return sum of commodity_id 's grouped page_id : var datedim = data.dimension(function(d) {return d.page_id;}); var hits = datedim.group().reducesum(function(d){return d.commodity_id;}); if page had 3 commodities following commodity_id 's: [ 1, 2, 5 ] reducesum return value 8 page (1+2+5=8); add each subsequent commodity...

loops - While process is not running, do something -

while ps aux | grep '[/]pathtoprocess' echo running done echo process finished i use shell script keep running while process running. same while process not running. how go it? in advance x=$(ps aux | grep '[/]pathtoprocess') while false echo not running done ========================================================================== new script #!/bin/ksh if ps -aux | grep "[/]$1" echo "running" else echo "not running" #do stuff # can add while loop here #echo "process finished fi output: ./icheck.sh xyz not running ./icheck.sh usr/bin/cron running

Implementing Hierarchical Roles in Spring Security -

i trying implement hierarchical roles in spring security , added following configuration in xml files per spring source documentation. <bean id="rolehierarchy" class="org.springframework.security.access.hierarchicalroles.rolehierarchyimpl"> <property name="hierarchy"> <value> role_admin > role_pro role_pro > role_premium role_premium > role_basic role_basic > role_anonymous </value> </property> </bean> <bean id="rolevoter" class="org.springframework.security.access.vote.rolehierarchyvoter"> <constructor-arg ref="rolehierarchy"/> </bean> i have tried above lines getting access denial while role_admin trying access url assigned role_basic. need add more this. found nothing other lines in spring site. also, if know of implementation of hierarchical roles, please menti...

java - Interface implementation access modifier not as expected -

i came across example of interface implementation can't head around, text not having reasoning the answer on here can lend hand. given interface interface flyer{ void takeoff(); boolean land(); } then suppose have implementation follows class aeroplane implements flyer{ public void takeoff(){ ... } //insert code here return true; } } the code insert given public boolean land(){ , states following incorrect boolean land(){ why need have public when interface has defined method package-private , surely boolean land(){ should implement interface, or have missed something? "the interface has defined method package-private" all methods declared in interfaces public definition. there no way around this. this interface flyer{ void takeoff(); boolean land(); } is equivalent this interface flyer{ public void takeoff(); public boolean land(); } this illegal : interface flyer{ private void takeof...

Converting JSON to array key - value in javascript -

i've been developing web application i'm receiving data in format, node server: "{""elements":[{"10sr2b2":{"total":0,"bad":22,"clients":["fc8e7f","fc8e7e"],"zone":"101900"}}]}" the poblem data array key-value called "elements" "10sr2b2" key of first element of array. so when call $.parsejson() method, return object this: elements: array[1] 0: object 10sr2b2: object zone: "101900" clients: array[2] 0: "fc8e7f" 1: "fc8e7e" length: 2 __proto__: array[0] bad: 22 total: 0 where "10sr2b2" it's supposed key , it's object , need value somehow. can me? you use object.keys object keys. var keys = object.keys(data.elements[0]);

actionscript 3 - How to make a custom added datagrid child scrolls with its parent? -

i'd know if possible make custom datagrid child scrolls parent. i've added mx datagrid custom components childs. when scroll datagrid vertically or horizontaly, added children not move datagrid cells. it simple solve, needed put component in mx:canvas e set scrollbarposition same mydatagrid scrollbarposition. ;)

sql - How to count one column, having a condition where an element is null and another where the element is not null? everything grouped by another element -

i have count 1 column 2 condition resulting 2 columns, grouped column. i'll show you: select cy.name, count(noa.gz_aparat_id), count(noa.gz_aparat_id) gz_nominalizare_aparat noa inner join gz_nominalizare no on (no.gz_nominalizare_id = noa.gz_nominalizare_id) inner join gz_acordacces aa on (aa.gz_acordacces_id = no.gz_acordacces_id) inner join gz_abonament ab on (ab.gz_abonament_id = aa.gz_abonament_id) inner join gz_punctconsum pc on (pc.gz_abonament_id = ab.gz_abonament_id) inner join gz_iu iu on (iu.gz_punctconsum_id = pc.gz_punctconsum_id) left outer join c_bpartner_location bplo on (ab.c_bpartner_location_id = bplo.c_bpartner_location_id) left outer join c_location lo on (bplo.c_location_id = lo.c_location_id) left outer join c_city cy on (lo.c_city_id = cy.c_city_id) group cy.name firt count must contain counts of noa.gz_aparat_id iu.gz_datapif null , second count iu.gz_datapif not null not sure if syntax quite right oracle it's n...

c# - The type '...' has no constructors defined -

i'm noticing compiler error the type '...' has no constructors defined generated when erroneously attempt instantiate particlar class. it lead me wonder how go writing own class precipitate message when attempted instantiate it. so code below, need myclass ? namespace mynamespace { class program { static void main(string[] args) { myclass mc = new myclass(); } } class myclass { myclass() { } } } this error ( cs0143 ) occurs if class defines internal constructor , try instantiate assembly. public class myclass { internal myclass() { } }

c# - Setting SelectedValue of DDL on PageLoad using value saved in Session Variable -

i'm trying set selected value of dropdownlist on page_load using value saved session variable. dropdownlist populated , value stored along other info in session. i'm creating edit entry page , want have of fields populated info session . what i've done populate textbox session variables, advisors section need user enter number instead of name. need use dropdownlist make sure information entered accurately. i've looked methods of databinding, databound, using data source , etc seemed of dropdownlists generated dynamically. appreciated. my .aspx code: <asp:textbox runat="server" id="fname" maxlength="100"></asp:textbox> <asp:dropdownlist id="advisors" runat="server"> <asp:listitem value="">select advisor</asp:listitem> <asp:listitem value="2">joe schmo</asp:listitem> </asp:dropdownlist> code behind: p...

java - How to show Image in Panel using button press action -

i want show image on panel press button. create code jbutton btnnewbutton = new jbutton("next"); btnnewbutton.addactionlistener(new actionlistener() { public void actionperformed(actionevent arg0) { if(i<files1.length){ bufferedimage bi; try { bi = imageio.read(new file(""+files1[i])); system.out.println(files1[i]); jlabel label = new jlabel(new imageicon(bi)); panel_1.add(label); panel_1.repaint(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } else system.out.println("end of picture"); i++; } }); but after click button image doesn't show. but after click button image doesn't show. looks missing r...

java - How to use Timestamp constructor -

i want use default constructor timestamp class in java eclipse indicates deprecated . constructor: timestamp mydate = new timestamp(2014, 3, 24, 0, 0, 0 ,0); eclipse recommends using timestamp(long time) default constructor don't know how use it. what next method ? int myyear = 2014; int mymonth = 3; int myday = 24; timestamp ts = timestamp.valueof(string.format("%04d-%02d-%02d 00:00:00", myyear, mymonth, myday)); using jsr 310: date , time api (introduced in java se 8 release ): java.sql.timestamp ts = java.sql.timestamp.valueof( java.time.localdate.of(myyear, mymonth, myday).atstartofday() );

javascript - Sort array containing DOM elements according to their position in the DOM -

context i've structured jquery plugin i'm working on in way has me storing dom elements in array, being able store more information next these elements without having use not-so-fast data() . that array looks like: [ { element: domelement3, additionaldata1: …, additionaldata2: … }, { element: domelement1, additionaldata1: …, additionaldata2: … }, { element: domelement2, additionaldata1: …, additionaldata2: … }, ] the way plugin works prevents me pushing these elements array in predictable order, means domelement3 can in fact find @ index lower domelement2 's. however, need these array elements sorted in same order dom elements contain appear in dom. previous example array, once sorted, this: [ { element: domelement1, additionaldata1: …, additionaldata2: … }, { element: domelement2, additionaldata1: …, additionaldata2: … }, { element: domelement3, additionaldata1: …, additionaldata2: … }, ] this is, of course, if domelement1 appear...

linux - Sending sound over Network Ubuntu and C -

i trying send sound microphone on network in c kind of networked baby monitor. have got server recording sound life of me cannot play on client side. code horrible mess , appologise have far server int main (int argc, const char * argv[]) { printf("server\n"); int server_sock_fd; //file descriptor server socket int client_sock_fd; //file descriptor client socket socklen_t server_len, client_len; struct sockaddr_in server_address; struct sockaddr_in client_address; //remove old sockets , re-create unlink("server_socket"); //obtain file descriptor socket server_sock_fd = socket(af_inet, sock_stream, 0); //name socket , set properties server_address.sin_family = af_inet; //this internet protocol server_address.sin_addr.s_addr = htonl(inaddr_any); //accept address (note conversion function) server_address.sin_port = htons(9734); //remember us...