Posts

Showing posts from April, 2010

javascript - Database every row in different div -

i try make every row in database different div. doesn't work when try run it, gives me 2 letters. checked php , works correctly. var request = new xmlhttprequest; request.open('get' , 'myurl', false); request.send(); console.log(request); if (request.status == 0) console.log(request.responsetext); var firstname, lastname; var obj = json.parse(request.responsetext); console.log(obj); (var = 0; i<obj.length; i++){ firstname = obj[i].firstname; lastname = obj[i].lastname; console.log(firstname,lastname); var divelement = document.createelement("div"); divelement.id = "mydiv"; divelement.classname = "mydivclass"; divelement.innerhtml = firstname[i] + " " + lastname[i]; document.body.appendchild(divelement); } you seem writing elements based on loop. why doing divelement.innerhtml = firstname[i] + " " + lastname[i]; when needs be divelement.inne...

mysql - Querying two tables with one query with replacing word -

i have 2 tables in mysql like: table 1: city id name transport 1 new-york 1,3,4 2 dallas 3,4 3 la 1,2,4 4 california 3,4 table 2: transport id name 1 bus 2 trolleybus 3 train 4 metro can received result example 1 query? result: id name transport 1 new-york bus,train,metro 2 dallas train,metro 3 la bus,trolleybus,metro 4 california train,metro you should change database structure , normalize it. never store data comma-separation since bad way store data. till fix database design following query should looking at. select id, name, group_concat(transport) ( select c.id, c.name, t.transport transport city c join transport t on find_in_set(t.id,c.transport) )x group id ; demo if need order transport values can use group_concat(transport order transport) why comma-separation bad practice? can read following why should ignored is storing delimited li...

google cloud storage - gsutil cp error--device or resource busy -

i've got issue gsutil cp. i'm getting "oserror: [errno 16] device or resource busy" error. i'm using python 2.7.2. gsutil output below. tried changing temp directory , didn't help. idea might causing error? i've tried bunch of times , file gets uploaded in spite of error message, not. thanks! fri may 16 14:05:50 ~ > gsutil cp hello.txt gs://cg2 copying file://hello.txt [content-type=text/plain]... traceback (most recent call last): file "/nfs/apps/python/2.7.2/lib/python2.7/multiprocessing/util.py", line 261, in _run_finalizers finalizer() file "/nfs/apps/python/2.7.2/lib/python2.7/multiprocessing/util.py", line 200, in __call__ res = self._callback(*self._args, **self._kwargs) file "/nfs/apps/python/2.7.2/lib/python2.7/shutil.py", line 249, in rmtree onerror(os.remove, fullname, sys.exc_info()) file "/nfs/apps/python/2.7.2/lib/python2.7/shutil.py", line 247, in rmtree os.remo...

Python / shapely: Calculate Polygon area in planar units (e.g. square-meters) -

i using python 3.4 , shapely 1.3.2 create polygon object out of list of long/lat coordinate pairs transform well-known-text string in order parse them. such polygon might like: polygon ((-116.904 43.371, -116.823 43.389, -116.895 43.407, -116.908 43.375, -116.904 43.371)) since shapely not handle projections , implements geometry objects in carthesian space, calling area method on polygon like: poly.area gives me area of polygon in unit of square-degrees. area in planar unit square-meters, guess have transform coordinates of polygon using different projection (which one?). i read several times pyproj library should provide way this. using pyproj, there way transform whole shapely polygon object projection , calculate area? i other stuff polygons (not think now) , in cases, need calculate area. so far, found example: http://all-geo.org/volcan01010/2012/11/change-coordinates-with-pyproj/ which mean splitting each polygon object outer and, if present, inner rings, grab...

php - Data not inserting in MySQL -

i making script guy , uses advanced outgoing api (not familiar). gives me url post variable stored in http://example.com/your_script.php?email_address={u_email}&firstname={u_firstname} . here php code. problem cannot read post values. when echo it, it's empty. note: instruction api manual. advanced outgoing api can have 5 urls each product/podcast/rss feed/membership notified whenever subscriber event happens. can enter these urls clicking on "edit notifications/custom fields" particular item. system post following variables urls you've entered. can include of variables below "tags" in url , system replace tag actual value. way can post values existing script expects variable name different ones listed below. example, notification url be: http://example.com/your_script.php?email_address= {u_email}&firstname={u_firstname} . system post variables below to: http://example.com/your_script.php?email_address=joe@example.com&firstname=joe ...

android - no .apk is created when running the project after getting the error could not find apk -

i tried run android code , got following error "could not find *.apk". opened project's property , uncheck library. i able run code while phone connected in debug mode instead of emulator. there no apk in project directory. why happening?? how make create .apk?? if have "is library" checked in properties, normal no apk built, having checked means intended used other projects , built apk files. now have unchecked "is library" , been able build , run code on phone, apk file must have been built. apk file located in bin subdirectory of project after you've built in debug mode in eclipse.

php - Submit Form to action based on Selection -

i have list of records in table checkbox beside each one. the user selects number of records ticking checkbox , selects action drop down list of links. <div class="button-group"> <button type="button" id="but1">action</button> <ul class="dropdown" id="dropdown-but1"> <li><a href="#">update attendees</a></li> <li><a href="#">another action</a></li> <li><a href="#">one more action</a></li> </ul> </div> an example of action might updating if user attend event. if(isset($_post['submit'])) { foreach ($_post['checkbox_mark'] $value => $dummy) { $option = isset($_post['checkbox'][$value]) ? '1' : '0'; // send data model $eventregistrationmodel->markattended($value, $id, $option); } ...

Conversion error when converting 'nvarchar' to 'datetime' in sql server -

i have code : declare @startdate nvarchar set @startdate='22/10/2014' select cast (@startdate datetime) and gives me error: conversion failed when converting date and/or time character string. can suggest better way/at least no error way this. to convert string represents date in format dd/mm/yyyy can use this: declare @startdate nvarchar(10) set @startdate='22/10/2014' select convert(datetime, @startdate, 103) declaring varchar means setting length 1.

reporting services - How to have a a single series data label on a grouped bar chart? -

Image
i have ssrs bar chart shows data in handful of category groups. it's pretty straightforward , looks this: i've got need segment each category 2 series groups so: so far need display ungrouped percentage data labels (i.e. requirement continue show percentage of each combined category group, not percentage of series group). need bar chart second image data labels first. for life of me cannot bar chart show series group data labels. i had time ago. achieved by... creating second dataset fetched values wanted data labels selecting series in chart , in properties pane going labels, setting usevalueaslabel = false setting "label" property lookup() fetched appropriate value second dataset using "visible" property hide labels 1 series no longer show. the end result was: hope makes sense! edit: clarifying slightly: step 4 necessary because, you're finding, program apply label each series. other dataset fetches combined total, w...

hibernate - Tuning Lucene indexing performance in infinispan -

i'm using hibernate search , lucene index in infinispan. time indexing long. i'm trying optimize performance of indexing tuning options. i.e, set hibernate.search.​[default|<indexname>].​indexwriter.ram_buffer_size 64mb . i dont know how set in infinispan, can give me example solve that? i used configuration, taken upstream , should optimized. however, don't know version of infinispan using, 6.x. issue indexing , queries performance configuration sensitive , may took time tune use case. https://github.com/tsykora/infinispan-odata-server/blob/master/src/main/resources/indexing-perf.xml

python install package as sub-package of another package -

i developing program ("homie") in python 2.7 eclipse / pydev contains several interfaces external api providers. inherit genric interface-class located inside __init__.py inside homie.interfaces all interfaces should contained in sub-packages of homie.interfaces , such homie.interfaces.foo , homie.interfaces.bar . following divide-and-conquer concept created new projects each interface implementation, containing respective packages, such foo , respectively bar . the problem now, setup.py script of course not find package myprogram.interfaces.foo during setup. example: worknet interface #! /usr/bin/env python distutils.core import setup setup( name='worknet-dbs interface', version='0.1-indev', author='richard neumann', author_email='mail@richard-neumann.de', packages=['homie.interfaces.worknet'], data_files=[], license=open('license.txt').read(), description='interface impleme...

java - Threads running at same time instance -

i have requirement threading need initiate thread run continuously doing db operations . second thread present needs run every 30 secs. job of second thread killing first thread , start new instance of first thread. i tried several ways achieve not able same. public class threadmain { public static void main(string[] args) throws interruptedexception, brokenbarrierexception{ final cyclicbarrier gate = new cyclicbarrier(3); thread t1 = new thread(){ public void run(){ try { gate.await(); while(true) { system.out.println("thread1"); break; } } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (brokenbarrierexception e) { // todo auto-generated catch block e.printstacktrace(); } }}...

php - Table joins in Laravel -

database structure users id | name ---+--------- 1 | op 2 | noob items id | name | user_id ---+------+-------- 1 | car | 1 2 | bus | 2 3 | box | 1 comments id | user_id | item_id | comment ---+---------+---------+--------------- 1 | 1 | 3 | box. app app/routes.php view::share('top_comments', user::join('comments', 'users.id', '=', 'comments.user_id') ->take(3) ->get() ); app/views/test.php @foreach ($top_comments $comment) username: {{ $comment->name }}<br /> comment: {{ $comment->comment }}<br /> item id: {{ $comment->item_id }} @endforeach current output username: op comment: box item id: 3 desired output username: op comment: box item id: 3 item name: box i want able adjust top_comments query include items.name . {{ $comment->name }} returns user's name. think having same...

multithreading - Powershell GUI, Progress Bar, and Hash Tables -

part of script i'm working on takes specified username, searches active directory computers named username, pings them, , adds online machines array use later. i'd add progress bar ping portion of script i'm running problems. form have present progress bar freezes execution of script if invoke prior ping loop. here code progress bar (pretty basic): #progress bar $objformpbar = new-object system.windows.forms.form $objformpbar.text = "loading" $objformpbar.size = new-object system.drawing.size(200,100) $objformpbar.startposition = "centerscreen" $objformpbar.topmost = $true $objformpbar.icon = $icon $progressbar = new-object system.windows.forms.progressbar $progressbar.size = new-object system.drawing.size(175,20) $progressbar.location = new-object system.drawing.size(5, 20) $progressbar.minimum = 0 $progressbar.maximum = 0 $objformpbar.controls.add($progressbar) here i'm attempting display it, way halts execution of script (called inside...

c# - Claims authorization using Thinktecture.IdentityModel -

as explained on leastprivilege , there 2 ways setup claims authorization checks using thinktecture.identitymodel. 1 setup filter. other add attributes actions want check. i'm using attributes option. however, i'd override behavior of sending unauthorized (but authenticated) requests login page. instead i'd present 401 error (or unauthorized page). far, have following class override handleunauthorizedrequest , throw 401 error (if authenticated). however, way i've figured out how wire in adding class filter. doing though, skips using attribute decorations , sends action/resource through checkacess method, useless us. public class customclaimsauthorizeattribute : thinktecture.identitymodel.authorization.mvc.claimsauthorizeattribute { public customclaimsauthorizeattribute() { } public customclaimsauthorizeattribute(string action, params string[] resources) : base(action, resources) { } protected override void handle...

c# Calling a form from another project -

got problem calling forms other projects. have solution 3 projects. example want call form buttonclick project when i'm on project b. this easy since put folder in solution (with other projects) in vs, add project solution explorer , make reference project project b. can call forms (when in project a): projectb.form1 f1 = new projectb.form1(); f1.show(); but when try same project when i'm in project b projecta.form1 f1 = new projecta.form1(); f1.show(); then error message saying projecta doesn't exist etc. how can resolve this? make reference project project b ?.. thanks in advance in solution explorer, right-click "references" folder under project a, add reference, solution, , select project b. can avoid using projecta. everytime adding line using projecta; @ top of file.

javascript - Primefaces SelectOneMenu selects item when ctrl+key (hotkey) is pressed -

i have jsf forms hotkeys, e.g., ctrl + s save data. the problem is, when key combination pressed , focus on <p:selectonemenu> field, first item starting s (following example) selected , form submitted. you can reproduce behavior in showcase , in first field, pressing ctrl + o . in chrome, @ least, it'll select first option , browser "open dialog". i want component ignores letter when special key pressed. i've tested behavior against select html element , "combo box" jquery ui, , doesn't happen. primefaces implementation of selectonemenu different wrapper input field. i tried return false in both onkeyup , onkeydown attributes listed in pf user guide. no results. i tried adding jquery keyboard event listeners preventdefault() , return false . nothing. before digging primefaces code i'd know if there's known workaround case. i checked out newer version of primefaces source svn repository. there javascript fu...

ios - clang error unknown argument '-fno-obj-arc' AFNetworking Xcode 5.1 -

Image
this question has answer here: xcode llvm 5.1 clang error 5 answers so tried run app on iphone 7, , asihttp didn't work. after search saw people migrating afnetworking, decided same. here's did: updated xcode version 5.1 followed instructions here (setup cocoapods, installed afnetworking, changed project) and tried run. first build failed message: clang: error: unknown argument: '-fno-obj-arc' [-wunused-command-line-argument-hard-error-in-future] clang: note: hard error (cannot downgraded warning) in future command /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang failed exit code 1 the 2 reports found here , here and tell me add flag while doing pod download: archflags=-wno-error=unused-command-line-argument-hard-error-in-future did , tried again, no avail. can't go other project. has d...

ios - UIScrollview is not scrolling -

Image
i know there tens of similar question scrollview have tried everything, scrollview not scrolling. first created uiviewcontroller xib file, , set freeform , arrange size of , added scrollview on view. then added childviewcontroller view controller. -(void)scrollviewsetup { if (!_scrollview) { _scrollview=[[uiview alloc] initwithframe:cgrectmake(0,200,self.scrollview.frame.size.width,200)]; [self.view addsubview:_scrollview]; scrollview *displayportf=[[scrollview alloc] init]; //add child view controller here //displayportf.delegate=(id)self; [_scrollview addsubview:displayportf.view]; [displayportf didmovetoparentviewcontroller:self]; [self addchildviewcontroller:displayportf]; } } content size of scroll view (768,200) on ipad. tried setting content size (1920,200) in viewdidload didn't work viewdidappear didn't work viewdidlayoutsubviews didn't work. then checked use auto layou...

r - Distance Matrix from second variable using get.shortest.paths() -

i go 1 step further question ( find total of second variable related distance of route get.shortest.paths() ). how 1 matrix of distances between nodes, when 'shortest' path found using newcost variable? (my experience igraph limited). df2 = rbind(c(234,235,21.6,75), c(234,326,11.0,35), c(235,241,14.5,78), c(326,241,8.2,98), c(241,245,15.3,75), c(234,245,38.46,65)) df2 = as.data.frame(df2) names(df2) = c("start_id","end_id","newcost","distance") require(igraph) g2 <- graph.data.frame(df2, directed=false) tmp2 = shortest.paths(g2,weights=e(g2)$newcost) tmp2 #this gives matrix of newcost-weighted shortest distances where use how find paths, using optimal.path <- get.shortest.paths , , using sum(e(g2, path = optimal.path)$distance) create matrix of distances what edgelist of distances node pairs, like: startid endid shortestdist 234 ...

Gallery Android Tutorial -

here code. want create image gallery succesfully did. want click on thumbnail appear @ bigger scale below gallery or maybe @ center of screen. should use setimageresource() method? <?xml version="1.0" encoding="utf-8"?> <gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery" android:layout_width="fill_parent" android:layout_height="wrap_content" /> i have tried starters put imageview below gallery,but compiler gave me error. <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="galleryactivity"> <attr name="android:galleryitembackground" /> </declare-styleable> </resources> public class galleryactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstances...

Javascript access array -

Image
i trying access values in array, using developer console have printed out array , looked @ structure of array, unsure how can access these values. var position = ctrack.getcurrentposition(); console.log(position); below can see close my console output : the developer console looks this. wanted access third entry open on image , out values of 0 , 1 , print them console. how achieve this? you should able access position[3][0] // , position[3][1];

java - NULL values loading file into mysql table -

i have file contains list of words , trying load them mysql table. null values. this how words saved files silver gold modern paper current and on this related part of code string sqlkeywordcreate=new string ("create table keywordstable " + " (k_id integer not null auto_increment primary key, keywords varchar(25))"); stmt1.executeupdate(sqlkeywordcreate); string sqlloadkey ="load data local infile " +"'e:/thesis/thesiswork/outdata/keywords.txt'"+ " \n" + " table "+ "keywordstable"+"lines terminated '\r\n'";; stmt1.executeupdate(sqlloadkey); this how table outputted k_id | keywords 1 | null 2 | null and on. i not know wrong here specially have data no missing ones. me please your load command essentially: load data infile 'e:/thesis/thesiswork/outdata/keywords.txt' table keywordstable; your table has 2 colum...

java - OpenGL not rendering as expected -

if have screen setup following gl.glviewport(0,0,width,height); //reset current viewport gl.glmatrixmode(gl10.gl_projection); //select projection matrix gl.glloadidentity(); //reset projection matrix gl.glorthof(0f,1f,0f,1f,-1f,1f); and vertices set follows this._vertices=new float[]{ 0.0f,0.5f,0.0f, //v1 bottom left 0.0f,1.0f,0.0f, //v2 top left 0.5f,0.5f,0.0f, //v3 bottom right 0.5f,1.0f,0.0f //v4 top right }; then when drawing do gl.gltranslatef(0.0f,0.0f,0.0f); it places square in top left (i thought 0,0 bottom left?) and then gl.gltranslatef(0.5f,-0.5f,0.0f); places square in middle of screen (suggesting bottom -1.0f rather 0.0f) how make bottom left of screen start 0,0? update------ i have found if change line gl.glorthof(0f,1f,0f,1f,-1f,1f); to gl.glorthof(0f,1f,1f,0f,-1f,1f); then nothing changes (ie top left still 0,0 , bottom left 0,...

Verilog HDL syntax error near text "for"; expecting "endmodule" -

so got around learning verilog , implementing basic binary adder in it. limited understanding of verilog, following should add 2 16-bit values. module add(x, y, z); input[15:0] x; input[15:0] y; output z[15:0]; wire c[15:0]; assign c[0] = 0; integer i; for(i=1; i<16; i=i+1) begin assign c[i]=(x[i-1]&y[i-1])|(x[i-1]&c[i-1])|(y[i-1]&c[i-1]); end for(i=0; i<16; i=i+1) begin assign z[i]=x[i]^y[i]^c[i]; end endmodule however, error when try synthesize above. error (10170): verilog hdl syntax error @ add.v(10) near text "for"; expecting "endmodule" i'm not sure wrong code. appreciated! the for-loop used outside of block, i needs genvar instead of integer . also, want z , c declared packed arrays instead of unpacked, mo [15:0] other side. output [15:0] z; // make packed bits wire [15:0] c; assign c[0] = 0; genvar i; // not integer generate // required ieee 1364-2001, optional *-2005 , systemverilog for(i=1; i<16; i=i+...

c# - Incorrect reading data from .bin file -

i have 2 programs: 1 test students take , second teachers(teachers create variants of test , add questions it); teacher program creates .bin files tests , student's open , take tests. data structure( class question ) similiar in both programs; teacher's program class code: [serializable] public class question { public question(string q_text, dictionary<string, bool> ans, image img) { text = q_text; answers = ans; image = img; isanswered = false; } public string text { get; set; } public dictionary<string, bool> answers { get; set; } public image image { get; set; } public bool isanswered; public static void persistobject(dictionary<int, question> q, stream stream) { binaryformatter formatter = new binaryformatter(); formatter.serialize(stream, q); stream.close(); } public sta...

html - Css hover button effect -

look @ fiddle js fiddle when hover( :hover ) background changes when clicked ( :active ) box-shadow not changed dont know why ? not happen if button not change background on hover ! in fiddle want somehthing combination of button 1 , button 2 .white-button { background: #fff; font-weight: normal; color: #3b3b3b; border: 1px solid #ddd; box-shadow: 0 0 2px #ccc; font-family: mv boli,tahoma; margin: 5px; padding: 5px 10px 5px 10px; font-size: 15px; } .positive:enabled:hover { background: #99cd30; box-shadow: inset 2px -7px 11px rgba(80, 92, 51, 0.17)!important; } button:active { border-bottom-color: #999; box-shadow: inset 0 3px 3px rgba(0, 0, 0, .2); } .gray-button{ background:#eee; padding:5px 10px; border: 1px solid #999; border-bottom-color: #888; } for cant under stand! as see there 3 buttons on fiddle name like lets button a,b , c respectively. now when hover a green background inset box-sh...

oracle - How to get nested table column? -

for example, how this: create type nums_list table of number; declare nnn nums_list := nums_list(2,3,4,1); begin in ( select col table(nnn) order col ) loop dbms_output.put_line( col ); end loop; end;

ssl - OpenSSL let the server and client negotiate the method -

following outdated tutorial managed create https server using openssl tls1.2, , i'm proud of ;) however tls 1.2 supported in latest browsers , have kind of negotiation of protocol between client , server, i'm sure can done, i'm not able find how! if client supports tls1.0, use that. , if supports sslv3, use that. not sure sslv2, maybe better leave that... the code use right is: ssl_library_init(); openssl_add_all_algorithms(); ssl_load_error_strings(); ssl_method = tlsv1_2_server_method(); ssl_ctx = ssl_ctx_new(ssl_method); then server certificates loaded , ssl_ctx shared among connections. when client accept ed server socket encapsulated in ssl object (whatever represents): ssl = ssl_new(ssl_ctx); ssl_set_fd(ssl, client_socket); ssl_accept(ssl); so guess has changed in ssl_ctx creation allow more methods... idea? <rant> no decent, extensive documentation can found openssl, best available 10 years old tutorial! </rant> thanks in advance. ...

mysql - What's the ad-hoc query, in RDBMS? -

a doc mysql cluster says: many new applications need back-end database meet above challenges, while still: preserving transactional integrity acid compliance; enabling deep insight running complex, ad-hoc queries against data; leveraging proven benefits of industry standards , skill sets reduce cost, risk , complexity. so, "ad-hoc query" ? databases used in various ways. often, ends of applications. in case, database can optimized specific set of queries. ad hoc queries queries unknown @ time database being designed -- because there many possibilities on how database work. so, database cannot optimized them. these queries can become quite complicated. typically used 2 reasons. 1 analysis of data -- answer various questions arise business. second developing new application, during development phase.

javascript - How to format a button when it is clicked? -

is there way format button in css changes colour when clicked? know ':hover' can used change colour looking similar related left mouse click. i after general effect of regular button want change colour default blue. to use :active selector. html: <button>click me!</button> css button{ background:green; } button:hover{ background:lightgreen; } button:active{ background:red; } example

redis - After php upgrade pcntl_fork causing "errno=32 Broken pipe" -

i upgraded php 5.4.26 5.4.28 after upgrade getting error notice: unknown: send of 6 bytes failed errno=32 broken pipe in unknown on line 0 when ever run following code: <?php $tasks = array( '1' => array(), '2' => array(), ); ini_set('display_errors', true); class redisclass { private $redis; public function __construct() { $this->redis = new redis(); $this->redis->connect('localhost', 6379); } } $redis = new redisclass(); foreach ($tasks $index => $task) { $pid = pcntl_fork(); // child if($pid == 0) { echo "running ".$index." child in ". getmypid() ."\n"; break; } } switch($pid) { case -1 : die('could not fork'); break; case 0: // child co...

scala - Using private mutable collections of a covariant type -

i have covariant scala type thing[+b] . implementation uses internal mutable queue: private val queue : asyncqueue[b]() asyncqueue custom mutable queue implementation, special properties can't implement in immutable version. because it's mutable, asyncqueue invariant. can't use in covariant type thing . since queue private, can guarantee correctness of code: e.g. won't try assign queue reference of type queue[any] . how can make work, keeping thing covariant in b , without using casts? (the solution casts declare asyncqueue[object] , cast objects on enqueue/dequeue, ugly.) eta : understand type covariance, , understand why shouldn't able declare asyncqueue of covariant type, or make asyncqueue covariant. question how design code avoid using casts everywhere. you can make member immune variance check making private[this] , according the spec . scala> trait thing[+a] { def next(): } defined trait thing expectedly, scala> class th...

java - Incorrect integer value:'javax.swing.JFormattedtextField -

i have problem , want ask you. doing netbeans , here code : private void jbutton_suaactionperformed(java.awt.event.actionevent evt) { // todo add handling code here: string sql ="update mathang set tenmathang = ?, donvitinh = ?, quycach = ?, dongiaban = ?, manhomhang = ? mamathang = ?"; string jf = jformattedtextfield_dongiaban.gettext(); int = integer.parseint(jf); //abstractformatter formatter = jf.getformatter(); try{ pst =conn.preparestatement(sql); rs =pst.executequery(); pst.setstring(1, jtextfield_tenmathang.gettext()); pst.setstring(2, jtextfield_donvitinh.gettext()); pst.setstring(3, jtextfield_quycach.gettext()); pst.setstring(4, i); pst.setstring(5, (string) jcombobox_manhomhang.getselecteditem()); //jcombobox_manhomhang.additem(jtable_mathang.gettext()); //pst.s...

mongodb - Can I get group and count in aggregation framework? -

i have score collection like: {grade:1 group:1, alumn:1, score:100}, {grade:1 group:1, alumn:1, score:100}, {grade:1 group:1, alumn:2, score:80}, {grade:1 group:1, alumn:2, score:80}, {grade:1 group:2, alumn:1, score:70}, {grade:1 group:2, alumn:1, score:70}, {grade:1 group:2, alumn:2, score:80}, {grade:1 group:2, alumn:2, score:80}, {grade:1 group:3, alumn:1, score:90}, {grade:1 group:3, alumn:1, score:90}, {grade:1 group:3, alumn:2, score:90}, {grade:1 group:3, alumn:2, score:90}, how can best alumn of each grade/group? grade:1 [{group:1, alumn:1, score:200}], [{group:2, alumn:2, score:160}], [{group:3, alumn:1, score:180}, {group:3, alumn:2, score:180}] this query return output needed : var scores = db.scores.aggregate({ $group: { _id: { grade: "$grade", group: "$group", alumn: "$alumn" }, score: { $sum: "$score" } } }, { ...

ruby on rails tutorial - rails server issue -

i've started doing "ruby on rails tutorial", michael hartl. i've created new project with: rails new first_app then had me change gemfile from: source 'https://rubygems.org' # use sqlite3 database active record gem 'sqlite3' # use scss stylesheets gem 'sass-rails', '~> 4.0.1' # use uglifier compressor javascript assets gem 'uglifier', '>= 1.3.0' # use coffeescript .js.coffee assets , views gem 'coffee-rails', '~> 4.0.0' # see https://github.com/sstephenson/execjs#readme more supported runtimes # gem 'therubyracer', platforms: :ruby # use jquery javascript library gem 'jquery-rails' # turbolinks makes following links in web application faster. # read more: https://github.com/rails/turbolinks gem 'turbolinks' # build json apis ease. read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 1.0.1' group :doc # bundle exec rake d...

c - GTKButton with GtkListStore -

i tried add gtkbutton gtkliststore edit data in each row... button doesn't appear, , error message : "glib-gobject-warning **: unable set property text' of type gchararray' value of type `gtkbutton'". here code : #include <gtk/gtk.h> gtktreemodel * create_and_fill_model() { gtkliststore *store; gtktreeiter iter; store = gtk_list_store_new (9, g_type_string, g_type_string, g_type_string, g_type_string, g_type_string, g_type_string, g_type_uint, g_type_float, gtk_type_button); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, "a5525654", 1, "dfffccn", 2, "doe", ...

weka - Train and Test Set are not compatible: comparing 2 csv files -

i facing common problem of weka, "train , test set not compatible". had large data sets in csv format. got such error reduce data set(for practice purpose) 2 data in train set , 1 data in test set. using j48 classifier. i have checked same data format appears in csv , same column title has appeared. the train , test sets given below: train set: stop words/punctuations1(l),stop words/punctuations/stemming1(l),stop words/punctuations/lammetizing1(l),stop words/punctuations1(nc),stop words/punctuations/stemming1(nc),stop words/punctuations/lammetizing1(nc),stop words/punctuations2(l),stop words/punctuations/stemming2(l),stop words/punctuations/lammetizing2(l),stop words/punctuations2(nc),stop words/punctuations/stemming2(nc),stop words/punctuations/lammetizing2(nc),stop words/punctuations3(l),stop words/punctuations/stemming3(l),stop words/punctuations/lammetizing3(l),stop words/punctuations3(nc),stop words/punctuations/stemming3(nc),stop words/punctuations/lammetizi...