PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
32
30.1k
OpenStatus_id
int64
0
4
11,327,275
07/04/2012 10:29:34
895,029
08/15/2011 13:50:23
125
4
Puzzling "Subscripted assignment dimension mismatch" only during loop using portopt & ewstats
I am tearing my hair out over this one. I have a set of daily returns of 4 assets, using a 10 day window I loop over the whole dataset (from `i` = 1 to 50) performing a number of calculations and building optimal portfolios. This involves using `portopt`. [PortRisk(:,i), PortReturn(:,i), PortWts(:,:,i)] = portopt(ExpReturn(i,:), ExpCovariance(:,:,i), [], [], ConSet); The inputs, `ExpReturn` and `ExpCovariance` are generated using `ewstats` [ExpReturn(i,:), ExpCovariance(:,:,i)] = ewstats(RetSeries, 0.94) Now, on the final 50th iteration (and only the 50th - all previous work fine), I get the following error: ??? Subscripted assignment dimension mismatch. Error in ==> Script at 10 [PortRisk(:,i), PortReturn(:,i), PortWts(:,:,i)] = portopt(ExpReturn(i,:), ExpCovariance(:,:,i), [], [], ConSet); Note, I see no issue with `RetSeries` as `ExpReturn` and `ExpCovariance` generated by `ewstats` are size `<50x4>` and `<4x4x50>` respectively. I have tried everything i can think of to hunt down the error, including checking `size()`, using breakpoints, preallocating the matrices etc etc. Oddly, if i remove the loop, set `i = 50`, it works. Furthermore, if instead of `ewstats` I simply use `mean()` and `cov()` - they work on the 50th iteration. If i replace one, `ExpReturn` for example, with a `mean(RetSeries)`, it works. Similarly, replacing `ExpCovariance` with `cov(RetSeries)` - works. But both `ExpReturn` and `ExpCovariance` together always fail. What is causing the error?
matlab
null
null
null
null
null
open
Puzzling "Subscripted assignment dimension mismatch" only during loop using portopt & ewstats === I am tearing my hair out over this one. I have a set of daily returns of 4 assets, using a 10 day window I loop over the whole dataset (from `i` = 1 to 50) performing a number of calculations and building optimal portfolios. This involves using `portopt`. [PortRisk(:,i), PortReturn(:,i), PortWts(:,:,i)] = portopt(ExpReturn(i,:), ExpCovariance(:,:,i), [], [], ConSet); The inputs, `ExpReturn` and `ExpCovariance` are generated using `ewstats` [ExpReturn(i,:), ExpCovariance(:,:,i)] = ewstats(RetSeries, 0.94) Now, on the final 50th iteration (and only the 50th - all previous work fine), I get the following error: ??? Subscripted assignment dimension mismatch. Error in ==> Script at 10 [PortRisk(:,i), PortReturn(:,i), PortWts(:,:,i)] = portopt(ExpReturn(i,:), ExpCovariance(:,:,i), [], [], ConSet); Note, I see no issue with `RetSeries` as `ExpReturn` and `ExpCovariance` generated by `ewstats` are size `<50x4>` and `<4x4x50>` respectively. I have tried everything i can think of to hunt down the error, including checking `size()`, using breakpoints, preallocating the matrices etc etc. Oddly, if i remove the loop, set `i = 50`, it works. Furthermore, if instead of `ewstats` I simply use `mean()` and `cov()` - they work on the 50th iteration. If i replace one, `ExpReturn` for example, with a `mean(RetSeries)`, it works. Similarly, replacing `ExpCovariance` with `cov(RetSeries)` - works. But both `ExpReturn` and `ExpCovariance` together always fail. What is causing the error?
0
11,327,277
07/04/2012 10:29:45
490,591
10/28/2010 20:24:24
49
1
Certificate for Distribution of App in iOS devices
I am trying to upload a binary of an App so that I can test out in app purchase.I can run the Application on intended iOS device which mean the development profile is working fine. But when I try to archive the file I get the error as shown in the image. Since i cannot import the private key associated to the profile show in the error I want to generate my own certificate using keyChain. So I created the certificate but I can't find the option send invite to a distributor or upload a certificate. My profile status is Admin. What should i do. ![Error in distribution file][1] [1]: http://i.stack.imgur.com/cEiYf.png
ios
provisioning
null
null
null
null
open
Certificate for Distribution of App in iOS devices === I am trying to upload a binary of an App so that I can test out in app purchase.I can run the Application on intended iOS device which mean the development profile is working fine. But when I try to archive the file I get the error as shown in the image. Since i cannot import the private key associated to the profile show in the error I want to generate my own certificate using keyChain. So I created the certificate but I can't find the option send invite to a distributor or upload a certificate. My profile status is Admin. What should i do. ![Error in distribution file][1] [1]: http://i.stack.imgur.com/cEiYf.png
0
11,327,278
07/04/2012 10:29:55
1,263,145
03/12/2012 02:06:39
51
1
changing javascript (or <script> tag) using javascript
was hoping you could help me out. I'm trying to figure out a way to change javascript code using javascript. If thats not possible, then if you could suggest another way for me to accomplish what i'm trying to do it would be great. Basically, a user selects option, which generates a customized javascript code for a clock (using php via ajax techniques). now this code is run using the eval statement, and the clock is displayed in a particular <div> element. the eval() statement is run each time a response is received from server via AJAX. Problem is, since it is a clock, I have used setInterval() to constantly update the time. Now if multiple ajax calls are run, multiple functions start to run in a loop. i.e, after first server call we have this running: setInterval(function and code for clock with format 1,1000); AND setInterval(function and code for clock with format 2,1000); so basically, I want to somehow stop the first one from running before the second one starts..any ideas? thanks in advance.
php
javascript
ajax
null
null
null
open
changing javascript (or <script> tag) using javascript === was hoping you could help me out. I'm trying to figure out a way to change javascript code using javascript. If thats not possible, then if you could suggest another way for me to accomplish what i'm trying to do it would be great. Basically, a user selects option, which generates a customized javascript code for a clock (using php via ajax techniques). now this code is run using the eval statement, and the clock is displayed in a particular <div> element. the eval() statement is run each time a response is received from server via AJAX. Problem is, since it is a clock, I have used setInterval() to constantly update the time. Now if multiple ajax calls are run, multiple functions start to run in a loop. i.e, after first server call we have this running: setInterval(function and code for clock with format 1,1000); AND setInterval(function and code for clock with format 2,1000); so basically, I want to somehow stop the first one from running before the second one starts..any ideas? thanks in advance.
0
11,327,056
07/04/2012 10:16:24
690,017
04/03/2011 16:46:34
140
2
Gwt change image size in ImageCell
I create a small CellTable with gwt. In that table I would like to add some images. For this I use following code: Column<Company, String> columnflag = new Column<Company, String>(new ImageCell()) { public String getValue(Company company) { return company.getImageSmall(); } }; This works fine. But I would like to change the size of the image? Does anyone know how I could do this? I have nothing found... Set a fix column width and height does not help. Greetz
image
gwt
size
celltable
null
null
open
Gwt change image size in ImageCell === I create a small CellTable with gwt. In that table I would like to add some images. For this I use following code: Column<Company, String> columnflag = new Column<Company, String>(new ImageCell()) { public String getValue(Company company) { return company.getImageSmall(); } }; This works fine. But I would like to change the size of the image? Does anyone know how I could do this? I have nothing found... Set a fix column width and height does not help. Greetz
0
11,327,057
07/04/2012 10:16:30
1,501,223
07/04/2012 10:00:23
1
0
real time 3d plot accelerometer python
i've a problem. I want make a real time 3d plot that rapresent a movement of my acelerometer. I use the FuncAnimation class. import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.art3d import Line3D import matplotlib.animation as animation import socket import mpl_toolkits.mplot3d.axes3d as p3 import Queue import json import threading import time DATA_LEN = 200 LOCAL_PORT = 51001 REMOTE_PORT = 51000 REMOTE_IP = 'locahost' def get_value_from_json(json_string): ''' doc ''' try: json_obj = json.loads(json_string) except ValueError: return (0, 0, 0) else: try: cmd = json_obj['cmd'] except KeyError: raise else: if cmd == "cmd_accelerometer_data": x = json_obj['x'] y = json_obj['y'] z = json_obj['z'] return (x, y, z) return (0, 0, 0) def update_lines(num, data, line) : line.set_data(data[0:2, :num]) line.set_3d_properties(data[2,:num]) return line class SubplotAnimation(animation.FuncAnimation): def __add_circular_data(self, axes, value): if len(axes) >= DATA_LEN: axes.pop(0) axes.append(value); def __init__(self, data_receiver): self.data_receiver = data_receiver self.data_receiver.setblocking(0) self.fig = plt.figure(figsize=(14,7)) #fig.set_size_inches(1,1) self.ax = p3.Axes3D(self.fig) self.x = [0 for _ in range(0, DATA_LEN)] self.y = [0 for _ in range(0, DATA_LEN)] self.z = [0 for _ in range(0, DATA_LEN)] self.tot=[self.x, self.y, self.z] self.lineData=np.empty((3, DATA_LEN)) for i in xrange(0,DATA_LEN): self.lineData[:,i]=self.x[i] , self.y[i], self.z[i] self.data=[self.lineData] self.line = [self.ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in self.data] self.ax.set_xlim3d(-32768, 32768) self.ax.set_ylim3d(-32768, 32768) self.ax.set_zlim3d(-32768, 32768) animation.FuncAnimation(self, self.fig, update_lines, 25, fargs=(self.data,self.line), interval=50, blit=False) def _draw_frame(self, framedata): if framedata != None: #print framedata i_x = framedata[0] i_y = framedata[1] i_z = framedata[2] self.__add_circular_data(self.x, i_x) self.__add_circular_data(self.y, i_y) self.__add_circular_data(self.z, i_z) for i in xrange(0,DATA_LEN): self.lineData[:,i]=self.x[i] , self.y[i], self.z[i] self.data=[self.lineData] self.line = [self.ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in self.data] self._drawn_artists = update_lines() def new_frame_seq(self): try: data = self.data_receiver.recv(8192) except socket.error: return iter([[0, 0, 0]]) else: (x, y, z) = get_value_from_json(data) return iter([(x, y, z)]) def _init_draw(self): self.line.set_data(self.data[0:2]) self.line.set_3d_properties(self.data[2]) class GarbageThread(threading.Thread): def __init__(self, socket): self.socket = socket threading.Thread.__init__(self) def run(self): while True: try: self.socket.recv(8192) time.sleep(0.025) except socket.error: pass receiver_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) receiver_socket.bind(('', 50007)) garbage_thread = GarbageThread(receiver_socket) garbage_thread.start() ani = SubplotAnimation(receiver_socket) plt.show() I use a socket that send me message as json abject. I want make a plot that show the route. I hope that someone canhelp me. I appreciate any sort of help. thanks
python
matplotlib
real-time
accelerometer
null
null
open
real time 3d plot accelerometer python === i've a problem. I want make a real time 3d plot that rapresent a movement of my acelerometer. I use the FuncAnimation class. import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d.art3d import Line3D import matplotlib.animation as animation import socket import mpl_toolkits.mplot3d.axes3d as p3 import Queue import json import threading import time DATA_LEN = 200 LOCAL_PORT = 51001 REMOTE_PORT = 51000 REMOTE_IP = 'locahost' def get_value_from_json(json_string): ''' doc ''' try: json_obj = json.loads(json_string) except ValueError: return (0, 0, 0) else: try: cmd = json_obj['cmd'] except KeyError: raise else: if cmd == "cmd_accelerometer_data": x = json_obj['x'] y = json_obj['y'] z = json_obj['z'] return (x, y, z) return (0, 0, 0) def update_lines(num, data, line) : line.set_data(data[0:2, :num]) line.set_3d_properties(data[2,:num]) return line class SubplotAnimation(animation.FuncAnimation): def __add_circular_data(self, axes, value): if len(axes) >= DATA_LEN: axes.pop(0) axes.append(value); def __init__(self, data_receiver): self.data_receiver = data_receiver self.data_receiver.setblocking(0) self.fig = plt.figure(figsize=(14,7)) #fig.set_size_inches(1,1) self.ax = p3.Axes3D(self.fig) self.x = [0 for _ in range(0, DATA_LEN)] self.y = [0 for _ in range(0, DATA_LEN)] self.z = [0 for _ in range(0, DATA_LEN)] self.tot=[self.x, self.y, self.z] self.lineData=np.empty((3, DATA_LEN)) for i in xrange(0,DATA_LEN): self.lineData[:,i]=self.x[i] , self.y[i], self.z[i] self.data=[self.lineData] self.line = [self.ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in self.data] self.ax.set_xlim3d(-32768, 32768) self.ax.set_ylim3d(-32768, 32768) self.ax.set_zlim3d(-32768, 32768) animation.FuncAnimation(self, self.fig, update_lines, 25, fargs=(self.data,self.line), interval=50, blit=False) def _draw_frame(self, framedata): if framedata != None: #print framedata i_x = framedata[0] i_y = framedata[1] i_z = framedata[2] self.__add_circular_data(self.x, i_x) self.__add_circular_data(self.y, i_y) self.__add_circular_data(self.z, i_z) for i in xrange(0,DATA_LEN): self.lineData[:,i]=self.x[i] , self.y[i], self.z[i] self.data=[self.lineData] self.line = [self.ax.plot(dat[0, 0:1], dat[1, 0:1], dat[2, 0:1])[0] for dat in self.data] self._drawn_artists = update_lines() def new_frame_seq(self): try: data = self.data_receiver.recv(8192) except socket.error: return iter([[0, 0, 0]]) else: (x, y, z) = get_value_from_json(data) return iter([(x, y, z)]) def _init_draw(self): self.line.set_data(self.data[0:2]) self.line.set_3d_properties(self.data[2]) class GarbageThread(threading.Thread): def __init__(self, socket): self.socket = socket threading.Thread.__init__(self) def run(self): while True: try: self.socket.recv(8192) time.sleep(0.025) except socket.error: pass receiver_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) receiver_socket.bind(('', 50007)) garbage_thread = GarbageThread(receiver_socket) garbage_thread.start() ani = SubplotAnimation(receiver_socket) plt.show() I use a socket that send me message as json abject. I want make a plot that show the route. I hope that someone canhelp me. I appreciate any sort of help. thanks
0
11,327,282
07/04/2012 10:30:09
1,413,701
05/23/2012 22:08:51
58
0
Rails AJAX - getting a dropdown selection to populate a table
I'm trying to get a selection from a dropdown to populate a table in the same page, using AJAX so that changes appear without a page refresh. I've got as far as working out the code for the remote call, and adding the custom action to the controller, but I don't know how to get the returned information into the table I've got. At the moment, the table is just looping through all the projects, but I want it to only display the info for the one project that is selected. What would I need to write in a JS (rjs?) file to get it to process the returned information, and what changes would I need to make to the existing table to make sure that it is displaying the correct info? Thanks! Dropdown (with AJAX call): <%= collection_select :id, Project.all, :id, :name, :onchange => remote_function(:url=>{:action => 'populate_projects'}) %> Controller action: def populate_projects @project = Project.find(params[:id]) end And the existing table: <table> <tr> <th>Name</th> <th>Category</th> <th>Budget</th> <th>Deadline</th> <th>Company ID</th> <th></th> <th></th> <th></th> </tr> <% @projects.each do |project| %> <tr> <td><%= project.name %></td> <td><%= project.category %></td> <td><%= number_to_currency(project.budget, :unit => "&pound;") %></td> <td><%= project.deadline.strftime("%A, %d %B %Y") %></td> <td><%= project.company_id %></td> <td><%= link_to 'More', project %></td> <td><%= link_to 'Edit', edit_project_path(project) %></td> <td><%= link_to 'Delete', project, confirm: 'Are you sure?', method: :delete %></td> </tr> <% end %> </table>
ruby-on-rails
ajax
table
drop-down-menu
populate
null
open
Rails AJAX - getting a dropdown selection to populate a table === I'm trying to get a selection from a dropdown to populate a table in the same page, using AJAX so that changes appear without a page refresh. I've got as far as working out the code for the remote call, and adding the custom action to the controller, but I don't know how to get the returned information into the table I've got. At the moment, the table is just looping through all the projects, but I want it to only display the info for the one project that is selected. What would I need to write in a JS (rjs?) file to get it to process the returned information, and what changes would I need to make to the existing table to make sure that it is displaying the correct info? Thanks! Dropdown (with AJAX call): <%= collection_select :id, Project.all, :id, :name, :onchange => remote_function(:url=>{:action => 'populate_projects'}) %> Controller action: def populate_projects @project = Project.find(params[:id]) end And the existing table: <table> <tr> <th>Name</th> <th>Category</th> <th>Budget</th> <th>Deadline</th> <th>Company ID</th> <th></th> <th></th> <th></th> </tr> <% @projects.each do |project| %> <tr> <td><%= project.name %></td> <td><%= project.category %></td> <td><%= number_to_currency(project.budget, :unit => "&pound;") %></td> <td><%= project.deadline.strftime("%A, %d %B %Y") %></td> <td><%= project.company_id %></td> <td><%= link_to 'More', project %></td> <td><%= link_to 'Edit', edit_project_path(project) %></td> <td><%= link_to 'Delete', project, confirm: 'Are you sure?', method: :delete %></td> </tr> <% end %> </table>
0
11,327,029
07/04/2012 10:14:52
1,107,129
12/20/2011 04:29:19
122
7
Calling Action Class on click of button
how to call action class on click of a button in jsp?.I am using struts1.3 framework Below is the code snippet: <html:button property="delete" onclick="/deleteZeroScoreCard.do" value="Delete"></html:button> `"/deleteZeroScoreCard"` is defined in struts-config.xml file I am getting below compile error Syntax error on token "Non Terminating Regular Expression", no accurate correction available
jsp
java-ee
struts
null
null
null
open
Calling Action Class on click of button === how to call action class on click of a button in jsp?.I am using struts1.3 framework Below is the code snippet: <html:button property="delete" onclick="/deleteZeroScoreCard.do" value="Delete"></html:button> `"/deleteZeroScoreCard"` is defined in struts-config.xml file I am getting below compile error Syntax error on token "Non Terminating Regular Expression", no accurate correction available
0
11,327,030
07/04/2012 10:14:52
1,364,052
04/29/2012 10:49:51
1
0
MySQL PHP doesnt update
I need help with my php Code which is supposed to update my mysql database. I tried it this way: <?php mysql_connect("servername","name","passwort"); mysql_select_db("dbname"); $name = $_GET["name"]; $points = $_GET["points"]; $query = "UPDATE highscore SET points=".$points." WHERE name='".$name."'"; mysql_query($query) mysql_close(); ?> I called it with: http://.../write.php?name=%22Alexa%20Bomkamp%22&points=%22100 But literally nothing happened. No error, but also no update. Does anyone know what im doing wrong? Thanks for help :)
java
php
android
sql
update
null
open
MySQL PHP doesnt update === I need help with my php Code which is supposed to update my mysql database. I tried it this way: <?php mysql_connect("servername","name","passwort"); mysql_select_db("dbname"); $name = $_GET["name"]; $points = $_GET["points"]; $query = "UPDATE highscore SET points=".$points." WHERE name='".$name."'"; mysql_query($query) mysql_close(); ?> I called it with: http://.../write.php?name=%22Alexa%20Bomkamp%22&points=%22100 But literally nothing happened. No error, but also no update. Does anyone know what im doing wrong? Thanks for help :)
0
11,326,765
07/04/2012 10:00:28
768,894
05/25/2011 04:41:48
536
22
Has anyone ever used Task Queue REST API?
<br /> I am doing a project on **GAE** in **PYTHON**. And I am using **Task Queues**. What I want to know is, How to use [Task Queue REST API][1]. [1]: https://developers.google.com/appengine/docs/python/taskqueue/rest?hl=kn As no example is given in the document. <br /> Thanks in advance,<br /> Mohit
python
google-app-engine
null
null
null
07/05/2012 16:02:34
not a real question
Has anyone ever used Task Queue REST API? === <br /> I am doing a project on **GAE** in **PYTHON**. And I am using **Task Queues**. What I want to know is, How to use [Task Queue REST API][1]. [1]: https://developers.google.com/appengine/docs/python/taskqueue/rest?hl=kn As no example is given in the document. <br /> Thanks in advance,<br /> Mohit
1
11,571,461
07/20/2012 00:58:44
1,539,450
07/20/2012 00:46:47
1
0
Need suggestions with Database Design
I am currently developing a warehouse management system for some local company with PHP and MySQL, and I'm currently stuck on the database design. There are 5 main tables, **users** (which will contain user-related information to loggin into the system etc), **warehouses** (containing information about warehouse name, location and responsible person), **operations** (which will contain everything that goes in and out of a warehouse), **products** and **categories**. One user will be responsible only for 1 warehouse (1-to-1 relation). Every product has a mother category. The same product, may be into different warehouses, which means that an operation for a product, can be done by different users (corresponding with the warehouse that the product is located). Here is a design I have made: http://i.stack.imgur.com/PBp1I.png I would like to get any suggestions to improve the database design, what can I add, or what I have done wrong? Thanks in advance.
database
database-design
mysql-workbench
null
null
null
open
Need suggestions with Database Design === I am currently developing a warehouse management system for some local company with PHP and MySQL, and I'm currently stuck on the database design. There are 5 main tables, **users** (which will contain user-related information to loggin into the system etc), **warehouses** (containing information about warehouse name, location and responsible person), **operations** (which will contain everything that goes in and out of a warehouse), **products** and **categories**. One user will be responsible only for 1 warehouse (1-to-1 relation). Every product has a mother category. The same product, may be into different warehouses, which means that an operation for a product, can be done by different users (corresponding with the warehouse that the product is located). Here is a design I have made: http://i.stack.imgur.com/PBp1I.png I would like to get any suggestions to improve the database design, what can I add, or what I have done wrong? Thanks in advance.
0
11,571,437
07/20/2012 00:56:09
1,514,206
07/10/2012 08:40:30
9
0
How do I pass values of spinner to another activity and display them in ListView?
I've created 2 projects. One is to key in personal information and second application is where there's ListView displayed of the information that's keyed in. I've a spinner in the 1st application. I'm not sure how to pass the values of spinner to a listview in another activity. Below is the 2nd application. package main.page; import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.widget.AutoCompleteTextView; import android.widget.Spinner; import android.widget.TextView; public class SavedInfo extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.saved_info); Bundle b = getIntent().getExtras(); String name = b.getString("name"); String date = b.getString("date"); String type = b.getString("type"); String likes = b.getString("likes"); String dislikes = b.getString("dislikes"); Spinner fullName = (Spinner) findViewById(R.id.fName); TextView da = (TextView) findViewById(R.id.date); TextView ty = (TextView) findViewById(R.id.type); TextView like = (TextView) findViewById(R.id.likes); TextView dislike = (TextView) findViewById(R.id.dislikes); fullName.setOnItemSelectedListener("Full Name: " + name); da.setText("Date: " + date); ty.setText("Type: " + type); like.setText("Likes: " + likes); dislike.setText("Dislikes: " + dislikes); } } I'm not sure if I've set the spinner right or wrong. I'm not sure how to set it too. Anyone knows how? Thanks
android
listview
spinner
null
null
null
open
How do I pass values of spinner to another activity and display them in ListView? === I've created 2 projects. One is to key in personal information and second application is where there's ListView displayed of the information that's keyed in. I've a spinner in the 1st application. I'm not sure how to pass the values of spinner to a listview in another activity. Below is the 2nd application. package main.page; import android.app.Activity; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.widget.AutoCompleteTextView; import android.widget.Spinner; import android.widget.TextView; public class SavedInfo extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.saved_info); Bundle b = getIntent().getExtras(); String name = b.getString("name"); String date = b.getString("date"); String type = b.getString("type"); String likes = b.getString("likes"); String dislikes = b.getString("dislikes"); Spinner fullName = (Spinner) findViewById(R.id.fName); TextView da = (TextView) findViewById(R.id.date); TextView ty = (TextView) findViewById(R.id.type); TextView like = (TextView) findViewById(R.id.likes); TextView dislike = (TextView) findViewById(R.id.dislikes); fullName.setOnItemSelectedListener("Full Name: " + name); da.setText("Date: " + date); ty.setText("Type: " + type); like.setText("Likes: " + likes); dislike.setText("Dislikes: " + dislikes); } } I'm not sure if I've set the spinner right or wrong. I'm not sure how to set it too. Anyone knows how? Thanks
0
11,571,439
07/20/2012 00:56:37
1,228,659
02/23/2012 14:56:25
111
0
My code doesn't work... How do I make a grid in pdf output in R?
I am scratching my head for the following code. I am following this example: http://stackoverflow.com/questions/6681145/how-can-i-arrange-an-arbitrary-number-of-ggplots-using-grid-arrange I wanted to collect the plots and lay them out on a 3x9 grid and each grid with suitable labels... But it doesn't work. The pdf generated is still one-plot-per-page - so there are 27 pages generated. I am trying to use "grid.arrange", however, the function "plotFunctionWrittenByOtherPeople" was written by other people, and it doesn't return a handle to the plot... and it's quite complicated. How to arrange the plots nicely? Could anybody please shed some lights on this? Thanks a lot! -------------------- pdf("mytry1.pdf", width = 11, height = 8.5) par(mfrow=c(3, 9)) for (a in seq(100, 900, by=100)) for (b in c(1, 3, 6)) { plotFunctionWrittenByOtherPeople(a, b) } dev.off()
r
grid
plot
ggplot2
ggplot
null
open
My code doesn't work... How do I make a grid in pdf output in R? === I am scratching my head for the following code. I am following this example: http://stackoverflow.com/questions/6681145/how-can-i-arrange-an-arbitrary-number-of-ggplots-using-grid-arrange I wanted to collect the plots and lay them out on a 3x9 grid and each grid with suitable labels... But it doesn't work. The pdf generated is still one-plot-per-page - so there are 27 pages generated. I am trying to use "grid.arrange", however, the function "plotFunctionWrittenByOtherPeople" was written by other people, and it doesn't return a handle to the plot... and it's quite complicated. How to arrange the plots nicely? Could anybody please shed some lights on this? Thanks a lot! -------------------- pdf("mytry1.pdf", width = 11, height = 8.5) par(mfrow=c(3, 9)) for (a in seq(100, 900, by=100)) for (b in c(1, 3, 6)) { plotFunctionWrittenByOtherPeople(a, b) } dev.off()
0
11,571,488
07/20/2012 01:02:22
772,481
04/27/2011 09:02:26
321
8
Use MagicalRecord with another existing context in RestKit
I want to keep using my current RestKit while use MagicRecord for rest of fetches and updates. I want Restkit's MOC send updates to MagicRecord's default context. If I understand right, this is what I am doing. Is this ok? NSManagedObjectContext* context = [[RKObjectManager sharedManager].objectStore managedObjectContextForCurrentThread]; [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:[XDBStore storeName]]; [context setParentContext:[NSManagedObjectContext MR_defaultContext]]; Maybe another way to do it, but still not sure. NSPersistentStoreCoordinator *coordinator = [[[RKObjectManager sharedManager] objectStore] persistentStoreCoordinator]; [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; Anyone had same issue before?
objective-c
ios
core-data
magicalrecord
null
null
open
Use MagicalRecord with another existing context in RestKit === I want to keep using my current RestKit while use MagicRecord for rest of fetches and updates. I want Restkit's MOC send updates to MagicRecord's default context. If I understand right, this is what I am doing. Is this ok? NSManagedObjectContext* context = [[RKObjectManager sharedManager].objectStore managedObjectContextForCurrentThread]; [MagicalRecord setupCoreDataStackWithAutoMigratingSqliteStoreNamed:[XDBStore storeName]]; [context setParentContext:[NSManagedObjectContext MR_defaultContext]]; Maybe another way to do it, but still not sure. NSPersistentStoreCoordinator *coordinator = [[[RKObjectManager sharedManager] objectStore] persistentStoreCoordinator]; [NSPersistentStoreCoordinator MR_setDefaultStoreCoordinator:coordinator]; [NSManagedObjectContext MR_initializeDefaultContextWithCoordinator:coordinator]; Anyone had same issue before?
0
11,571,484
07/20/2012 01:02:01
335,514
05/07/2010 14:21:41
1,064
54
window.location - javascript - not working
Odd issue. I am using jquery postmessage to send messages from a secure iframe to the parent. Specifically I am sending a url and have confirmed that the parent is receiving the url - however, when I use try to set window.location to that url nothing happens. The sent url: http://mydomain.com/shop/507870?nav=ln-474#/shop/507870?gnrefine=1*COLOR_FAMILY*Brown%5E1*CLSR_TYP*Lace-Up%5E the actual url: http://mydomain.com/shop/507870?nav=ln-474#/shop/507870?gnrefine=1*COLOR_FAMILY*Brown%5E1*CLSR_TYP*Lace-Up%5E they match. However, in chrome, if I do a console.log(loginConfig.redirectURL); I get: http://mydomain.com/shop/507870?nav=ln-474#/shop/507870?gnrefine=1*COLOR_FAMILY*Brown%5E1*CLSR_TYP*Lace-Up%5E >undefined So, I think the window.location is getting the undefined value... any thoughts on why I would be getting 2 values when I use the console.log?
javascript
window.location
null
null
null
null
open
window.location - javascript - not working === Odd issue. I am using jquery postmessage to send messages from a secure iframe to the parent. Specifically I am sending a url and have confirmed that the parent is receiving the url - however, when I use try to set window.location to that url nothing happens. The sent url: http://mydomain.com/shop/507870?nav=ln-474#/shop/507870?gnrefine=1*COLOR_FAMILY*Brown%5E1*CLSR_TYP*Lace-Up%5E the actual url: http://mydomain.com/shop/507870?nav=ln-474#/shop/507870?gnrefine=1*COLOR_FAMILY*Brown%5E1*CLSR_TYP*Lace-Up%5E they match. However, in chrome, if I do a console.log(loginConfig.redirectURL); I get: http://mydomain.com/shop/507870?nav=ln-474#/shop/507870?gnrefine=1*COLOR_FAMILY*Brown%5E1*CLSR_TYP*Lace-Up%5E >undefined So, I think the window.location is getting the undefined value... any thoughts on why I would be getting 2 values when I use the console.log?
0
11,571,486
07/20/2012 01:02:14
1,266,527
03/13/2012 13:08:06
13
2
HTTP basic auth over SSL
So, I have an SSL certificate for secure.domain.com. I run a few admin web applications on this domain (git repo etc), authenticated using .htaccess basic auth. When I communicate with the domain over https and it asks me to authenticate, has it verified the certificate or does it verify after I've authenticated? Similarly, if I connect over http, is there a simple way to forward to request to https and then authenticate?
http
.htaccess
ssl
https
http-basic-authentication
null
open
HTTP basic auth over SSL === So, I have an SSL certificate for secure.domain.com. I run a few admin web applications on this domain (git repo etc), authenticated using .htaccess basic auth. When I communicate with the domain over https and it asks me to authenticate, has it verified the certificate or does it verify after I've authenticated? Similarly, if I connect over http, is there a simple way to forward to request to https and then authenticate?
0
11,571,496
07/20/2012 01:04:08
817,527
06/27/2011 14:05:26
628
9
needed method to accomplish this SQL query
I need a way to define a variable to hold the result of an expression in MYSQL so that I can use that variable throughout the query. So that this is possible: SELECT IF(VALID,EMPLOYEE_NAME,"NULL") AS NAME, /** <-- Note *VALID* IF(VALID,ID,"NULL") AS ID, /** <-- And here... IF(VALID,OCCUPATION,"NULL") AS OCCUPATION, /** <-- And here... IF((**LONG EXPRESSION**), TRUE, FALSE) AS VALID; /** <-- Taken from here where LONG EXPRESSION can be very loong expression that I need to put for every returned Column in the IF statement, there are many IFs. My instinct tells me that I should be able to do this like in every procedural language: $var = LONG_EXPRESSION(....); if($var) {..}; if($var) {..}; if($var) {..}; if($var) {..}; This way it is a lot more logical and less error prone. easily maintained, readable, perhaps even optimized. Is there an equivalent for this inside MYSQL ? Thus, defining a parameter for every single row of execution ?
php
mysql
sql
null
null
null
open
needed method to accomplish this SQL query === I need a way to define a variable to hold the result of an expression in MYSQL so that I can use that variable throughout the query. So that this is possible: SELECT IF(VALID,EMPLOYEE_NAME,"NULL") AS NAME, /** <-- Note *VALID* IF(VALID,ID,"NULL") AS ID, /** <-- And here... IF(VALID,OCCUPATION,"NULL") AS OCCUPATION, /** <-- And here... IF((**LONG EXPRESSION**), TRUE, FALSE) AS VALID; /** <-- Taken from here where LONG EXPRESSION can be very loong expression that I need to put for every returned Column in the IF statement, there are many IFs. My instinct tells me that I should be able to do this like in every procedural language: $var = LONG_EXPRESSION(....); if($var) {..}; if($var) {..}; if($var) {..}; if($var) {..}; This way it is a lot more logical and less error prone. easily maintained, readable, perhaps even optimized. Is there an equivalent for this inside MYSQL ? Thus, defining a parameter for every single row of execution ?
0
11,386,838
07/08/2012 21:25:22
650,180
03/08/2011 16:50:35
107
11
using minus sign in zend routes
Is it possible to use minus sign within url so that zend route can handle it ? Currently, i have in my application config : resources.router.routes.post.route = "1-:id-:title" resources.router.routes.post.defaults.controller = category resources.router.routes.post.defaults.action = index but zend route is not able to resolve that request_uri : **/1-1-T_Shirt__Chemise** However if i put resources.router.routes.post.route = "1/:id/:title" zend route is nicely resolving that request_uri : **/1/1/T_Shirt__Chemise** Any ideas ?
zend-framework
routes
null
null
null
null
open
using minus sign in zend routes === Is it possible to use minus sign within url so that zend route can handle it ? Currently, i have in my application config : resources.router.routes.post.route = "1-:id-:title" resources.router.routes.post.defaults.controller = category resources.router.routes.post.defaults.action = index but zend route is not able to resolve that request_uri : **/1-1-T_Shirt__Chemise** However if i put resources.router.routes.post.route = "1/:id/:title" zend route is nicely resolving that request_uri : **/1/1/T_Shirt__Chemise** Any ideas ?
0
11,386,839
07/08/2012 21:25:28
1,263,918
03/12/2012 10:53:55
1
0
Updating a column in a list in Sharepoint
I have a sharepoint list "Faculty application doc library. When a document is inserted, a workflow is fired that takes some feedback from recommenders and show the feedback to the committee chair. The chair takes a decision (accepted, rejected etc.) and a new list item is inserted in the corresponding list. This is working with no issues. Now i want to link another document with this list item. Say "111_TESTUsername" is uploaded and feedback is collected and chair takes a decision. Now I want "111_TEstUsername_Signed" to be uploaded and linked to the original document "111_TESTUsername". I searched a bit on how to upload another document but I couldn't find much help. Then I thought why not upload the "111_TEstUsername_Signed" document to a new library and link it with the other document in the other library through the file no. "111". I created a calculated column that gets the "111" from the filename, but how do I LINK this document in this list with the other document in the other list? Any ideas?
list
sharepoint
columns
null
null
null
open
Updating a column in a list in Sharepoint === I have a sharepoint list "Faculty application doc library. When a document is inserted, a workflow is fired that takes some feedback from recommenders and show the feedback to the committee chair. The chair takes a decision (accepted, rejected etc.) and a new list item is inserted in the corresponding list. This is working with no issues. Now i want to link another document with this list item. Say "111_TESTUsername" is uploaded and feedback is collected and chair takes a decision. Now I want "111_TEstUsername_Signed" to be uploaded and linked to the original document "111_TESTUsername". I searched a bit on how to upload another document but I couldn't find much help. Then I thought why not upload the "111_TEstUsername_Signed" document to a new library and link it with the other document in the other library through the file no. "111". I created a calculated column that gets the "111" from the filename, but how do I LINK this document in this list with the other document in the other list? Any ideas?
0
11,386,841
07/08/2012 21:25:36
1,253,575
03/07/2012 01:00:26
158
3
Android - Notification Icon
I would like to set an other default Icon for my notifications. I use the service of [parse.com][1] and yould like to change the icon in the notificions bar. Is that possible without changing the Title and the Text with Notifications.builder? [1]: http://www.parse.com
android
null
null
null
null
null
open
Android - Notification Icon === I would like to set an other default Icon for my notifications. I use the service of [parse.com][1] and yould like to change the icon in the notificions bar. Is that possible without changing the Title and the Text with Notifications.builder? [1]: http://www.parse.com
0
11,386,843
07/08/2012 21:25:37
1,510,578
07/08/2012 21:12:00
1
0
PHP: header() function not redirecting. When redirecting with HTML or JavaScript, Session information is lost
This is a PHP/Apache question... 1. I have the following code. In particular I would like to emphasize the following: // store email in session variable $_SESSION["jobseeker_email"] = $_POST["jobseeker_email"]; // perform redirect $target = util_siblingurl("jobseekermain.php", true); header("Location: " . $target); exit; /* ensure code below does not executed when we redirect */ which is where the problem lies. When I execute this code on localhost it works fine, but then when I execute it on the remote server (which is an ipage.com hosted site), I do not get the desired outcome. In fact, when the header("Location: $target); part runs I see a blank page (and no redirect). It's as though something was being output before the call to header(), but this is not the case, as I've checked it. So why is it not working? 2. If I comment out the part that invokes header() and then exit, I am able to perform either an html redirect or a javascript redirect. However, when I do this I lose my session variable $_SESSION["jobseeker_email"]. I cannot understand why this happens. Any help with these issues would be greatly appreciated as I need to perform a redirect and still retain the session state from the former page, and all of this on a server (not just on localhost). Thanks, John Goche <?php session_start(); require_once('include/connect.php'); require_once('include/util.php'); util_ensure_secure(); if (isset($_GET['logout'])) { session_destroy(); // restart session header("Location: " . util_selfurl(true)); } function do_match_passwords($password1, $password2) { return strcmp($password1, $password2) == 0; } function valid_employer_login($email, $password) { global $mysqli; global $employer_error; $query = "SELECT passwd FROM Employer WHERE email = '" . $mysqli->escape_string($email) . "'"; $result = $mysqli->query($query); util_check_query_result($query, $result); $invalid_credentials = false; if ($result->num_rows == 0) { $invalid_credentials = true; } else { $row = $result->fetch_assoc(); $retrieved_password = $row["passwd"]; if (!do_match_passwords($password, $retrieved_password)) $invalid_credentials = true; } if ($invalid_credentials) { $employer_error = "Invalid credentials."; return false; } return true; } function valid_jobseeker_login($email, $password) { global $mysqli; global $jobseeker_error; $query = "SELECT passwd FROM JobSeeker WHERE email = '" . $mysqli->escape_string($email) . "'"; $result = $mysqli->query($query); util_check_query_result($query, $result); $invalid_credentials = false; if ($result->num_rows == 0) { $invalid_credentials = true; } else { $row = $result->fetch_assoc(); $retrieved_password = $row["passwd"]; if (!do_match_passwords($password, $retrieved_password)) $invalid_credentials = true; } if ($invalid_credentials) { $jobseeker_error = "Invalid credentials."; return false; } return true; } if (isset($_POST["employer_submitted"])) { global $error; // check whether specified username and password have been entered correctly if (valid_employer_login($_POST["employer_email"], $_POST["employer_password"])) { // store email in session variable $_SESSION["employer_email"] = $_POST["employer_email"]; // perform redirect $target = util_siblingurl("jobseekermain.php", true); header("Location: " . $target); exit; /* ensure code below does not executed when we redirect */ } } if (isset($_POST["jobseeker_submitted"])) { global $error; // check whether specified username and password have been entered correctly if (valid_jobseeker_login($_POST["jobseeker_email"], $_POST["jobseeker_password"])) { // store email in session variable $_SESSION["jobseeker_email"] = $_POST["jobseeker_email"]; // perform redirect $target = util_siblingurl("jobseekermain.php", true); header("Location: " . $target); exit; /* ensure code below does not executed when we redirect */ } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Work Net: Sign In</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <h1>Work Net: Sign In</h1> <div id="content"> <ul> <li> <h2>Employers</h2> <p><a href="accountcreate.php?accounttype=employer">Create new employer account.</a></p> <form method="post" action="<?php util_selfurl(true); ?>"> <table> <tr> <td>E-mail:</td> <td><input type="text" name="employer_email" value="<?= htmlentities(util_setvalueorblank($_POST['employer_email'])); ?>" /> </tr> <tr> <td>Password:</td> <td><input type="password" name="employer_password" value="<?= htmlentities(util_setvalueorblank($_POST['employer_password'])); ?>" /></td> </tr> </table> <?php if (isset($employer_error)) echo "<p style=\"color: red;\">" . htmlentities($employer_error) . "</p>"; ?> <input type="hidden" name="employer_submitted" /> <input type="submit" value="Sign In" /> </form> <p><a href="forgottenpassword.php?accounttype=employer">Forgotten Employer Password.</a></p> </li> <li> <h2>Job Seekers</h2> <p><a href="accountcreate.php?accounttype=jobseeker">Create new job seeker account.</a></p> <form method="post" action="<?php util_selfurl(true); ?>"> <table> <tr> <td>E-mail:</td> <td><input type="text" name="jobseeker_email" value="<?= htmlentities(util_setvalueorblank($_POST['jobseeker_email'])); ?>" /> </tr> <tr> <td>Password:</td> <td><input type="password" name="jobseeker_password" value="<?= htmlentities(util_setvalueorblank($_POST['jobseeker_password'])); ?>" /></td> </tr> </table> <?php if (isset($jobseeker_error)) echo "<p style=\"color: red;\">" . htmlentities($jobseeker_error) . "</p>"; ?> <input type="hidden" name="jobseeker_submitted" /> <input type="submit" value="Sign In" /> </form> <p><a href="forgottenpassword.php?accounttype=jobseeker">Forgotten Job Seeker Password.</a></p> </li> </ul> </div> <div id="footer"> <p> <?php include('markup/footer.php'); ?> </p> </div><!-- end #footer --> </div><!-- end #container --> </body> </html>
php
javascript
apache
redirect
http-redirect
null
open
PHP: header() function not redirecting. When redirecting with HTML or JavaScript, Session information is lost === This is a PHP/Apache question... 1. I have the following code. In particular I would like to emphasize the following: // store email in session variable $_SESSION["jobseeker_email"] = $_POST["jobseeker_email"]; // perform redirect $target = util_siblingurl("jobseekermain.php", true); header("Location: " . $target); exit; /* ensure code below does not executed when we redirect */ which is where the problem lies. When I execute this code on localhost it works fine, but then when I execute it on the remote server (which is an ipage.com hosted site), I do not get the desired outcome. In fact, when the header("Location: $target); part runs I see a blank page (and no redirect). It's as though something was being output before the call to header(), but this is not the case, as I've checked it. So why is it not working? 2. If I comment out the part that invokes header() and then exit, I am able to perform either an html redirect or a javascript redirect. However, when I do this I lose my session variable $_SESSION["jobseeker_email"]. I cannot understand why this happens. Any help with these issues would be greatly appreciated as I need to perform a redirect and still retain the session state from the former page, and all of this on a server (not just on localhost). Thanks, John Goche <?php session_start(); require_once('include/connect.php'); require_once('include/util.php'); util_ensure_secure(); if (isset($_GET['logout'])) { session_destroy(); // restart session header("Location: " . util_selfurl(true)); } function do_match_passwords($password1, $password2) { return strcmp($password1, $password2) == 0; } function valid_employer_login($email, $password) { global $mysqli; global $employer_error; $query = "SELECT passwd FROM Employer WHERE email = '" . $mysqli->escape_string($email) . "'"; $result = $mysqli->query($query); util_check_query_result($query, $result); $invalid_credentials = false; if ($result->num_rows == 0) { $invalid_credentials = true; } else { $row = $result->fetch_assoc(); $retrieved_password = $row["passwd"]; if (!do_match_passwords($password, $retrieved_password)) $invalid_credentials = true; } if ($invalid_credentials) { $employer_error = "Invalid credentials."; return false; } return true; } function valid_jobseeker_login($email, $password) { global $mysqli; global $jobseeker_error; $query = "SELECT passwd FROM JobSeeker WHERE email = '" . $mysqli->escape_string($email) . "'"; $result = $mysqli->query($query); util_check_query_result($query, $result); $invalid_credentials = false; if ($result->num_rows == 0) { $invalid_credentials = true; } else { $row = $result->fetch_assoc(); $retrieved_password = $row["passwd"]; if (!do_match_passwords($password, $retrieved_password)) $invalid_credentials = true; } if ($invalid_credentials) { $jobseeker_error = "Invalid credentials."; return false; } return true; } if (isset($_POST["employer_submitted"])) { global $error; // check whether specified username and password have been entered correctly if (valid_employer_login($_POST["employer_email"], $_POST["employer_password"])) { // store email in session variable $_SESSION["employer_email"] = $_POST["employer_email"]; // perform redirect $target = util_siblingurl("jobseekermain.php", true); header("Location: " . $target); exit; /* ensure code below does not executed when we redirect */ } } if (isset($_POST["jobseeker_submitted"])) { global $error; // check whether specified username and password have been entered correctly if (valid_jobseeker_login($_POST["jobseeker_email"], $_POST["jobseeker_password"])) { // store email in session variable $_SESSION["jobseeker_email"] = $_POST["jobseeker_email"]; // perform redirect $target = util_siblingurl("jobseekermain.php", true); header("Location: " . $target); exit; /* ensure code below does not executed when we redirect */ } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Work Net: Sign In</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <h1>Work Net: Sign In</h1> <div id="content"> <ul> <li> <h2>Employers</h2> <p><a href="accountcreate.php?accounttype=employer">Create new employer account.</a></p> <form method="post" action="<?php util_selfurl(true); ?>"> <table> <tr> <td>E-mail:</td> <td><input type="text" name="employer_email" value="<?= htmlentities(util_setvalueorblank($_POST['employer_email'])); ?>" /> </tr> <tr> <td>Password:</td> <td><input type="password" name="employer_password" value="<?= htmlentities(util_setvalueorblank($_POST['employer_password'])); ?>" /></td> </tr> </table> <?php if (isset($employer_error)) echo "<p style=\"color: red;\">" . htmlentities($employer_error) . "</p>"; ?> <input type="hidden" name="employer_submitted" /> <input type="submit" value="Sign In" /> </form> <p><a href="forgottenpassword.php?accounttype=employer">Forgotten Employer Password.</a></p> </li> <li> <h2>Job Seekers</h2> <p><a href="accountcreate.php?accounttype=jobseeker">Create new job seeker account.</a></p> <form method="post" action="<?php util_selfurl(true); ?>"> <table> <tr> <td>E-mail:</td> <td><input type="text" name="jobseeker_email" value="<?= htmlentities(util_setvalueorblank($_POST['jobseeker_email'])); ?>" /> </tr> <tr> <td>Password:</td> <td><input type="password" name="jobseeker_password" value="<?= htmlentities(util_setvalueorblank($_POST['jobseeker_password'])); ?>" /></td> </tr> </table> <?php if (isset($jobseeker_error)) echo "<p style=\"color: red;\">" . htmlentities($jobseeker_error) . "</p>"; ?> <input type="hidden" name="jobseeker_submitted" /> <input type="submit" value="Sign In" /> </form> <p><a href="forgottenpassword.php?accounttype=jobseeker">Forgotten Job Seeker Password.</a></p> </li> </ul> </div> <div id="footer"> <p> <?php include('markup/footer.php'); ?> </p> </div><!-- end #footer --> </div><!-- end #container --> </body> </html>
0
11,386,849
07/08/2012 21:26:37
1,320,749
04/08/2012 20:20:09
2
0
my cursor always returning some value
m new to android. When i m using db.query to retrieve and compare username it always returning some value it have to return null when value not matches. here is code public boolean check(String name) { SQLiteDatabase db = DB.getReadableDatabase(); Cursor cursor = null; try{ cursor=db.rawQuery("SELECT * FROM "+ DBHelper.Login_Table + " WHERE "+ DBHelper.KEY_USERNAME + "='" + name + "'",null); } catch(Exception e) { e.printStackTrace(); } if (cursor!=null) { Log.i("someTAG","Error .. USERNAME EXIST"); cursor.moveToFirst(); return true; } else { Log.i("someTAG","Error .. NOT EXIST"); return false; } }
android
sqlite
null
null
null
null
open
my cursor always returning some value === m new to android. When i m using db.query to retrieve and compare username it always returning some value it have to return null when value not matches. here is code public boolean check(String name) { SQLiteDatabase db = DB.getReadableDatabase(); Cursor cursor = null; try{ cursor=db.rawQuery("SELECT * FROM "+ DBHelper.Login_Table + " WHERE "+ DBHelper.KEY_USERNAME + "='" + name + "'",null); } catch(Exception e) { e.printStackTrace(); } if (cursor!=null) { Log.i("someTAG","Error .. USERNAME EXIST"); cursor.moveToFirst(); return true; } else { Log.i("someTAG","Error .. NOT EXIST"); return false; } }
0
11,386,854
07/08/2012 21:27:23
445,131
09/11/2010 14:45:09
616
41
GNU Octave method to operate on each item in a matrix. octave "arrayfun(...)" example
In GNU Octave version 3.4.3, I am having trouble applying a custom function to operate on each item/element in a matrix. I have a matrix: mymatrix = [1,2,3;4,5,6]; I want to use each element of the matrix as an input, and run a custom function against it, and have the output of the function replace the content of mymatrix item by item. I can't figure out the syntax of how to get it to work.
linux
function
octave
null
null
null
open
GNU Octave method to operate on each item in a matrix. octave "arrayfun(...)" example === In GNU Octave version 3.4.3, I am having trouble applying a custom function to operate on each item/element in a matrix. I have a matrix: mymatrix = [1,2,3;4,5,6]; I want to use each element of the matrix as an input, and run a custom function against it, and have the output of the function replace the content of mymatrix item by item. I can't figure out the syntax of how to get it to work.
0
11,386,855
07/08/2012 21:27:51
247,668
01/10/2010 22:14:19
25
0
Android Animation and Interpolators
How do I correctly set the `android:interpolator` between different Android versions in a view animation? ICS+ comes with `@android:interpolator/` and as far as I know, Eclair and possibly up to ICS provide `@android:anim/` as a set of interpolators. My app crashes on ICS+ if I have set in my view animation under `android:interpolator` a value from `@android:anim/`. It also does not build on Eclair if I use a value from `@android:interpolator/`. How do I do this correctly?
android
android-animation
null
null
null
null
open
Android Animation and Interpolators === How do I correctly set the `android:interpolator` between different Android versions in a view animation? ICS+ comes with `@android:interpolator/` and as far as I know, Eclair and possibly up to ICS provide `@android:anim/` as a set of interpolators. My app crashes on ICS+ if I have set in my view animation under `android:interpolator` a value from `@android:anim/`. It also does not build on Eclair if I use a value from `@android:interpolator/`. How do I do this correctly?
0
11,386,864
07/08/2012 21:29:59
1,496,936
07/02/2012 19:02:52
67
4
strange behaviour of jquery 'click' event
I had an anchor tag <li><a href="#" class="institution">Click me</a></li> <li><a href="#" class="department">Click me</a></li> <li><a href="#" class="branch">Click me</a></li> i wanted to execute some code by clicking on the anchor tag.so i used $('a').click(function(){ do something.. }); but it did not work out. So I used $('a').on('click',function(){ do something.. }); also i used $('a').bind('click',function(){ do something.. }); but they did not work either. what worked for me was $('a').live('click',function(){ do something.. }); why is this so..when all of them are supposed to show same behaviour.
jquery
null
null
null
null
null
open
strange behaviour of jquery 'click' event === I had an anchor tag <li><a href="#" class="institution">Click me</a></li> <li><a href="#" class="department">Click me</a></li> <li><a href="#" class="branch">Click me</a></li> i wanted to execute some code by clicking on the anchor tag.so i used $('a').click(function(){ do something.. }); but it did not work out. So I used $('a').on('click',function(){ do something.. }); also i used $('a').bind('click',function(){ do something.. }); but they did not work either. what worked for me was $('a').live('click',function(){ do something.. }); why is this so..when all of them are supposed to show same behaviour.
0
11,386,865
07/08/2012 21:30:02
1,510,596
07/08/2012 21:25:07
1
0
Alternative way for Documenting your code than inline comments
I was wondering how can you document you code without using inline comments, With inline commenting you can always use Doxygen to create to Documentation of your code. but I don't feel like mixing up code with comments, hence need an alternative way for documenting. Any one has tried this ?
xcode
documentation
comments
alternative
null
07/09/2012 16:46:56
not a real question
Alternative way for Documenting your code than inline comments === I was wondering how can you document you code without using inline comments, With inline commenting you can always use Doxygen to create to Documentation of your code. but I don't feel like mixing up code with comments, hence need an alternative way for documenting. Any one has tried this ?
1
11,650,264
07/25/2012 12:58:32
957,186
09/21/2011 14:32:38
51
9
How can I call a json object array, which is in one function, into another function?
This is puzzling me. How can I make the following json function... $.mfjson = function() { var mjson = { LinkToDesktopSite : [ {"section":"aboutus","name":"DemoA","mobile":"demoa.htm","desktop":"/desktop/demoa.aspx"}, {"section":"google","name":"DemoB","mobile":"demob.htm","desktop":"http://www.google.com"} ]}; } ...communicate with my .each method that is in another function... $.loopjson = function() { $.each(mfjson().mjson.LinkToDesktopSite, function(key,value) { var external = "www."; if((value['mobile'] == url)) { if((value['desktop'].indexOf(external) == -1)) { $('.readmore').attr("href","https://www.mysite.org"+value['desktop']); }else{ $('.readmore').attr("href",value['desktop']); } } }); } Getting firebug console errors saying that .loopjson has no clue what mfjson is. Thanks for any advice!
jquery
json
null
null
null
null
open
How can I call a json object array, which is in one function, into another function? === This is puzzling me. How can I make the following json function... $.mfjson = function() { var mjson = { LinkToDesktopSite : [ {"section":"aboutus","name":"DemoA","mobile":"demoa.htm","desktop":"/desktop/demoa.aspx"}, {"section":"google","name":"DemoB","mobile":"demob.htm","desktop":"http://www.google.com"} ]}; } ...communicate with my .each method that is in another function... $.loopjson = function() { $.each(mfjson().mjson.LinkToDesktopSite, function(key,value) { var external = "www."; if((value['mobile'] == url)) { if((value['desktop'].indexOf(external) == -1)) { $('.readmore').attr("href","https://www.mysite.org"+value['desktop']); }else{ $('.readmore').attr("href",value['desktop']); } } }); } Getting firebug console errors saying that .loopjson has no clue what mfjson is. Thanks for any advice!
0
11,649,667
07/25/2012 12:26:09
1,551,545
07/25/2012 12:15:36
1
0
how to upload all image files of a directory in mysql database using php
how to upload all image files of a directory in mysql database using php, it is possible to upload all file by selecting one by one, but can it be done by selecting only directory for all file under those directory.
mysql
php-5.3
null
null
null
null
open
how to upload all image files of a directory in mysql database using php === how to upload all image files of a directory in mysql database using php, it is possible to upload all file by selecting one by one, but can it be done by selecting only directory for all file under those directory.
0
11,634,242
07/24/2012 15:29:39
348,686
05/24/2010 05:28:56
153
3
OnHold Call information in android
In my android application I am listening to phone state listening to PhoneState. In this I want to know know whether any call is onHold. Can I do that? Thanks in advance
android
null
null
null
null
null
open
OnHold Call information in android === In my android application I am listening to phone state listening to PhoneState. In this I want to know know whether any call is onHold. Can I do that? Thanks in advance
0
11,650,271
07/25/2012 12:58:56
1,551,357
07/25/2012 10:53:20
1
0
Jquery left click event with cell
Example code: Simple Context Menu This pop up opening after right click on link.. but same result want to get after clicking on any cell in the website. $(function(){ $.contextMenu({ selector: '.context-menu-one', callback: function(key, options) { var m = "clicked: " + key; window.console && console.log(m) || alert(m); }, items: { "edit": {name: "Edit", icon: "edit"}, "cut": {name: "Cut", icon: "cut"}, "copy": {name: "Copy", icon: "copy"}, "paste": {name: "Paste", icon: "paste"}, "delete": {name: "Delete", icon: "delete"}, "sep1": "---------", "quit": {name: "Quit", icon: "quit"} } }); $('.context-menu-one').on('click', function(e){ console.log('clicked', this); }) }); <div class="context-menu-one box menu-1"> <strong>right click me</strong> </div>
jquery
jquery-ajax
jquery-plugins
null
null
null
open
Jquery left click event with cell === Example code: Simple Context Menu This pop up opening after right click on link.. but same result want to get after clicking on any cell in the website. $(function(){ $.contextMenu({ selector: '.context-menu-one', callback: function(key, options) { var m = "clicked: " + key; window.console && console.log(m) || alert(m); }, items: { "edit": {name: "Edit", icon: "edit"}, "cut": {name: "Cut", icon: "cut"}, "copy": {name: "Copy", icon: "copy"}, "paste": {name: "Paste", icon: "paste"}, "delete": {name: "Delete", icon: "delete"}, "sep1": "---------", "quit": {name: "Quit", icon: "quit"} } }); $('.context-menu-one').on('click', function(e){ console.log('clicked', this); }) }); <div class="context-menu-one box menu-1"> <strong>right click me</strong> </div>
0
11,650,278
07/25/2012 12:59:07
788,700
06/08/2011 06:55:18
702
42
Apply face color basing on the colomn number
There are so-called strict formats, like [pdb](http://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)) - where the meaning of the symbol is defined by the colomn number of the symbol. For example [here](http://www.wwpdb.org/documentation/format32/sect9.html#ATOM) is a specification of the above mentioned pdb format. Is there a way I can apply face colour basing on the column range? One can normally add a regexp to be highlighted, for example for the current session in the following way: (font-lock-add-keywords nil '(("\\[\\(.+?\\)\\]" . font-lock-keyword-face))) So is there a way to specify that face at columns, say 7-11 - should be, say - red?
emacs
syntax-highlighting
strict
null
null
null
open
Apply face color basing on the colomn number === There are so-called strict formats, like [pdb](http://en.wikipedia.org/wiki/Protein_Data_Bank_(file_format)) - where the meaning of the symbol is defined by the colomn number of the symbol. For example [here](http://www.wwpdb.org/documentation/format32/sect9.html#ATOM) is a specification of the above mentioned pdb format. Is there a way I can apply face colour basing on the column range? One can normally add a regexp to be highlighted, for example for the current session in the following way: (font-lock-add-keywords nil '(("\\[\\(.+?\\)\\]" . font-lock-keyword-face))) So is there a way to specify that face at columns, say 7-11 - should be, say - red?
0
11,650,287
07/25/2012 12:59:30
787,793
06/07/2011 15:42:46
504
21
Checkbox ajax request on check/uncheck
I have a checkbox on razor view engine as: @Html.CheckBoxFor(model => model.Attempt, new { id = "Attempt" }) I wanted to make ajax request on each check/uncheck on the checkbox. So, i used the javascript, $(document).ready(function () { // Some other functions here $('#Attempt input:checkbox').change(function () { $.ajax({ url: '@Url.Action("Select", "Test")', type: 'POST', data: { attempt: true }, }); }) }); But it is not working at all. No request is being sent at all. What am i missing? Also, how to map data `attempt` true or false according to check/uncheck ?
javascript
ajax
asp.net-mvc
razor
null
null
open
Checkbox ajax request on check/uncheck === I have a checkbox on razor view engine as: @Html.CheckBoxFor(model => model.Attempt, new { id = "Attempt" }) I wanted to make ajax request on each check/uncheck on the checkbox. So, i used the javascript, $(document).ready(function () { // Some other functions here $('#Attempt input:checkbox').change(function () { $.ajax({ url: '@Url.Action("Select", "Test")', type: 'POST', data: { attempt: true }, }); }) }); But it is not working at all. No request is being sent at all. What am i missing? Also, how to map data `attempt` true or false according to check/uncheck ?
0
11,650,124
07/25/2012 12:50:38
1,514,983
07/10/2012 13:54:01
1
1
getting link of html element on MouseDown event in WebBrowser
How can I retrieve a html element from MouseDown event? I have a following code: public void Scrollback_Clicked(object sender, HtmlElementEventArgs e) { if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right) { if (e.FromElement != null) { if (e.FromElement.Name == "a") { ViewLn(e.FromElement.InnerText); } } } } e.FromElement is null. I need to retrieve the `HtmlElement` when I right click on any link in browser.
c#
null
null
null
null
null
open
getting link of html element on MouseDown event in WebBrowser === How can I retrieve a html element from MouseDown event? I have a following code: public void Scrollback_Clicked(object sender, HtmlElementEventArgs e) { if (e.MouseButtonsPressed == System.Windows.Forms.MouseButtons.Right) { if (e.FromElement != null) { if (e.FromElement.Name == "a") { ViewLn(e.FromElement.InnerText); } } } } e.FromElement is null. I need to retrieve the `HtmlElement` when I right click on any link in browser.
0
11,349,347
07/05/2012 17:21:43
227,200
09/18/2009 16:10:41
3,127
145
Using the Windsor NHibernateFacility in a Wcf Service with a custom service behavior for creating transactions instead of the Transaction attribute
I am trying to use the Windsor NHibernate Facility for the first time in a Wcf service and replace the current manual registration of NHibernate so that there can be a consistent approach across all services. Current working approach - Previously I had been registering the NHibernate components manually. <!-- language: lang-cs --> container.Register( Component.For<ISessionFactory>().UsingFactoryMethod(() => CreateMappings("SomeConnectionString").BuildSessionFactory())); container.Register( Component.For<ISession>().LifeStyle.PerWcfOperation().UsingFactoryMethod(OpenSession)); I was then using a custom service behavior to create and complete a transaction scope for each operation. <!-- language: lang-cs --> public class TransactionBehavior : IServiceBehavior { public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { foreach (var cdb in serviceHostBase.ChannelDispatchers) { var channelDispatcher = cdb as ChannelDispatcher; if (null == channelDispatcher) continue; foreach (var endpointDispatcher in channelDispatcher.Endpoints) { foreach (var dispatchOperation in endpointDispatcher.DispatchRuntime.Operations) { dispatchOperation.CallContextInitializers.Add(new TransactionContext()); } } } } public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } } public class TransactionContext : ICallContextInitializer { private TransactionScope transaction; public Object BeforeInvoke(InstanceContext instanceContext, IClientChannel channel, Message message) { transaction = new TransactionScope(); return null; } public void AfterInvoke(Object correlationState) { if(transaction != null) { transaction.Complete(); transaction.Dispose(); } } } Integration of the NHibernate Facility - I have downloaded the [0.3.1.2001 artifacts][1] and using the resources below I have tried to plug in the facility and remove any manual wire up to NHibernate. However I do not want to decorate services and methods with the `Transactional` and `Transaction` attributes. The following is my current wire up. <!-- language: lang-cs --> container.Register(Component.For<INHibernateInstaller>().ImplementedBy<MyNHibernateInstaller>(); container.AddFacility<AutoTxFacility>(); container.AddFacility<NHibernateFacility>(); public class MyNHibernateInstaller : INHibernateInstaller { public Maybe<IInterceptor> Interceptor { get { return Maybe.None<IInterceptor>(); } } public bool IsDefault { get { return true; } } public string SessionFactoryKey { get { return "sf.default"; } } public FluentConfiguration BuildFluent() { return Fluently .Configure() .Database(MsSqlConfiguration .MsSql2005.ConnectionString("SomeConnectionString") ) .Mappings( m => m.FluentMappings .AddFromAssemblyOf<TypeFromEntityAssembly>() ); } public void Registered(ISessionFactory factory) { } } Whenever I call one of the service endpoints the service fails with the following exception: > No transaction in context when trying to instantiate model > 'NHibernate.ISession' for resolve type > 'Juice.iCheque.eMoneySystem.Settlement.ISettlementService'. If you > have verified that your call stack contains a method with the > [Transaction] attribute, then also make sure that you have registered > the AutoTx Facility. The question is how do I use the `NHibernateFacility` with my current implementation and not use the `Transaction` attribute. # Resources # http://richarddingwall.name/2010/08/17/one-nhibernate-session-per-wcf-operation-the-easy-way/ https://github.com/haf/Castle.Facilities.NHibernate/wiki/NHibernate-Facility---Quick-Start [1]: https://github.com/haf/Castle.Facilities.NHibernate/downloads
nhibernate
windsor-3.0
windsor-nhfacility
windsor-autotxfacility
windsor-wcffacility
null
open
Using the Windsor NHibernateFacility in a Wcf Service with a custom service behavior for creating transactions instead of the Transaction attribute === I am trying to use the Windsor NHibernate Facility for the first time in a Wcf service and replace the current manual registration of NHibernate so that there can be a consistent approach across all services. Current working approach - Previously I had been registering the NHibernate components manually. <!-- language: lang-cs --> container.Register( Component.For<ISessionFactory>().UsingFactoryMethod(() => CreateMappings("SomeConnectionString").BuildSessionFactory())); container.Register( Component.For<ISession>().LifeStyle.PerWcfOperation().UsingFactoryMethod(OpenSession)); I was then using a custom service behavior to create and complete a transaction scope for each operation. <!-- language: lang-cs --> public class TransactionBehavior : IServiceBehavior { public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { foreach (var cdb in serviceHostBase.ChannelDispatchers) { var channelDispatcher = cdb as ChannelDispatcher; if (null == channelDispatcher) continue; foreach (var endpointDispatcher in channelDispatcher.Endpoints) { foreach (var dispatchOperation in endpointDispatcher.DispatchRuntime.Operations) { dispatchOperation.CallContextInitializers.Add(new TransactionContext()); } } } } public void AddBindingParameters(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection bindingParameters) { } public void Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase) { } } public class TransactionContext : ICallContextInitializer { private TransactionScope transaction; public Object BeforeInvoke(InstanceContext instanceContext, IClientChannel channel, Message message) { transaction = new TransactionScope(); return null; } public void AfterInvoke(Object correlationState) { if(transaction != null) { transaction.Complete(); transaction.Dispose(); } } } Integration of the NHibernate Facility - I have downloaded the [0.3.1.2001 artifacts][1] and using the resources below I have tried to plug in the facility and remove any manual wire up to NHibernate. However I do not want to decorate services and methods with the `Transactional` and `Transaction` attributes. The following is my current wire up. <!-- language: lang-cs --> container.Register(Component.For<INHibernateInstaller>().ImplementedBy<MyNHibernateInstaller>(); container.AddFacility<AutoTxFacility>(); container.AddFacility<NHibernateFacility>(); public class MyNHibernateInstaller : INHibernateInstaller { public Maybe<IInterceptor> Interceptor { get { return Maybe.None<IInterceptor>(); } } public bool IsDefault { get { return true; } } public string SessionFactoryKey { get { return "sf.default"; } } public FluentConfiguration BuildFluent() { return Fluently .Configure() .Database(MsSqlConfiguration .MsSql2005.ConnectionString("SomeConnectionString") ) .Mappings( m => m.FluentMappings .AddFromAssemblyOf<TypeFromEntityAssembly>() ); } public void Registered(ISessionFactory factory) { } } Whenever I call one of the service endpoints the service fails with the following exception: > No transaction in context when trying to instantiate model > 'NHibernate.ISession' for resolve type > 'Juice.iCheque.eMoneySystem.Settlement.ISettlementService'. If you > have verified that your call stack contains a method with the > [Transaction] attribute, then also make sure that you have registered > the AutoTx Facility. The question is how do I use the `NHibernateFacility` with my current implementation and not use the `Transaction` attribute. # Resources # http://richarddingwall.name/2010/08/17/one-nhibernate-session-per-wcf-operation-the-easy-way/ https://github.com/haf/Castle.Facilities.NHibernate/wiki/NHibernate-Facility---Quick-Start [1]: https://github.com/haf/Castle.Facilities.NHibernate/downloads
0
11,349,327
07/05/2012 17:19:59
1,504,705
07/05/2012 16:58:30
1
0
Value of a vector in Haskell
I'm trying to learn Haskell from Learn You a Haskell for Great Good. I'm trying to build a bunch of functions to perform various vector operations. I'm building a function that takes two vectors, and finds the angle in between them. The operation looks like this: A · B = A B cos θ Anyway, right now I'm trying to write a function that will find "Value" of a Vector. For example, the value of 2i + 3j + 4k is sqrt(2^2 + 3^2 + 4^2). The vector is stored as a list, and I was thinking of trying something like this: getValue (vector) = [sqrt v | v <- v + square take 1 vector] How would I do that?
math
haskell
null
null
null
null
open
Value of a vector in Haskell === I'm trying to learn Haskell from Learn You a Haskell for Great Good. I'm trying to build a bunch of functions to perform various vector operations. I'm building a function that takes two vectors, and finds the angle in between them. The operation looks like this: A · B = A B cos θ Anyway, right now I'm trying to write a function that will find "Value" of a Vector. For example, the value of 2i + 3j + 4k is sqrt(2^2 + 3^2 + 4^2). The vector is stored as a list, and I was thinking of trying something like this: getValue (vector) = [sqrt v | v <- v + square take 1 vector] How would I do that?
0
11,349,328
07/05/2012 17:20:00
287,693
03/06/2010 11:31:11
217
2
C++ last character in file
I would like to get the last character in file using the following code FILE * f = fopen ( f_text, "r" ); if (f ) { if ( f, -1, SEEK_END ) != 0 ) fclose (f); char last[1]; fgets(last, 1, f ); ... but only "" is stored in variable last. Where is the bug? Is there any problem with unicode files? Thanks for your help.
c++
file
char
last
null
null
open
C++ last character in file === I would like to get the last character in file using the following code FILE * f = fopen ( f_text, "r" ); if (f ) { if ( f, -1, SEEK_END ) != 0 ) fclose (f); char last[1]; fgets(last, 1, f ); ... but only "" is stored in variable last. Where is the bug? Is there any problem with unicode files? Thanks for your help.
0
11,349,329
07/05/2012 17:20:07
1,499,536
07/03/2012 17:31:58
1
0
What is the behavior of addEventListener when you try and add a non-existent event?
For example: someElement.addEventListener("blahblah", alert("hello!")); when typed into both the Chrome and Firefox development consoles seems to fire the alert("hello!") call once and then return 'undefined'. If I embed that same call into the page, then nothing seems to happen - no error is fired, no interesting value is returned, etc.
javascript
javascript-events
null
null
null
null
open
What is the behavior of addEventListener when you try and add a non-existent event? === For example: someElement.addEventListener("blahblah", alert("hello!")); when typed into both the Chrome and Firefox development consoles seems to fire the alert("hello!") call once and then return 'undefined'. If I embed that same call into the page, then nothing seems to happen - no error is fired, no interesting value is returned, etc.
0
11,349,354
07/05/2012 17:22:14
977,208
10/03/2011 18:22:47
18
1
Maven says I have a cyclic reference in multi-module project but can't figure out why
I have a multi-module project that looks like this: - module1 - pom.xml - module2 - pom.xml - pom.xml The pom.xml in module2 has a dependency on module1. When I run mvn clean compile I get the following error: > The projects in the reactor contain a cyclic reference. Here are my dependencies in module1: <dependencies> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.48</version> </dependency> </dependencies> I can't figure out why it says there is a cyclic reference. Even when I do mvn dependency:tree on module1 I get the following: [INFO] +- log4j:log4j:jar:1.2.14:compile [INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile [INFO] | \- org.slf4j:slf4j-api:jar:1.6.1:compile [INFO] +- com.jcraft:jsch:jar:0.1.48:compile [INFO] \- junit:junit:jar:4.8.2:test It looks to me like there aren't any references to module2 in module1. So where is the cyclic reference coming from?
maven
multi-module
cyclic-reference
null
null
null
open
Maven says I have a cyclic reference in multi-module project but can't figure out why === I have a multi-module project that looks like this: - module1 - pom.xml - module2 - pom.xml - pom.xml The pom.xml in module2 has a dependency on module1. When I run mvn clean compile I get the following error: > The projects in the reactor contain a cyclic reference. Here are my dependencies in module1: <dependencies> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.48</version> </dependency> </dependencies> I can't figure out why it says there is a cyclic reference. Even when I do mvn dependency:tree on module1 I get the following: [INFO] +- log4j:log4j:jar:1.2.14:compile [INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile [INFO] | \- org.slf4j:slf4j-api:jar:1.6.1:compile [INFO] +- com.jcraft:jsch:jar:0.1.48:compile [INFO] \- junit:junit:jar:4.8.2:test It looks to me like there aren't any references to module2 in module1. So where is the cyclic reference coming from?
0
11,349,355
07/05/2012 17:22:17
875,317
08/02/2011 19:11:50
1,511
17
When or why is equals not the opposite of not equals in a SQL query?
In a table containing five records where the Toppings value is "Chocolate", two of them have the value "Yes" in the MaraschinoCherry column, the other three contain nothing in that column (not "No" - nothing/blank). This query works fine: select definition from desserts where (Toppings = 'Chocolate') and (MaraschinoCherry <> 'Yes') order by id ...returning the expected three record; but this one returns nothing at all, rather than the two records I expect: select definition from desserts where (Toppings = 'Chocolate') and (MaraschinoCherry = 'Yes') order by id ???
sql
oracle
query
toad
null
null
open
When or why is equals not the opposite of not equals in a SQL query? === In a table containing five records where the Toppings value is "Chocolate", two of them have the value "Yes" in the MaraschinoCherry column, the other three contain nothing in that column (not "No" - nothing/blank). This query works fine: select definition from desserts where (Toppings = 'Chocolate') and (MaraschinoCherry <> 'Yes') order by id ...returning the expected three record; but this one returns nothing at all, rather than the two records I expect: select definition from desserts where (Toppings = 'Chocolate') and (MaraschinoCherry = 'Yes') order by id ???
0
11,349,356
07/05/2012 17:22:19
688,266
04/01/2011 20:42:09
703
7
How do I mimic a "SELECT _id" in mongoid and ruby?
Currently I am doing the following: responses = Response.where(user_id: current_user.uid) qids = [] responses.each { |r| qids << r._id} return qids Any better way of doing this?
mongodb
mongoid
null
null
null
null
open
How do I mimic a "SELECT _id" in mongoid and ruby? === Currently I am doing the following: responses = Response.where(user_id: current_user.uid) qids = [] responses.each { |r| qids << r._id} return qids Any better way of doing this?
0
11,349,357
07/05/2012 17:22:21
654,789
03/11/2011 05:30:56
1,995
70
Need a fast way to write large blocks of data to file in C
I am not at all good when it comes to writing large chunks of data to file. I have a simulation which has structs like so typedef struct { int age; float height; float weight; int friends [ 250000 ]; } Person; And I can have as many as 250,000 persons, each with 250000 friends (a clique). Obviously this is a great deal of data. If I want to save each struct so I can later load them, what is the most efficient way in C? Here is what I have considered so far 1. I don't want to create a HUGE string with 250,000 groups of data and then do a single `write` as this will use a great deal of memory 2. I also don't want to create 250,000 different files as doing so may be slow. 3. Appending the files based on index (ie person 1, then person 2...), but this might be slow too. 4. Saving the data as binary (is this more efficient?)
c
file
fopen
write
null
null
open
Need a fast way to write large blocks of data to file in C === I am not at all good when it comes to writing large chunks of data to file. I have a simulation which has structs like so typedef struct { int age; float height; float weight; int friends [ 250000 ]; } Person; And I can have as many as 250,000 persons, each with 250000 friends (a clique). Obviously this is a great deal of data. If I want to save each struct so I can later load them, what is the most efficient way in C? Here is what I have considered so far 1. I don't want to create a HUGE string with 250,000 groups of data and then do a single `write` as this will use a great deal of memory 2. I also don't want to create 250,000 different files as doing so may be slow. 3. Appending the files based on index (ie person 1, then person 2...), but this might be slow too. 4. Saving the data as binary (is this more efficient?)
0
11,349,211
07/05/2012 17:10:52
557,406
12/29/2010 17:33:09
424
8
Modify Python Path for Python3 only
I am developing in both Python 3 and Python 2.6, and have both versions installed. With Python 3, however, the path to lots of the good modules (time, math, ...) is not part of my Python path. I can add the directory to the path, but it's tedious. Is there a way to permanently modify the path for my Python 3 installation without affecting Python 2?
python
linux
centos5
python-3.2
null
null
open
Modify Python Path for Python3 only === I am developing in both Python 3 and Python 2.6, and have both versions installed. With Python 3, however, the path to lots of the good modules (time, math, ...) is not part of my Python path. I can add the directory to the path, but it's tedious. Is there a way to permanently modify the path for my Python 3 installation without affecting Python 2?
0
11,349,212
07/05/2012 17:10:53
386,279
07/08/2010 06:02:41
476
6
Completion for virtualenvwrapper in zsh
I would like to set an alias so that I can switch to a virtualenv and go to a folder with the virtualenv's name in my home folder. For example, with a virtualenv named `dummy`, I'd like to be able to do wk dummy which would do `workon dummy` and `cd ~/dummy` at once. I put this in my `.zshrc` wk() { cd ~/ && cd "$1" && workon "$1"; } which works. I would, however, like it to autocomplete using `workon`'s rules, which I tried using `compdef workon wk`. While `workon` autocompletes `dummy`, autocompleting on `wk` gives $ wk ......dummy dummy dummy $ wk leaving me with nothing. How do I get the desired behavior?
autocomplete
virtualenv
zsh
virtualenvwrapper
null
null
open
Completion for virtualenvwrapper in zsh === I would like to set an alias so that I can switch to a virtualenv and go to a folder with the virtualenv's name in my home folder. For example, with a virtualenv named `dummy`, I'd like to be able to do wk dummy which would do `workon dummy` and `cd ~/dummy` at once. I put this in my `.zshrc` wk() { cd ~/ && cd "$1" && workon "$1"; } which works. I would, however, like it to autocomplete using `workon`'s rules, which I tried using `compdef workon wk`. While `workon` autocompletes `dummy`, autocompleting on `wk` gives $ wk ......dummy dummy dummy $ wk leaving me with nothing. How do I get the desired behavior?
0
11,349,361
07/05/2012 17:22:43
1,415,352
05/24/2012 14:51:40
21
4
Django How to know if queryset is cached or not? using johnnycache
I just discovered johnnycache and it looks awesome. I pip-installed it and added the few lines of code to my settings just as the documentation instructed as follows. CACHES = { 'default': { 'BACKEND': 'johnny.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:8000', 'JOHNNY_CACHE': True, } } JOHNNY_MIDDLEWARE_KEY_PREFIX = 'jc_efl' and the Middleware settings.. MIDDLEWARE_CLASSES = ( 'johnny.middleware.LocalStoreClearMiddleware', 'johnny.middleware.QueryCacheMiddleware', ... } I loaded my site in my browser and it runs fine and there isn't any noticeable difference in load-times. I want to know how can I know if my retrieved queries are actually coming from the cache or not. I looked up on Google and SO and a lot is mentioned about view/template caching where they use the commented-timestamp method of getting it done. But I believe, that does not apply here. Please help!
python
django
caching
memcached
django-queryset
null
open
Django How to know if queryset is cached or not? using johnnycache === I just discovered johnnycache and it looks awesome. I pip-installed it and added the few lines of code to my settings just as the documentation instructed as follows. CACHES = { 'default': { 'BACKEND': 'johnny.backends.memcached.MemcachedCache', 'LOCATION': '127.0.0.1:8000', 'JOHNNY_CACHE': True, } } JOHNNY_MIDDLEWARE_KEY_PREFIX = 'jc_efl' and the Middleware settings.. MIDDLEWARE_CLASSES = ( 'johnny.middleware.LocalStoreClearMiddleware', 'johnny.middleware.QueryCacheMiddleware', ... } I loaded my site in my browser and it runs fine and there isn't any noticeable difference in load-times. I want to know how can I know if my retrieved queries are actually coming from the cache or not. I looked up on Google and SO and a lot is mentioned about view/template caching where they use the commented-timestamp method of getting it done. But I believe, that does not apply here. Please help!
0
11,349,367
07/05/2012 17:23:04
1,504,701
07/05/2012 16:56:13
1
0
Pygame (Python) Scale Transform Slow
I'm writing a simple program in python which takes in data over the serial port and updates the screen. Because I want this program to look the same on whatever computer it runs on, and it needs to be fullscreen, I had the idea that I wanted to draw everything in a small 640,480 window, and then scale it to a fullscreen window every time I update the frame. This allows me to keep all the offsets the same for text, etc. It also turns out this is really slow. Here's about what the important part of the code looks like: window = pygame.display.set_mode((1920, 1080),pygame.FULLSCREEN) screenPrescaled=pygame.Surface((640,480)) clock=pygame.time.Clock() while iterations<400: #Blit all the stuff to the prescaled surface here screenPostscaled=pygame.transform.scale(screenPrescaled,(1920, 1080)) window.blit(screenPostscaled,(0,0)) pygame.display.flip() iterations+=1 clock.tick(40) This runs a WHOLE lot slower than 40fps. Everything on the screen is either text or lines, there are no images loaded. I suspect I'm doing something stupid. I know I can update "dirty rectangles" only, but I wonder if I'm missing something more fundamental. Thanks in advance!
python
pygame
scaling
frame-rate
null
null
open
Pygame (Python) Scale Transform Slow === I'm writing a simple program in python which takes in data over the serial port and updates the screen. Because I want this program to look the same on whatever computer it runs on, and it needs to be fullscreen, I had the idea that I wanted to draw everything in a small 640,480 window, and then scale it to a fullscreen window every time I update the frame. This allows me to keep all the offsets the same for text, etc. It also turns out this is really slow. Here's about what the important part of the code looks like: window = pygame.display.set_mode((1920, 1080),pygame.FULLSCREEN) screenPrescaled=pygame.Surface((640,480)) clock=pygame.time.Clock() while iterations<400: #Blit all the stuff to the prescaled surface here screenPostscaled=pygame.transform.scale(screenPrescaled,(1920, 1080)) window.blit(screenPostscaled,(0,0)) pygame.display.flip() iterations+=1 clock.tick(40) This runs a WHOLE lot slower than 40fps. Everything on the screen is either text or lines, there are no images loaded. I suspect I'm doing something stupid. I know I can update "dirty rectangles" only, but I wonder if I'm missing something more fundamental. Thanks in advance!
0
11,349,369
07/05/2012 17:23:08
846,284
07/15/2011 10:45:51
11
2
cucumber/capybara vs selenium
The other day I was showing one of the testers at my company some tests I had written in cucumber (2 features, 5 scenarios). Then he asked me question that I could not answer: "How is this better than selenium or any other functionality test recording tool?" In understand that cucumber is a different technology and it's placed at a different level of testing, but I can't understand why I should bother to write and maintain cucumber/capybara tests. Can someone give me a reasonable explanation for using cucumber/capybara instead of just selenium?
selenium
cucumber
capybara
null
null
null
open
cucumber/capybara vs selenium === The other day I was showing one of the testers at my company some tests I had written in cucumber (2 features, 5 scenarios). Then he asked me question that I could not answer: "How is this better than selenium or any other functionality test recording tool?" In understand that cucumber is a different technology and it's placed at a different level of testing, but I can't understand why I should bother to write and maintain cucumber/capybara tests. Can someone give me a reasonable explanation for using cucumber/capybara instead of just selenium?
0
11,225,886
06/27/2012 12:11:22
842,424
07/13/2011 09:55:31
177
3
Disappearing contents of std::vector<std::string>
I have a vector of strings which are changing its contents for no apparent reason. Can't really explain what is going on. Sorry for a long listing, but it's really bugging me. I have a GUI application which loads some files and uses a reader object which state can be set by using a `parse(int argc, char* argv[])` method. The arguments are set in a dialog by checking various boxes and entering values. Here is a struct I use to hold the data from the dialog: struct PointFilter { PointFilter(): argc(0) {}; ~PointFilter() {}; int argc; std::vector<std::string> args; }; This struct is a member of the dialog class and after pressing ok button its populated with appropriate values. The values are taken from text boxes on the dialog into a stringstream and then pushed back into a std::vector<std::string>: class AdvancedLoadDialog { public: AdvancedLoadDialog(const Glib::RefPtr<Gtk::Builder>&); ~AdvancedLoadDialog(); PointFilter get_point_filter() { return this->point_filter; } private: PointFilter point_filter; void on_ok_btn_clicked(); void AdvancedLoadDialog::on_ok_btn_clicked() { std::stringstream filter_stream; // filter_stream << some_values_from_textboxes ... std::vector<std::string> args; std::string arg; // we need a dummy first argument to emulate the command line args.push_back("filter"); while (filter_stream >> arg) { args.push_back(arg); } point_filter.argc = args.size() > 1 ? args.size() : 0; point_filter.args = args; advanced_load_dialog->hide_all(); } Everything works fine till this point and we have an `AdvancedLoadDialog` object with `point_filter` member which holds our arguments. Now in a separate window I take the point_filter object and pass it to a constructor of `LoadWorker` class, which loads the files and also has a `PointFilter` member. load_worker = new LoadWorker(..., advanced_load_dialog->get_point_filter()) And then: LoadWorker::LoadWorker(..., PointFilter pf) : point_filter (pf) All well and good. Now in the `LoadWorker::run()` function I take the arguments from the point_filter, convert them into std::vector<char*> and pass them them to the `parse(int argc, char* argv[]) function I need. void LoadWorker::run() { std::cout << "LoadWorker::file_filter contents: \n" << "point_filter.argc: " << point_filter.argc << "\n" << "point_filter.args: " << std::endl; for (int i = 0; i < point_filter.argc; ++i) std::cout << point_filter.args[i] << std::endl; // ... if (point_filter.argc != 0) { std::cout << "Using filter: " << std::endl; std::vector<char*> argv; for (std::vector<std::string>::const_iterator it = point_filter.args.begin(); it != point_filter.args.end(); ++it) { argv.push_back(const_cast<char*>(it->c_str())); } argv.push_back(0); for (int i = 0; i < point_filter.argc; ++i) { std::cout << argv[i] << std::endl; } if (!lasreadopener.parse(point_filter.argc, &argv[0])) { send_message("Error parsing filter parameters."); sig_fail(); return; } } } Now this works... once. You can notice that the arguments are printed twice, first as elements of `LoadWorker::point_filter.args` vector and then as elements of the `vector<char*> argv`. If I set the filter and then press the load button it all works. If I then try to load another file, without changing `AdvancedLoadDialog::point_filter` at all, the arguments are disappearing. Here's an example output trying to load two files in a row. > LoadWorker::file_filter contents: point_filter.argc: 6 > point_filter.args: filter > -clip_z_above 12 > -keep_intensity 11 222 Using filter: filter > -clip_z_above 12 > -keep_intensity 11 222 LoadWorker::file_filter contents: point_filter.argc: 6 point_filter.args: filter clip_z_above 2 > keep_intensity 1 22 Using filter: filter > > // 6 blank lines here To make it even more odd, during the second run each string except the first one in `point_filter.args` is missing the first character and in the `argv` they are all empty. Any clues whatsoever?
c++
multithreading
stdvector
stringstream
stdstring
null
open
Disappearing contents of std::vector<std::string> === I have a vector of strings which are changing its contents for no apparent reason. Can't really explain what is going on. Sorry for a long listing, but it's really bugging me. I have a GUI application which loads some files and uses a reader object which state can be set by using a `parse(int argc, char* argv[])` method. The arguments are set in a dialog by checking various boxes and entering values. Here is a struct I use to hold the data from the dialog: struct PointFilter { PointFilter(): argc(0) {}; ~PointFilter() {}; int argc; std::vector<std::string> args; }; This struct is a member of the dialog class and after pressing ok button its populated with appropriate values. The values are taken from text boxes on the dialog into a stringstream and then pushed back into a std::vector<std::string>: class AdvancedLoadDialog { public: AdvancedLoadDialog(const Glib::RefPtr<Gtk::Builder>&); ~AdvancedLoadDialog(); PointFilter get_point_filter() { return this->point_filter; } private: PointFilter point_filter; void on_ok_btn_clicked(); void AdvancedLoadDialog::on_ok_btn_clicked() { std::stringstream filter_stream; // filter_stream << some_values_from_textboxes ... std::vector<std::string> args; std::string arg; // we need a dummy first argument to emulate the command line args.push_back("filter"); while (filter_stream >> arg) { args.push_back(arg); } point_filter.argc = args.size() > 1 ? args.size() : 0; point_filter.args = args; advanced_load_dialog->hide_all(); } Everything works fine till this point and we have an `AdvancedLoadDialog` object with `point_filter` member which holds our arguments. Now in a separate window I take the point_filter object and pass it to a constructor of `LoadWorker` class, which loads the files and also has a `PointFilter` member. load_worker = new LoadWorker(..., advanced_load_dialog->get_point_filter()) And then: LoadWorker::LoadWorker(..., PointFilter pf) : point_filter (pf) All well and good. Now in the `LoadWorker::run()` function I take the arguments from the point_filter, convert them into std::vector<char*> and pass them them to the `parse(int argc, char* argv[]) function I need. void LoadWorker::run() { std::cout << "LoadWorker::file_filter contents: \n" << "point_filter.argc: " << point_filter.argc << "\n" << "point_filter.args: " << std::endl; for (int i = 0; i < point_filter.argc; ++i) std::cout << point_filter.args[i] << std::endl; // ... if (point_filter.argc != 0) { std::cout << "Using filter: " << std::endl; std::vector<char*> argv; for (std::vector<std::string>::const_iterator it = point_filter.args.begin(); it != point_filter.args.end(); ++it) { argv.push_back(const_cast<char*>(it->c_str())); } argv.push_back(0); for (int i = 0; i < point_filter.argc; ++i) { std::cout << argv[i] << std::endl; } if (!lasreadopener.parse(point_filter.argc, &argv[0])) { send_message("Error parsing filter parameters."); sig_fail(); return; } } } Now this works... once. You can notice that the arguments are printed twice, first as elements of `LoadWorker::point_filter.args` vector and then as elements of the `vector<char*> argv`. If I set the filter and then press the load button it all works. If I then try to load another file, without changing `AdvancedLoadDialog::point_filter` at all, the arguments are disappearing. Here's an example output trying to load two files in a row. > LoadWorker::file_filter contents: point_filter.argc: 6 > point_filter.args: filter > -clip_z_above 12 > -keep_intensity 11 222 Using filter: filter > -clip_z_above 12 > -keep_intensity 11 222 LoadWorker::file_filter contents: point_filter.argc: 6 point_filter.args: filter clip_z_above 2 > keep_intensity 1 22 Using filter: filter > > // 6 blank lines here To make it even more odd, during the second run each string except the first one in `point_filter.args` is missing the first character and in the `argv` they are all empty. Any clues whatsoever?
0
11,226,437
06/27/2012 12:39:59
1,424,577
05/29/2012 19:55:22
1
1
extending jaas jboss login module and provide custom validation message
i have extended my jboss gatein login module to add sme additional validations.. now i need to pass my custom validation message to my login screen, for the same i have thrown a LoginException with a parameter message string each time the validation fails . how can i capture this exception message and print in my login screen.. <form id="loginForm" name="loginform" method="post" action="<%= contextPath + "/login"%>"> above is my login form action <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule" flag="required"> <module-option name="portalContainerName">portal</module-option> <module-option name="realmName">gatein-domain</module-option> </login-module> <login-module code="com.radiant.cisms.loginmodule.LicensingLogin" flag="required"> <module-option name="portalContainerName">portal</module-option> <module-option name="realmName">gatein-domain</module-option> </login-module> </authentication> above is my jboss-beans.xml public boolean login() throws LoginException { try{ System.out.println("enter login module :"); if(true) throw new LoginException("inside evaluation period"); }catch(Exception e){ e.printStackTrace(); } return true; }
jboss
gatein
null
null
null
null
open
extending jaas jboss login module and provide custom validation message === i have extended my jboss gatein login module to add sme additional validations.. now i need to pass my custom validation message to my login screen, for the same i have thrown a LoginException with a parameter message string each time the validation fails . how can i capture this exception message and print in my login screen.. <form id="loginForm" name="loginform" method="post" action="<%= contextPath + "/login"%>"> above is my login form action <login-module code="org.exoplatform.services.security.j2ee.JbossLoginModule" flag="required"> <module-option name="portalContainerName">portal</module-option> <module-option name="realmName">gatein-domain</module-option> </login-module> <login-module code="com.radiant.cisms.loginmodule.LicensingLogin" flag="required"> <module-option name="portalContainerName">portal</module-option> <module-option name="realmName">gatein-domain</module-option> </login-module> </authentication> above is my jboss-beans.xml public boolean login() throws LoginException { try{ System.out.println("enter login module :"); if(true) throw new LoginException("inside evaluation period"); }catch(Exception e){ e.printStackTrace(); } return true; }
0
11,226,438
06/27/2012 12:40:00
1,423,039
05/29/2012 07:02:35
13
0
UIActionSheet in uiscrollView
I have a UIScrollView, which has multiple UIViews added to it. I want to delete a particular view from UIScrollView, by using UIActionSheet. But its not working.. .h file ------- @interface myScrollViewController : UIViewController <UIScrollViewDelegate,UIActionSheetDelegate> { UIScrollView *holdSlideScrollView; UIImageView *editPaperView; } @property (nonatomic, strong) UIScrollView *holdSlideScrollView; @property (nonatomic, strong) UIScrollView *holdSlideScrollView; - (void) showDeleteActionSheet; @end .m file ——— @implementation SlideViewController - (void) loadView { [super loadView]; for (int i= 0; i < 2; i++) { UIImageView *editPaperView = [[UIImageView alloc] initWithFrame:CGRectMake(6.0f+i*320, 4.0f, 307.0f, 409.0f)]; [editPaperView setImage:[UIImage imageNamed:@"paper.png"]]; editPaperView.userInteractionEnabled = YES; editPaperView.tag = i; UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; [deleteButton setAlpha:0.8f]; [deleteButton setFrame:CGRectMake(265.0f, 378.0f, 30.0f, 30.0f)]; [deleteButton setImage:[UIImage imageNamed:@"ps_delete.png"] forState:UIControlStateNormal]; //[deleteButton setImage:[UIImage imageNamed:@“delete_bplushigh.png"] forState:UIControlStateHighlighted]; [deleteButton addTarget:self action:@selector(showDeleteActionSheet) forControlEvents:UIControlEventTouchUpInside]; [editPaperView addSubview:deleteButton]; [holdSlideScrollView addSubview:editPaperView]; } [self.view addSubview:holdSlideScrollView]; } - (void) showDeleteActionSheet { UIActionSheet *popupDeleteActionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:nil]; popupDeleteActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; [popupDeleteActionSheet showInView:self.view]; //popupDeleteActionSheet = nil; } @end Whats wrong with this? Please help me!
iphone
uiview
uiscrollview
uiactionsheet
null
null
open
UIActionSheet in uiscrollView === I have a UIScrollView, which has multiple UIViews added to it. I want to delete a particular view from UIScrollView, by using UIActionSheet. But its not working.. .h file ------- @interface myScrollViewController : UIViewController <UIScrollViewDelegate,UIActionSheetDelegate> { UIScrollView *holdSlideScrollView; UIImageView *editPaperView; } @property (nonatomic, strong) UIScrollView *holdSlideScrollView; @property (nonatomic, strong) UIScrollView *holdSlideScrollView; - (void) showDeleteActionSheet; @end .m file ——— @implementation SlideViewController - (void) loadView { [super loadView]; for (int i= 0; i < 2; i++) { UIImageView *editPaperView = [[UIImageView alloc] initWithFrame:CGRectMake(6.0f+i*320, 4.0f, 307.0f, 409.0f)]; [editPaperView setImage:[UIImage imageNamed:@"paper.png"]]; editPaperView.userInteractionEnabled = YES; editPaperView.tag = i; UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; [deleteButton setAlpha:0.8f]; [deleteButton setFrame:CGRectMake(265.0f, 378.0f, 30.0f, 30.0f)]; [deleteButton setImage:[UIImage imageNamed:@"ps_delete.png"] forState:UIControlStateNormal]; //[deleteButton setImage:[UIImage imageNamed:@“delete_bplushigh.png"] forState:UIControlStateHighlighted]; [deleteButton addTarget:self action:@selector(showDeleteActionSheet) forControlEvents:UIControlEventTouchUpInside]; [editPaperView addSubview:deleteButton]; [holdSlideScrollView addSubview:editPaperView]; } [self.view addSubview:holdSlideScrollView]; } - (void) showDeleteActionSheet { UIActionSheet *popupDeleteActionSheet = [[UIActionSheet alloc] initWithTitle:@"" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:nil]; popupDeleteActionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; [popupDeleteActionSheet showInView:self.view]; //popupDeleteActionSheet = nil; } @end Whats wrong with this? Please help me!
0
11,226,439
06/27/2012 12:40:04
718,180
04/21/2011 02:22:04
542
26
git blame - ignore uncommitted changes
Partial output from `git blame <file>`: d6182477 (<author> 2012-06-22 09:44:02 -0400 239) ... d6182477 (<author> 2012-06-22 09:44:02 -0400 240) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 245) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 246) ... 35853aa2 (<author> 2012-06-22 08:12:41 -0400 247) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 248) ... -> 00000000 (Not Committed Yet 2012-06-27 08:33:35 -0400 249) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 250) ... 35853aa2 (<author> 2012-06-22 08:12:41 -0400 251) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 252) ... How does one get `git blame` to ignore uncommitted changes from the file?
git
blame
null
null
null
null
open
git blame - ignore uncommitted changes === Partial output from `git blame <file>`: d6182477 (<author> 2012-06-22 09:44:02 -0400 239) ... d6182477 (<author> 2012-06-22 09:44:02 -0400 240) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 245) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 246) ... 35853aa2 (<author> 2012-06-22 08:12:41 -0400 247) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 248) ... -> 00000000 (Not Committed Yet 2012-06-27 08:33:35 -0400 249) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 250) ... 35853aa2 (<author> 2012-06-22 08:12:41 -0400 251) ... 25f98f3f (<author> 2012-06-15 15:44:00 -0400 252) ... How does one get `git blame` to ignore uncommitted changes from the file?
0
11,226,441
06/27/2012 12:40:09
879,993
08/05/2011 06:29:32
110
0
Postgresql selecting with limit equal values?
I have one postgresql table where I store some stories from different sites. At this table I got story_id and site_id fields. Where story_id is the primary key and site_id is the id of the site where I got this story from. I need to make SELECT from this table picking the latest 30 added stories. But I dont want to get more than 2 stories comming from same site... So if I have something like this: story_id | site_id 1 | 1 2 | 1 3 | 2 4 | 1 5 | 3 My results must be : story_ids = 1,2,3,5! 4 must be skipped because I have already picked 2 ids with site_id 1.
postgresql
null
null
null
null
null
open
Postgresql selecting with limit equal values? === I have one postgresql table where I store some stories from different sites. At this table I got story_id and site_id fields. Where story_id is the primary key and site_id is the id of the site where I got this story from. I need to make SELECT from this table picking the latest 30 added stories. But I dont want to get more than 2 stories comming from same site... So if I have something like this: story_id | site_id 1 | 1 2 | 1 3 | 2 4 | 1 5 | 3 My results must be : story_ids = 1,2,3,5! 4 must be skipped because I have already picked 2 ids with site_id 1.
0
11,226,446
06/27/2012 12:40:20
768,596
05/24/2011 22:03:23
313
17
Download an image from internet an convert it to byte[] in WinRT
I'm trying to download an image from the internet, through the URL, to my Windows8-app and convert it to a byte[]. (BitmapImage isn't serializable) Unfortunatly when I try to process this code, it crashes on the bytearray initialization since the Stream isn't seekable. Is there ANY way to accomplish this? I've red that there isn't a stream yet that is seekable in WinRT... private async Task<byte[]> DownloadImageFromWebsite(string url) { //BitmapImage result = null; byte[] result = null; try { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); WebResponse response = await request.GetResponseAsync(); Stream imageStream = response.GetResponseStream(); result = new byte[imageStream.Length]; await imageStream.ReadAsync(result, 0, (int)imageStream.Length); response.Dispose(); } catch (Exception ex) { return null; } return result; }
c#
wpf
winrt
null
null
null
open
Download an image from internet an convert it to byte[] in WinRT === I'm trying to download an image from the internet, through the URL, to my Windows8-app and convert it to a byte[]. (BitmapImage isn't serializable) Unfortunatly when I try to process this code, it crashes on the bytearray initialization since the Stream isn't seekable. Is there ANY way to accomplish this? I've red that there isn't a stream yet that is seekable in WinRT... private async Task<byte[]> DownloadImageFromWebsite(string url) { //BitmapImage result = null; byte[] result = null; try { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); WebResponse response = await request.GetResponseAsync(); Stream imageStream = response.GetResponseStream(); result = new byte[imageStream.Length]; await imageStream.ReadAsync(result, 0, (int)imageStream.Length); response.Dispose(); } catch (Exception ex) { return null; } return result; }
0
11,226,448
06/27/2012 12:40:22
299,164
03/22/2010 15:52:22
767
35
InvalidCastException long to ulong
I have the following method: public static T ExecuteScalar<T>( string query, SqlConnection connection, params SqlParameter[] parameters) where T : new() { // Create SqlCommand SqlCommand command = CreateCommand(query, connection, parameters); // Execute command using ExecuteScalar object result = command.ExecuteScalar(); // Return value as expected type if (result == null || result is DBNull) return default(T); return (T)result; } I want to have the `MIN_ACTIVE_ROWVERSION` of the database as an `ulong`. The strange thing is.. the First method call below generates an error but the second method call works fine. *Method call 1* generates an error: ulong minActiveRowversion = SqlUtils.ExecuteScalar<ulong>( "SELECT CAST(MIN_ACTIVE_ROWVERSION() AS BIGINT)" , _connectionString); Error: System.InvalidCastException: Specified cast is not valid. *Method call 2* works fine: ulong minActiveRowversion = (ulong)SqlUtils.ExecuteScalar<long>( "SELECT CAST(MIN_ACTIVE_ROWVERSION() AS BIGINT)" , _connectionString); I don't understand how that is possible because the result of the `command.ExecuteScalar()` method is this: object result | 1955612 result.GetType() | {Name = "Int64" FullName = "System.Int64"} 1. Can someone tell me **why** the first scenario is not possible and the second scenario works? 2. Can someone tell me **how** I can solve it so I can use scenario 1.
c#
invalidcastexception
null
null
null
null
open
InvalidCastException long to ulong === I have the following method: public static T ExecuteScalar<T>( string query, SqlConnection connection, params SqlParameter[] parameters) where T : new() { // Create SqlCommand SqlCommand command = CreateCommand(query, connection, parameters); // Execute command using ExecuteScalar object result = command.ExecuteScalar(); // Return value as expected type if (result == null || result is DBNull) return default(T); return (T)result; } I want to have the `MIN_ACTIVE_ROWVERSION` of the database as an `ulong`. The strange thing is.. the First method call below generates an error but the second method call works fine. *Method call 1* generates an error: ulong minActiveRowversion = SqlUtils.ExecuteScalar<ulong>( "SELECT CAST(MIN_ACTIVE_ROWVERSION() AS BIGINT)" , _connectionString); Error: System.InvalidCastException: Specified cast is not valid. *Method call 2* works fine: ulong minActiveRowversion = (ulong)SqlUtils.ExecuteScalar<long>( "SELECT CAST(MIN_ACTIVE_ROWVERSION() AS BIGINT)" , _connectionString); I don't understand how that is possible because the result of the `command.ExecuteScalar()` method is this: object result | 1955612 result.GetType() | {Name = "Int64" FullName = "System.Int64"} 1. Can someone tell me **why** the first scenario is not possible and the second scenario works? 2. Can someone tell me **how** I can solve it so I can use scenario 1.
0
11,627,775
07/24/2012 09:19:31
1,347,303
04/20/2012 18:55:44
8
0
PHP auto collapse combobox on click anywhere
i would like to ask you, if you know an approach by which, we could have in result a combobox on the website which behaves this way: 1. the user expands the combobox on the site 2. - if the user clicks anywhere, the combobox collapses - if the user clicks on any object (radio, checkbox, text field etc.) the combobox collapses - if the user right clicks on the site, the combobox collapses I think it is called, lose focus. We are trying to do it somehow, but without success. We just solved the combobox collapse, when the user clicks on another combobox on the site. Hope i described it understandably.
php
combobox
null
null
null
null
open
PHP auto collapse combobox on click anywhere === i would like to ask you, if you know an approach by which, we could have in result a combobox on the website which behaves this way: 1. the user expands the combobox on the site 2. - if the user clicks anywhere, the combobox collapses - if the user clicks on any object (radio, checkbox, text field etc.) the combobox collapses - if the user right clicks on the site, the combobox collapses I think it is called, lose focus. We are trying to do it somehow, but without success. We just solved the combobox collapse, when the user clicks on another combobox on the site. Hope i described it understandably.
0
11,627,781
07/24/2012 09:19:45
730,304
04/29/2011 01:06:10
18
0
How do i transition between views, each having their own view controller?
I created a single view application on X-Code and created another view controller and tried pushing the second view controller. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (self.statesView == nil) { StatesView *newStateView = [[StatesView alloc]initWithNibName:@"StatesView" bundle:[NSBundle mainBundle]]; self.statesView = newStateView; } [self.navigationController pushViewController:self.statesView animated:YES]; } But the application crashes
ios
view
null
null
null
null
open
How do i transition between views, each having their own view controller? === I created a single view application on X-Code and created another view controller and tried pushing the second view controller. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (self.statesView == nil) { StatesView *newStateView = [[StatesView alloc]initWithNibName:@"StatesView" bundle:[NSBundle mainBundle]]; self.statesView = newStateView; } [self.navigationController pushViewController:self.statesView animated:YES]; } But the application crashes
0
11,626,975
07/24/2012 08:26:46
205,595
11/07/2009 14:12:33
1,407
85
Always show last label on telerik chart
I am using Teleriks chart control for silverlight. For X axis I setted <code>LabelStep="8"</code>. For some cases last item is not showing, as there is no enough data. You can see that case on image bellow. ![chart][1] Is there any way to always show label for last major tick? Thanks [1]: http://i.stack.imgur.com/ANfrc.png
silverlight
charts
telerik
null
null
null
open
Always show last label on telerik chart === I am using Teleriks chart control for silverlight. For X axis I setted <code>LabelStep="8"</code>. For some cases last item is not showing, as there is no enough data. You can see that case on image bellow. ![chart][1] Is there any way to always show label for last major tick? Thanks [1]: http://i.stack.imgur.com/ANfrc.png
0
11,627,573
07/24/2012 09:06:49
1,469,660
06/20/2012 14:59:49
1
0
Hide AJAX controller calls in console
I am developing a application based on Spring MVC(using tiles as view resolver). the application has some dropdown lists that are populated with values fetched from the DB. The dropdown list <form:select id="idServiceUnit" path="serviceUnit" multiple="multiple"></form:select> AJAX call to the controller(included in a seperate js file) jq.ajax({ url: "/MRYWeb/getServiceUnitLookUp", context: document.body, success: function(data){ jq("#idServiceUnit").addOption(data,{},false,{},{}); jq("#idServiceUnit").multiselect({ noneSelectedText:"Select", selectedList: 3, height:150, minWidth:195, beforeclose:function(){ fnCustomizedTextForMultiSelect('idServiceUnit'); } }).multiselectfilter(); } }); /MRYWeb/getServiceUnitLookUp is the relative URL of the controller that returns a list to populate the dropdown it is working fine but when ever i'm loading the page, firebug actually intercepting the URL http://i.minus.com/ieYZJj8eC6jlr.JPG as well as intercepting the js file call http://i.minus.com/ibkGiljg3dpXUl.JPG our client thinks it is a security risk. So can anyone help me by giving me idea about hiding these URL's or hiding the js call itself??
javascript
ajax
firebug
null
null
null
open
Hide AJAX controller calls in console === I am developing a application based on Spring MVC(using tiles as view resolver). the application has some dropdown lists that are populated with values fetched from the DB. The dropdown list <form:select id="idServiceUnit" path="serviceUnit" multiple="multiple"></form:select> AJAX call to the controller(included in a seperate js file) jq.ajax({ url: "/MRYWeb/getServiceUnitLookUp", context: document.body, success: function(data){ jq("#idServiceUnit").addOption(data,{},false,{},{}); jq("#idServiceUnit").multiselect({ noneSelectedText:"Select", selectedList: 3, height:150, minWidth:195, beforeclose:function(){ fnCustomizedTextForMultiSelect('idServiceUnit'); } }).multiselectfilter(); } }); /MRYWeb/getServiceUnitLookUp is the relative URL of the controller that returns a list to populate the dropdown it is working fine but when ever i'm loading the page, firebug actually intercepting the URL http://i.minus.com/ieYZJj8eC6jlr.JPG as well as intercepting the js file call http://i.minus.com/ibkGiljg3dpXUl.JPG our client thinks it is a security risk. So can anyone help me by giving me idea about hiding these URL's or hiding the js call itself??
0
11,627,575
07/24/2012 09:06:54
578,264
01/17/2011 08:43:21
20
2
Mysql - How to locate/regex IP in mysql text field and select only IP without rest of the text and without stored procedure
I have text column in mysql db with IP in between text, for example: >Just click 5 times on 10.10.112.123 and you will see 112 Brindatch Paintings , 123 Illustrations, 7 Sculpture, 10 Compositions. Just any text. How to locate/regex IP in mysql text field and select only IP without rest of the text and without stored procedure?
mysql
regex
string
data
extraction
null
open
Mysql - How to locate/regex IP in mysql text field and select only IP without rest of the text and without stored procedure === I have text column in mysql db with IP in between text, for example: >Just click 5 times on 10.10.112.123 and you will see 112 Brindatch Paintings , 123 Illustrations, 7 Sculpture, 10 Compositions. Just any text. How to locate/regex IP in mysql text field and select only IP without rest of the text and without stored procedure?
0
11,627,785
07/24/2012 09:20:14
1,548,157
07/24/2012 09:16:50
1
0
Producer Consumer
I was asked to write code for consumer and producer threads accessing shared queue in an interview with the given primitives ADDNEW.Process PROCESS.SET PROCESS.RESET ENTER CS EXIT CS LOOP EXIT LOOP WAIT# PROCESS
multithreading
null
null
null
null
07/24/2012 22:33:06
not a real question
Producer Consumer === I was asked to write code for consumer and producer threads accessing shared queue in an interview with the given primitives ADDNEW.Process PROCESS.SET PROCESS.RESET ENTER CS EXIT CS LOOP EXIT LOOP WAIT# PROCESS
1
11,627,792
07/24/2012 09:20:51
1,535,360
07/18/2012 15:44:15
1
0
How to assign scalar query to report viewer in C#
My problem is that i need 2 same rows to be sum for this i use scalar query SUM in dataset, if you have any other suggestion kindly reply. In this scenario when i assign this.saleTableAdapter.ScalarQuery(this.SaleDateset.sale); it shows: No overload method "Scalar Query" takes 1 arguements. What's wrong?
c#
sql
null
null
null
null
open
How to assign scalar query to report viewer in C# === My problem is that i need 2 same rows to be sum for this i use scalar query SUM in dataset, if you have any other suggestion kindly reply. In this scenario when i assign this.saleTableAdapter.ScalarQuery(this.SaleDateset.sale); it shows: No overload method "Scalar Query" takes 1 arguements. What's wrong?
0
11,627,793
07/24/2012 09:20:54
1,519,234
07/11/2012 22:20:25
6
0
Tab Item with a Close control
In my eclipse plugin, at runtime i create multiple TabItems for a Tabfolder based upon the user interaction. The problem arises when too many TabItems are created. I was looking for an option to create a TabItem with a close control so that the user can close the corresponding TabItem when not necessary. Is there a way to create this?
eclipse-rcp
null
null
null
null
null
open
Tab Item with a Close control === In my eclipse plugin, at runtime i create multiple TabItems for a Tabfolder based upon the user interaction. The problem arises when too many TabItems are created. I was looking for an option to create a TabItem with a close control so that the user can close the corresponding TabItem when not necessary. Is there a way to create this?
0
11,627,794
07/24/2012 09:20:54
1,517,047
07/11/2012 07:47:22
1
0
Service connect to sql and copy data
I'm going to program a Windows Service that has main tasks below: - Connect to sql server - Copy data - Pull data to a text file - Upload text file to FTP (share folder) I'm new C# and never programs Windows Service. Anyone please me some suggestions or provide me links with source code that can help me solve this project. Thanks and regards, Ken
c#
sql-server
vb.net
null
null
null
open
Service connect to sql and copy data === I'm going to program a Windows Service that has main tasks below: - Connect to sql server - Copy data - Pull data to a text file - Upload text file to FTP (share folder) I'm new C# and never programs Windows Service. Anyone please me some suggestions or provide me links with source code that can help me solve this project. Thanks and regards, Ken
0
11,627,797
07/24/2012 09:21:04
61,320
02/02/2009 00:22:23
2,488
34
Can we use the Google Places API and 4sq venues API in the same site?
Can't seem to find the definitive answer to this. What restrictions should I look out for between the two? I currently use foursquare exclusively, but sometimes there are places not in foursquare that maybe I want to use Google for.
api
google
foursquare
null
null
null
open
Can we use the Google Places API and 4sq venues API in the same site? === Can't seem to find the definitive answer to this. What restrictions should I look out for between the two? I currently use foursquare exclusively, but sometimes there are places not in foursquare that maybe I want to use Google for.
0
11,627,805
07/24/2012 09:21:31
452,680
07/26/2010 07:33:54
1,570
11
can't able to get required XML Elements using XSLT2.0?
This is my XML Document.I want to convert this XML Document to another XML Document(See Required OUTPUT XML Section). <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:v="urn:schemas-microsoft-com:vml"> <w:body> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text1-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading2" /> </w:pPr> <w:r> <w:t>Text2-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text3-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text4-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading3" /> </w:pPr> <w:r> <w:t>Text2.1-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading2" /> </w:pPr> <w:r> <w:t>Text5-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text6-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading3" /> </w:pPr> <w:r> <w:t>Text7-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text8-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading1" /> </w:pPr> <w:r> <w:t>Text9-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text10-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading2" /> </w:pPr> <w:r> <w:t>Text11-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text12-</w:t> </w:r> </w:p> <w:p> <w:r> <w:pict> <v:shape> <v:textbox> <w:txbxcontent> <w:p> <w:pPr> <w:pStyle w:val="Heading1" /> </w:pPr> <w:r> <w:t> Drawing Description_1 </w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading1" /> </w:pPr> <w:r> <w:t> Drawing Description_2 </w:t> </w:r> </w:p> </w:txbxcontent> </v:textbox> </v:shape> </w:pict> </w:r> </w:p> </w:body> </w:document> My Required OUTPUT XML is : <?xml version="1.0" encoding="utf-8"?><Document xmlns:v="urn:schemas-microsoft-com:vml" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"> <Paragraph>Text1-</Paragraph> <Heading2> <Title>Text2-</Title> <Paragraph>Text3-</Paragraph> <Paragraph>Text4-</Paragraph> <Heading3> <Title>Text2.1-</Title> </Heading3> </Heading2> <Heading2> <Title>Text5-</Title> <Paragraph>Text6-</Paragraph> <Heading3> <Title>Text7-</Title> <Paragraph>Text8-</Paragraph> </Heading3> </Heading2> <Heading1> <Title>Text9-</Title> <Paragraph>Text10-</Paragraph> <Heading2> <Title>Text11-</Title> <Paragraph>Text12-</Paragraph> <txtContentGroup> <Paragraph>Drawing Description_1</Paragraph> <Paragraph>Drawing Description_2</Paragraph> </txtContentGroup> </Heading2> </Heading1> </Document> This is my XSLT 2.0 Implementation for this : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:mf="http://example.com/mf" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:user="http://http://stackoverflow.com/questions/11356668" exclude-result-prefixes="xs w fn mf user"> <xsl:output indent="yes"/> <xsl:function name="mf:group" as="element()*"> <xsl:param name="paragraphs" as="element()*"/> <xsl:param name="level" as="xs:integer"/> <xsl:for-each-group select="$paragraphs" group-starting-with="p[pPr/pStyle/@w:val = concat('Heading', $level)]"> <xsl:choose> <xsl:when test="self::p[pPr/pStyle/@w:val = concat('Heading', $level)]"> <xsl:element name="Heading{$level}"> <Title> <xsl:apply-templates select="./r/t"/> </Title> <xsl:sequence select="mf:group(current-group() except ., $level + 1)"/> </xsl:element> </xsl:when> <xsl:when test="current-group()[self::p[pPr/pStyle/@w:val = concat('Heading', $level + 1)]]"> <xsl:sequence select="mf:group(current-group(), $level + 1)"> </xsl:sequence> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()"> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:function> <xsl:template match="document"> <Document> <xsl:sequence select="mf:group(body/p, 1)"/> </Document> </xsl:template> <xsl:template match="p"> <xsl:choose> <xsl:when test="(./r/t)"> <xsl:choose> <xsl:when test="descendant::w:p[w:r/w:t] | descendant::w:p[//w:r/w:t[ancestor::w:pict]][2] "> <txtContentGroup> <Paragraph> <xsl:apply-templates select="./r/t"/> </Paragraph> <xsl:apply-templates select="descendant::w:p"> </xsl:apply-templates> </txtContentGroup> </xsl:when> <xsl:otherwise> <Paragraph> <xsl:apply-templates select="./r/t"/> </Paragraph> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="descendant::w:p[not(ancestor::w:tbl)]"> <xsl:apply-templates select="descendant::w:p"> </xsl:apply-templates> </xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="/r/t"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> But it generating the following output : <?xml version="1.0" encoding="utf-8"?><Document xmlns:v="urn:schemas-microsoft-com:vml" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"> <Paragraph>Text1-</Paragraph> <Heading2> <Title>Text2-</Title> <Paragraph>Text3-</Paragraph> <Paragraph>Text4-</Paragraph> <Heading3> <Title>Text2.1-</Title> </Heading3> </Heading2> <Heading2> <Title>Text5-</Title> <Paragraph>Text6-</Paragraph> <Heading3> <Title>Text7-</Title> <Paragraph>Text8-</Paragraph> </Heading3> </Heading2> <Heading1> <Title>Text9-</Title> <Paragraph>Text10-</Paragraph> <Heading2> <Title>Text11-</Title> <Paragraph>Text12-</Paragraph> <Paragraph>Drawing Description_1</Paragraph> <Paragraph>Drawing Description_2</Paragraph> </Heading2> </Heading1> </Document> My Condition is : Whenever `<w:p>` elements contains **more than one** `decendant::w:p[w:r/w:t]` in it and also it has the ancestor of `<w:pict>` then i want to create the `<txtContentGroup>` elements and put all the `descendant::w:p[w:r/w:t]` inside it. Please Help me to get out of this issue...
xml
xpath
xslt-1.0
xslt-2.0
xpath-2.0
null
open
can't able to get required XML Elements using XSLT2.0? === This is my XML Document.I want to convert this XML Document to another XML Document(See Required OUTPUT XML Section). <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:v="urn:schemas-microsoft-com:vml"> <w:body> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text1-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading2" /> </w:pPr> <w:r> <w:t>Text2-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text3-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text4-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading3" /> </w:pPr> <w:r> <w:t>Text2.1-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading2" /> </w:pPr> <w:r> <w:t>Text5-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text6-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading3" /> </w:pPr> <w:r> <w:t>Text7-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text8-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading1" /> </w:pPr> <w:r> <w:t>Text9-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text10-</w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading2" /> </w:pPr> <w:r> <w:t>Text11-</w:t> </w:r> </w:p> <w:p> <w:pPr> </w:pPr> <w:r> <w:t>Text12-</w:t> </w:r> </w:p> <w:p> <w:r> <w:pict> <v:shape> <v:textbox> <w:txbxcontent> <w:p> <w:pPr> <w:pStyle w:val="Heading1" /> </w:pPr> <w:r> <w:t> Drawing Description_1 </w:t> </w:r> </w:p> <w:p> <w:pPr> <w:pStyle w:val="Heading1" /> </w:pPr> <w:r> <w:t> Drawing Description_2 </w:t> </w:r> </w:p> </w:txbxcontent> </v:textbox> </v:shape> </w:pict> </w:r> </w:p> </w:body> </w:document> My Required OUTPUT XML is : <?xml version="1.0" encoding="utf-8"?><Document xmlns:v="urn:schemas-microsoft-com:vml" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"> <Paragraph>Text1-</Paragraph> <Heading2> <Title>Text2-</Title> <Paragraph>Text3-</Paragraph> <Paragraph>Text4-</Paragraph> <Heading3> <Title>Text2.1-</Title> </Heading3> </Heading2> <Heading2> <Title>Text5-</Title> <Paragraph>Text6-</Paragraph> <Heading3> <Title>Text7-</Title> <Paragraph>Text8-</Paragraph> </Heading3> </Heading2> <Heading1> <Title>Text9-</Title> <Paragraph>Text10-</Paragraph> <Heading2> <Title>Text11-</Title> <Paragraph>Text12-</Paragraph> <txtContentGroup> <Paragraph>Drawing Description_1</Paragraph> <Paragraph>Drawing Description_2</Paragraph> </txtContentGroup> </Heading2> </Heading1> </Document> This is my XSLT 2.0 Implementation for this : <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xpath-default-namespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:mf="http://example.com/mf" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:user="http://http://stackoverflow.com/questions/11356668" exclude-result-prefixes="xs w fn mf user"> <xsl:output indent="yes"/> <xsl:function name="mf:group" as="element()*"> <xsl:param name="paragraphs" as="element()*"/> <xsl:param name="level" as="xs:integer"/> <xsl:for-each-group select="$paragraphs" group-starting-with="p[pPr/pStyle/@w:val = concat('Heading', $level)]"> <xsl:choose> <xsl:when test="self::p[pPr/pStyle/@w:val = concat('Heading', $level)]"> <xsl:element name="Heading{$level}"> <Title> <xsl:apply-templates select="./r/t"/> </Title> <xsl:sequence select="mf:group(current-group() except ., $level + 1)"/> </xsl:element> </xsl:when> <xsl:when test="current-group()[self::p[pPr/pStyle/@w:val = concat('Heading', $level + 1)]]"> <xsl:sequence select="mf:group(current-group(), $level + 1)"> </xsl:sequence> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="current-group()"> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:for-each-group> </xsl:function> <xsl:template match="document"> <Document> <xsl:sequence select="mf:group(body/p, 1)"/> </Document> </xsl:template> <xsl:template match="p"> <xsl:choose> <xsl:when test="(./r/t)"> <xsl:choose> <xsl:when test="descendant::w:p[w:r/w:t] | descendant::w:p[//w:r/w:t[ancestor::w:pict]][2] "> <txtContentGroup> <Paragraph> <xsl:apply-templates select="./r/t"/> </Paragraph> <xsl:apply-templates select="descendant::w:p"> </xsl:apply-templates> </txtContentGroup> </xsl:when> <xsl:otherwise> <Paragraph> <xsl:apply-templates select="./r/t"/> </Paragraph> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:choose> <xsl:when test="descendant::w:p[not(ancestor::w:tbl)]"> <xsl:apply-templates select="descendant::w:p"> </xsl:apply-templates> </xsl:when> </xsl:choose> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="/r/t"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> But it generating the following output : <?xml version="1.0" encoding="utf-8"?><Document xmlns:v="urn:schemas-microsoft-com:vml" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"> <Paragraph>Text1-</Paragraph> <Heading2> <Title>Text2-</Title> <Paragraph>Text3-</Paragraph> <Paragraph>Text4-</Paragraph> <Heading3> <Title>Text2.1-</Title> </Heading3> </Heading2> <Heading2> <Title>Text5-</Title> <Paragraph>Text6-</Paragraph> <Heading3> <Title>Text7-</Title> <Paragraph>Text8-</Paragraph> </Heading3> </Heading2> <Heading1> <Title>Text9-</Title> <Paragraph>Text10-</Paragraph> <Heading2> <Title>Text11-</Title> <Paragraph>Text12-</Paragraph> <Paragraph>Drawing Description_1</Paragraph> <Paragraph>Drawing Description_2</Paragraph> </Heading2> </Heading1> </Document> My Condition is : Whenever `<w:p>` elements contains **more than one** `decendant::w:p[w:r/w:t]` in it and also it has the ancestor of `<w:pict>` then i want to create the `<txtContentGroup>` elements and put all the `descendant::w:p[w:r/w:t]` inside it. Please Help me to get out of this issue...
0
11,425,973
07/11/2012 05:19:03
902,040
08/19/2011 08:05:05
31
0
List<String> as command line argument in java
I want to give 3 inputs as command line arguemnt in Java : 1. inputFileLocation 2.configFileList 3.outputFileLocation But I am not able to understand how to give list as command line arguement , i tries something like this : public class BatchLauncher { public static void main(String[] args) { int argc = 0; String inputFileLocation = argc < args.length ? args[argc++] : null; String configFileList = argc < args.length ? args[argc++] : null; String outputFileLocation = argc < args.length ? args[argc++] : null; CaptureBatch captureBatch = new CaptureBatch(); captureBatch.setInputFileLocation(inputFileLocation); captureBatch.setConfigFileList(configFileList); captureBatch.setOutputFileLocation(outputFileLocation); }} I am getting complie time error at : captureBatch.setConfigFileList(configFileList); The input will be given like this : D:/input a.conf,b.conf,c.conf D:/output where D:/input - inputFileLocation a.conf,b.conf,c.conf - configFileList separated by (,) D:/output - outputFileLocation
java
command-line-arguments
null
null
null
null
open
List<String> as command line argument in java === I want to give 3 inputs as command line arguemnt in Java : 1. inputFileLocation 2.configFileList 3.outputFileLocation But I am not able to understand how to give list as command line arguement , i tries something like this : public class BatchLauncher { public static void main(String[] args) { int argc = 0; String inputFileLocation = argc < args.length ? args[argc++] : null; String configFileList = argc < args.length ? args[argc++] : null; String outputFileLocation = argc < args.length ? args[argc++] : null; CaptureBatch captureBatch = new CaptureBatch(); captureBatch.setInputFileLocation(inputFileLocation); captureBatch.setConfigFileList(configFileList); captureBatch.setOutputFileLocation(outputFileLocation); }} I am getting complie time error at : captureBatch.setConfigFileList(configFileList); The input will be given like this : D:/input a.conf,b.conf,c.conf D:/output where D:/input - inputFileLocation a.conf,b.conf,c.conf - configFileList separated by (,) D:/output - outputFileLocation
0
11,425,976
07/11/2012 05:19:16
616,971
02/14/2011 22:40:01
649
23
Objective C Literals accessing NSArray
I wrote this simple code to try out the new Objective C literals for NSArray's the first line works fine but the new accessor method just returns the following error. Just wondering if I have done anything wrong or if the literals haven't been fully implemented yet? NSArray *array = @[@"foo"]; NSLog(@"%@", array[0]); ![Error][1] [1]: http://i.stack.imgur.com/o4ZTs.png
objective-c
null
null
null
null
null
open
Objective C Literals accessing NSArray === I wrote this simple code to try out the new Objective C literals for NSArray's the first line works fine but the new accessor method just returns the following error. Just wondering if I have done anything wrong or if the literals haven't been fully implemented yet? NSArray *array = @[@"foo"]; NSLog(@"%@", array[0]); ![Error][1] [1]: http://i.stack.imgur.com/o4ZTs.png
0
11,430,137
07/11/2012 10:00:35
1,517,364
07/11/2012 09:50:11
1
0
How to get target value from "document.xml.rels"? C#
I'm new to c#, please help to do How to get target value from "document.xml.rels" from the following syntex: ------------------------------------------------------------------------------------------ static void ProcessImage(WordprocessingDocument doc) { Document mainDocument = doc.MainDocumentPart.Document; XmlDocument docXML1 = new XmlDocument(); docXML1.Load("stage1.xml"); XmlNamespaceManager nsmgr = new XmlNamespaceManager(docXML1.NameTable); nsmgr.AddNamespace("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); foreach (XmlElement aNode in docXML1.SelectNodes("//a:blip", nsmgr)) { XmlAttribute newAttr = docXML1.CreateAttribute("targetName"); newAttr.Value = AttributeTargets.ReturnValue(); // HOW TO GET TARGET STRING FROM "document.xml.rels"// aNode.Attributes.Append(newAttr); } ------------------------------------------------------------------------------------------- thanks in advance. regards, saran
c#
docx
null
null
null
null
open
How to get target value from "document.xml.rels"? C# === I'm new to c#, please help to do How to get target value from "document.xml.rels" from the following syntex: ------------------------------------------------------------------------------------------ static void ProcessImage(WordprocessingDocument doc) { Document mainDocument = doc.MainDocumentPart.Document; XmlDocument docXML1 = new XmlDocument(); docXML1.Load("stage1.xml"); XmlNamespaceManager nsmgr = new XmlNamespaceManager(docXML1.NameTable); nsmgr.AddNamespace("a", "http://schemas.openxmlformats.org/drawingml/2006/main"); foreach (XmlElement aNode in docXML1.SelectNodes("//a:blip", nsmgr)) { XmlAttribute newAttr = docXML1.CreateAttribute("targetName"); newAttr.Value = AttributeTargets.ReturnValue(); // HOW TO GET TARGET STRING FROM "document.xml.rels"// aNode.Attributes.Append(newAttr); } ------------------------------------------------------------------------------------------- thanks in advance. regards, saran
0
11,430,138
07/11/2012 10:00:36
197,291
10/27/2009 12:08:17
434
18
Usage of javascriptRouter in Play 2.0.2
I have an app which I am trying to upgrade to Play 2.0.2 (from Play 2.0.1). I have this piece of code which worked on Play 2.0.1 but doesn't anymore @javascriptRouter("jsRoutes")( routes.javascript.Contacts.invite, routes.javascript.Contacts.remove ) The compiler complains: [error] /myprojectdir/target/scala-2.9.1/src_managed/main/views/html/Contacts/list.template.scala:75: Cannot find any HTTP Request Header here [error] """),_display_(Seq[Any](/*41.2*/javascriptRouter("jsRoutes")( [error] ^ [error] one error found [error] {file:/myprojectdir/}projectname/compile:compile: Compilation failed [error] Total time: 9 s, completed 11.07.2012 11:38:51 This has been noticed on the mailinglist, and one user has [fixed the problem][1]. I get that there is some implicit parameter that needs to be passed, but I have no idea how to do this. I tried adding(?) this to my template according to the mentioned [example file][2], basically changing my templates first line from @(currentUser: User, inviteForm: Form[controllers.Contacts.InviteForm]) to @(currentUser: User, inviteForm: Form[controllers.Contacts.InviteForm])(implicit request: RequestHeader) But this seems to change the type signature of the template(?), which is not quite what I would like to happen. Any suggestions? Everything with (?) is stuff I am not entirely sure of. I've worked with some implicit conversions in Scala before, but I am not sure what Play expects of me here and if I am making a scala or play mistake. [1]: https://groups.google.com/d/msg/play-framework/Z97GQ2VnR5M/XLzkcRykTrUJ [2]: https://github.com/playframework/Play20/blob/db5d40b81f3599ebb6f31e63fbba03d480c0d62c/samples/workinprogress/akka-chat/app/views/room.scala.html
javascript
scala
playframework
playframework-2.0
null
null
open
Usage of javascriptRouter in Play 2.0.2 === I have an app which I am trying to upgrade to Play 2.0.2 (from Play 2.0.1). I have this piece of code which worked on Play 2.0.1 but doesn't anymore @javascriptRouter("jsRoutes")( routes.javascript.Contacts.invite, routes.javascript.Contacts.remove ) The compiler complains: [error] /myprojectdir/target/scala-2.9.1/src_managed/main/views/html/Contacts/list.template.scala:75: Cannot find any HTTP Request Header here [error] """),_display_(Seq[Any](/*41.2*/javascriptRouter("jsRoutes")( [error] ^ [error] one error found [error] {file:/myprojectdir/}projectname/compile:compile: Compilation failed [error] Total time: 9 s, completed 11.07.2012 11:38:51 This has been noticed on the mailinglist, and one user has [fixed the problem][1]. I get that there is some implicit parameter that needs to be passed, but I have no idea how to do this. I tried adding(?) this to my template according to the mentioned [example file][2], basically changing my templates first line from @(currentUser: User, inviteForm: Form[controllers.Contacts.InviteForm]) to @(currentUser: User, inviteForm: Form[controllers.Contacts.InviteForm])(implicit request: RequestHeader) But this seems to change the type signature of the template(?), which is not quite what I would like to happen. Any suggestions? Everything with (?) is stuff I am not entirely sure of. I've worked with some implicit conversions in Scala before, but I am not sure what Play expects of me here and if I am making a scala or play mistake. [1]: https://groups.google.com/d/msg/play-framework/Z97GQ2VnR5M/XLzkcRykTrUJ [2]: https://github.com/playframework/Play20/blob/db5d40b81f3599ebb6f31e63fbba03d480c0d62c/samples/workinprogress/akka-chat/app/views/room.scala.html
0
11,430,142
07/11/2012 10:00:45
774,395
05/28/2011 14:25:10
846
31
Deploying Java Server Applications That Aren't .wars
Are there any well-integrated application-management stacks that allow the build, deployment and updating of non-`.war` Java applications that run as servers? For example message consumers that are servers (but not webservers and have no Servlets), or executable `.jar`s with Jetty embedded? Building and deploying `.war`s is pretty straightforward: Maven has the war archetype, Jenkins has a heap of plugins for deploying `.war` files to various application servers, most of which accept the upload of new web applications at runtime. Tools like Elastic Beanstalk make this process even easier, tying in the management of server environments. By contrast deploying executable `.jar`s seems like re-inventing the wheel. One needs to sort out the best way of shading the dependencies and creating an executable artefact with a plethora of Maven plugins, deposit this artefact somewhere, then find a way of installing it on target servers, and replacing/upgrading it if necessary (Debian packages would be one way of doing this). This all seems very 'manual' to me, to the point that it seems advantageous to deploy applications as `.war`s to application servers, even if they're not a natural fit for such an environment, just so you get the benefit of tool support.
java
deployment
automation
build-automation
executable-jar
null
open
Deploying Java Server Applications That Aren't .wars === Are there any well-integrated application-management stacks that allow the build, deployment and updating of non-`.war` Java applications that run as servers? For example message consumers that are servers (but not webservers and have no Servlets), or executable `.jar`s with Jetty embedded? Building and deploying `.war`s is pretty straightforward: Maven has the war archetype, Jenkins has a heap of plugins for deploying `.war` files to various application servers, most of which accept the upload of new web applications at runtime. Tools like Elastic Beanstalk make this process even easier, tying in the management of server environments. By contrast deploying executable `.jar`s seems like re-inventing the wheel. One needs to sort out the best way of shading the dependencies and creating an executable artefact with a plethora of Maven plugins, deposit this artefact somewhere, then find a way of installing it on target servers, and replacing/upgrading it if necessary (Debian packages would be one way of doing this). This all seems very 'manual' to me, to the point that it seems advantageous to deploy applications as `.war`s to application servers, even if they're not a natural fit for such an environment, just so you get the benefit of tool support.
0
11,429,078
07/11/2012 09:01:40
1,514,501
07/10/2012 10:44:44
1
0
Camera activity does not return to parent activity when OK button is pressed.
I just have a small problem. I open the Camera successfully and after I press the button to capture a picture, the following three buttons appear, OK, RETAKE and CANCEL. Normally when OK button is pressed the camera activity should return normally to the parent activity and perform what onActivityResult function contains. But in my case, when OK is pressed the camera activity does not return to the parent activity. Any sugesstions to solve this problem? please find below the code: OnClickListener btn_TakePictureListener = new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File imgPath = retrievePath(); intent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri(imgPath)); startActivityForResult(intent, RequestCode); } }; //@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { //super.onActivityResult(requestCode, resultCode, data); if (RequestCode == requestCode && resultCode == RESULT_OK) { String s = data.getDataString(); Toast.makeText(getBaseContext(), ""+s, Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(), "picture is taken", Toast.LENGTH_SHORT).show(); } } private String retrieveName() { int []x = imgOpHlpr.getIDs(); String s = imgOpHlpr.getImg_Name(x.length); return s; } private File retrievePath() { int []x = imgOpHlpr.getIDs(); String s = Environment.getExternalStorageDirectory().getAbsolutePath(); s += "/myFolder/"+imgOpHlpr.getImg_Path(x.length); File file = new File(s); return file; } private Uri getImageUri(File path) { Uri imgFileUri = Uri.fromFile(path); return imgFileUri; }
android
android-camera
null
null
null
null
open
Camera activity does not return to parent activity when OK button is pressed. === I just have a small problem. I open the Camera successfully and after I press the button to capture a picture, the following three buttons appear, OK, RETAKE and CANCEL. Normally when OK button is pressed the camera activity should return normally to the parent activity and perform what onActivityResult function contains. But in my case, when OK is pressed the camera activity does not return to the parent activity. Any sugesstions to solve this problem? please find below the code: OnClickListener btn_TakePictureListener = new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File imgPath = retrievePath(); intent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri(imgPath)); startActivityForResult(intent, RequestCode); } }; //@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { //super.onActivityResult(requestCode, resultCode, data); if (RequestCode == requestCode && resultCode == RESULT_OK) { String s = data.getDataString(); Toast.makeText(getBaseContext(), ""+s, Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(), "picture is taken", Toast.LENGTH_SHORT).show(); } } private String retrieveName() { int []x = imgOpHlpr.getIDs(); String s = imgOpHlpr.getImg_Name(x.length); return s; } private File retrievePath() { int []x = imgOpHlpr.getIDs(); String s = Environment.getExternalStorageDirectory().getAbsolutePath(); s += "/myFolder/"+imgOpHlpr.getImg_Path(x.length); File file = new File(s); return file; } private Uri getImageUri(File path) { Uri imgFileUri = Uri.fromFile(path); return imgFileUri; }
0
11,298,039
07/02/2012 17:00:23
1,225,076
02/22/2012 06:15:08
111
15
Android: Packets not reaching Device/Application Whens device screen is Locked
<br>My VOIP Android Application has the C/Native Library which does all business logic of login/Logout etc.<br> <br>Issue with this is when the device screen is lock the, application(c Code) is not able receive any packets from the server.Verified with Wireshark.Looks like the CPU is not running.</br> <br>I was able to slove the issue doing below on my application INIT.</br> WakeLock mWakeLock = null;PowerManager pm = (PowerManager) cxt.getSystemService(Context.POWER_SERVICE); if(mPartialWakeLock == null){ // lock used to keep the processor awake. mPartialWakeLock = pm.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); mPartialWakeLock.acquire(); } <br>But doing above will drain my battery.</br> <br> Why the requests are not reaching my application?/How can i make device CPU up all time when Screen is LOCKED and receive requests from Server.?</br> <br>Please help,</br> <br>Thanks</br> NITZ
android
android-ndk
cpu
null
null
null
open
Android: Packets not reaching Device/Application Whens device screen is Locked === <br>My VOIP Android Application has the C/Native Library which does all business logic of login/Logout etc.<br> <br>Issue with this is when the device screen is lock the, application(c Code) is not able receive any packets from the server.Verified with Wireshark.Looks like the CPU is not running.</br> <br>I was able to slove the issue doing below on my application INIT.</br> WakeLock mWakeLock = null;PowerManager pm = (PowerManager) cxt.getSystemService(Context.POWER_SERVICE); if(mPartialWakeLock == null){ // lock used to keep the processor awake. mPartialWakeLock = pm.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, TAG); mPartialWakeLock.acquire(); } <br>But doing above will drain my battery.</br> <br> Why the requests are not reaching my application?/How can i make device CPU up all time when Screen is LOCKED and receive requests from Server.?</br> <br>Please help,</br> <br>Thanks</br> NITZ
0
11,298,040
07/02/2012 17:00:24
1,436,616
06/05/2012 05:57:04
3
0
Visualizing Source
I'm trying to understand an application but its documentation really doesn't give me a good overview of how it works, so my question is : how can I get a diagram / flowchart / runtime architecture pic based on the source code ? It's C++
c++
architecture
diagram
flowchart
null
null
open
Visualizing Source === I'm trying to understand an application but its documentation really doesn't give me a good overview of how it works, so my question is : how can I get a diagram / flowchart / runtime architecture pic based on the source code ? It's C++
0
11,298,042
07/02/2012 17:00:49
939,407
09/11/2011 17:34:09
1
1
Use busy loop application on multicore box
all, is it ok to use busy loop application on multicore box? I have a couple of applications, which read messages from POSIX message queue, do its processing and again wait for new ones. But, as I understand, mq_timedreceive is quite expensive operation and if application do mq_receive on O_NONBLOCK queue it performs better (with less latency). So if I reserve a couple of CPUs (from 12) for non blocking messages processing, will it be ok?
c++
linux
queue
posix
message
null
open
Use busy loop application on multicore box === all, is it ok to use busy loop application on multicore box? I have a couple of applications, which read messages from POSIX message queue, do its processing and again wait for new ones. But, as I understand, mq_timedreceive is quite expensive operation and if application do mq_receive on O_NONBLOCK queue it performs better (with less latency). So if I reserve a couple of CPUs (from 12) for non blocking messages processing, will it be ok?
0
11,298,044
07/02/2012 17:00:53
786,487
06/06/2011 20:25:12
493
6
Secure AJAX voting system like Stack Overflow? (SharePoint implementation)
I'm trying to build an app for SharePoint in C# that will have a small component with an upvote/downvote system. This seems problematic. If I want to make it secure, I use server side code for the voting, but this sounds like a terrible user experience. With AJAX, the user experience is MUCH better, but you're vulnerable to hacking. The main vulnerability I see, is assigning a vote to a user. I assume whatever the interface (let's assume Ajax to List) that these will be variables set in JavaScript. It seems very easy to fire up any JS console in a browser and submit votes for a post/question. Unless I want to validate every vote against a username on page_load (a lot of extra cycles) I feel like I'm limited to nesting a repeater inside an updatepanel, and handling the voting inside of that function, generating the SPUser identity server side. Anyone who has used a repeater nested in an update panel with buttons will attest that this is a nightmare :( What are my alternatives?
jquery
ajax
security
sharepoint2010
null
null
open
Secure AJAX voting system like Stack Overflow? (SharePoint implementation) === I'm trying to build an app for SharePoint in C# that will have a small component with an upvote/downvote system. This seems problematic. If I want to make it secure, I use server side code for the voting, but this sounds like a terrible user experience. With AJAX, the user experience is MUCH better, but you're vulnerable to hacking. The main vulnerability I see, is assigning a vote to a user. I assume whatever the interface (let's assume Ajax to List) that these will be variables set in JavaScript. It seems very easy to fire up any JS console in a browser and submit votes for a post/question. Unless I want to validate every vote against a username on page_load (a lot of extra cycles) I feel like I'm limited to nesting a repeater inside an updatepanel, and handling the voting inside of that function, generating the SPUser identity server side. Anyone who has used a repeater nested in an update panel with buttons will attest that this is a nightmare :( What are my alternatives?
0
11,298,047
07/02/2012 17:00:55
617,774
02/15/2011 12:37:46
12
3
Why is it possible to @Inject a @Stateless EJB into a @SessionScoped Managed Bean?
Why is it possible to `@Inject` a `@Stateless` EJB into a `@SessionScoped` Managed Bean? I am just very curious because it is not possible to use a `@RequestScoped` Managed Bean in a `SessionScoped` Managed Bean as managed property.
jsf
jsf-2.0
ejb
ejb-3.0
cdi
null
open
Why is it possible to @Inject a @Stateless EJB into a @SessionScoped Managed Bean? === Why is it possible to `@Inject` a `@Stateless` EJB into a `@SessionScoped` Managed Bean? I am just very curious because it is not possible to use a `@RequestScoped` Managed Bean in a `SessionScoped` Managed Bean as managed property.
0
11,298,048
07/02/2012 17:00:56
789,090
03/22/2011 12:03:04
1,038
100
MySQL datatime data type seems to work incorrectly on time, it is 00:00:00 always
I have a table in my MySQL database with `datetime` data type. It seems there is a problem on it. When I insert new rows, time section fills with zero (00:00:00) always. > Example: 2012-07-02 00:00:00 Please help me.
mysql
datetime
null
null
null
07/02/2012 17:12:27
not a real question
MySQL datatime data type seems to work incorrectly on time, it is 00:00:00 always === I have a table in my MySQL database with `datetime` data type. It seems there is a problem on it. When I insert new rows, time section fills with zero (00:00:00) always. > Example: 2012-07-02 00:00:00 Please help me.
1
11,298,052
07/02/2012 17:01:19
1,468,036
06/20/2012 03:28:17
6
0
Draw text in a window using Dev c++ without a project
i want to draw a text in a window. when i use this file within a project, it runs fine without any error, when i run it alone, it shows below error. The requirement is to compile the file using only windows.h and in .cpp format. [Linker error] undefined reference to `TextOutA@20' ld returned 1 exit status i searched online, everyone says to add gdi32 lib. but that is only added to a project. i wonder if someone can help on this. #include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("My Window") ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; //wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.hbrBackground = (HBRUSH) COLOR_WINDOW+0;//DISPLAYS GREY BACKGROUND OF CLIENT AREA wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("Window not Registered"), szAppName, MB_ICONERROR) ; return 0 ; } hwnd = CreateWindow (szAppName, // window class name TEXT ("abcd"), // window caption WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, // window style CW_USEDEFAULT, // initial x position CW_USEDEFAULT, // initial y position 400,300, NULL, // parent window handle NULL, // window menu handle hInstance, // program instance handle NULL) ; // creation parameters ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; } LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc ; PAINTSTRUCT ps ; RECT rect ; HRGN bgRgn; HBRUSH hBrush; HPEN hPen; switch (message) { case WM_PAINT: hdc = BeginPaint (hwnd, &ps) ; GetClientRect (hwnd, &rect) ; TextOut(hdc, 50, 42, "Johnny Carson", 13); EndPaint (hwnd, &ps) ; return 0 ; case WM_DESTROY: PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam) ; }
c++
null
null
null
null
null
open
Draw text in a window using Dev c++ without a project === i want to draw a text in a window. when i use this file within a project, it runs fine without any error, when i run it alone, it shows below error. The requirement is to compile the file using only windows.h and in .cpp format. [Linker error] undefined reference to `TextOutA@20' ld returned 1 exit status i searched online, everyone says to add gdi32 lib. but that is only added to a project. i wonder if someone can help on this. #include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("My Window") ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; //wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.hbrBackground = (HBRUSH) COLOR_WINDOW+0;//DISPLAYS GREY BACKGROUND OF CLIENT AREA wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("Window not Registered"), szAppName, MB_ICONERROR) ; return 0 ; } hwnd = CreateWindow (szAppName, // window class name TEXT ("abcd"), // window caption WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, // window style CW_USEDEFAULT, // initial x position CW_USEDEFAULT, // initial y position 400,300, NULL, // parent window handle NULL, // window menu handle hInstance, // program instance handle NULL) ; // creation parameters ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ; } LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc ; PAINTSTRUCT ps ; RECT rect ; HRGN bgRgn; HBRUSH hBrush; HPEN hPen; switch (message) { case WM_PAINT: hdc = BeginPaint (hwnd, &ps) ; GetClientRect (hwnd, &rect) ; TextOut(hdc, 50, 42, "Johnny Carson", 13); EndPaint (hwnd, &ps) ; return 0 ; case WM_DESTROY: PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam) ; }
0
11,298,053
07/02/2012 17:01:26
1,453,846
06/13/2012 14:00:36
46
0
CSS - gradient set for IE
How do I set gradient for IE, because I was trying but without any luck, I got it working on chrome, firefox, opera but not in IE `html, body { height: 100%; background-image: -ms-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: -moz-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: -o-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #BDE25E), color-stop(1, #8BB31D)); background-image: -webkit-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: linear-gradient(to bottom, #BDE25E 0%, #8BB31D 100%); background-repeat: no-repeat; background-attachment: fixed; font-family:Tahoma, Geneva, sans-serif; color:#FFFFFF; font-size:11px; }` But when I launch it in IE, I get white background instead of green gradient.
css
null
null
null
null
null
open
CSS - gradient set for IE === How do I set gradient for IE, because I was trying but without any luck, I got it working on chrome, firefox, opera but not in IE `html, body { height: 100%; background-image: -ms-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: -moz-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: -o-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #BDE25E), color-stop(1, #8BB31D)); background-image: -webkit-linear-gradient(top, #BDE25E 0%, #8BB31D 100%); background-image: linear-gradient(to bottom, #BDE25E 0%, #8BB31D 100%); background-repeat: no-repeat; background-attachment: fixed; font-family:Tahoma, Geneva, sans-serif; color:#FFFFFF; font-size:11px; }` But when I launch it in IE, I get white background instead of green gradient.
0
11,295,809
07/02/2012 14:36:19
1,377,278
05/05/2012 19:50:49
1
0
Using a variable in a SQLAlchemy filter
I want to use a variable like this : myVariable = 0.5 myQuery.filter(myTable.column1 == myVariable*myTable.column2) I have then no results when I apply all() to myQuery. If I replace the variable with its value, it is OK.
sqlalchemy
null
null
null
null
null
open
Using a variable in a SQLAlchemy filter === I want to use a variable like this : myVariable = 0.5 myQuery.filter(myTable.column1 == myVariable*myTable.column2) I have then no results when I apply all() to myQuery. If I replace the variable with its value, it is OK.
0
11,295,812
07/02/2012 14:36:29
1,275,347
03/17/2012 05:10:17
21
1
Adding HoloEverywhere. Library is Empty
I am currently coding an application then decided to add HoloEverywhere into my application. However when I go to Properties > Android > Add. It's empty. Am I doing anything wrong? Do I need to do anything beforehand? ![][1] [1]: http://i.stack.imgur.com/LoYvr.png
android
android-layout
null
null
null
null
open
Adding HoloEverywhere. Library is Empty === I am currently coding an application then decided to add HoloEverywhere into my application. However when I go to Properties > Android > Add. It's empty. Am I doing anything wrong? Do I need to do anything beforehand? ![][1] [1]: http://i.stack.imgur.com/LoYvr.png
0
11,298,061
07/02/2012 17:02:22
1,458,476
06/15/2012 10:57:42
3
0
Python open Microsoft SQL Server MDF file
How can I open an Microsoft SQL Server MDF file in Python? (Putting some content here because, apparently, this question does not meet StackOverflow's quality standards. Guess they don't like brevity.)
python
sql-server
database
null
null
null
open
Python open Microsoft SQL Server MDF file === How can I open an Microsoft SQL Server MDF file in Python? (Putting some content here because, apparently, this question does not meet StackOverflow's quality standards. Guess they don't like brevity.)
0
11,298,062
07/02/2012 17:02:23
1,496,590
07/02/2012 16:17:13
1
0
Unpredicatable alarm__ignore signal
I keep getting an "alarm__ignore" signal when executing the below foreach loop. Curiously, the error appears on different iterations of the loop (ie, sometimes the third time through, sometimes the 26th, etc.) and I can't identify any rhyme or reason to when it occurs. This script runs without an error when I comment out "my @cols = split(/\s+/, $line)," but I can't figure out why a split would cause the signal. Here is the code: my @forest = (); foreach (@treeBlobs) { my @treeBlob = @{$_}; my $thisTree = eval { my %tree = (); foreach my $line (@treeBlob) { my @cols = split(/\s+/, $line); $tree{id++} = {map{$CLASSIFIER_COLUMNS[$_] => $cols[$_]}(0..scalar @cols-1)}; } return \%tree; }; print "ERROR: $@\n" if $@; push @forest, $thisTree; my $sc = scalar @forest; print "FOREST: $sc; $thisTree\n"; } And here is some sample output: ... FOREST: 19; HASH(0x4668c90) FOREST: 20; HASH(0x4664e10) FOREST: 21; HASH(0x4658e30) FOREST: 22; HASH(0x465ca80) FOREST: 23; HASH(0x4664860) FOREST: 24; HASH(0x4664240) FOREST: 25; HASH(0x46740b0) FOREST: 26; HASH(0x4667a70) FOREST: 27; HASH(0x465cf50) FOREST: 28; HASH(0x465cfd0) ERROR: __alarm__ignore__(54) FOREST: 29; FOREST: 30; HASH(0x465ada0) Again, the error does not always (or even usually) occur in the 29th iteration of the loop - it can happen in any iteration. Ideas? Thanks!
linux
perl
signals
centos
null
null
open
Unpredicatable alarm__ignore signal === I keep getting an "alarm__ignore" signal when executing the below foreach loop. Curiously, the error appears on different iterations of the loop (ie, sometimes the third time through, sometimes the 26th, etc.) and I can't identify any rhyme or reason to when it occurs. This script runs without an error when I comment out "my @cols = split(/\s+/, $line)," but I can't figure out why a split would cause the signal. Here is the code: my @forest = (); foreach (@treeBlobs) { my @treeBlob = @{$_}; my $thisTree = eval { my %tree = (); foreach my $line (@treeBlob) { my @cols = split(/\s+/, $line); $tree{id++} = {map{$CLASSIFIER_COLUMNS[$_] => $cols[$_]}(0..scalar @cols-1)}; } return \%tree; }; print "ERROR: $@\n" if $@; push @forest, $thisTree; my $sc = scalar @forest; print "FOREST: $sc; $thisTree\n"; } And here is some sample output: ... FOREST: 19; HASH(0x4668c90) FOREST: 20; HASH(0x4664e10) FOREST: 21; HASH(0x4658e30) FOREST: 22; HASH(0x465ca80) FOREST: 23; HASH(0x4664860) FOREST: 24; HASH(0x4664240) FOREST: 25; HASH(0x46740b0) FOREST: 26; HASH(0x4667a70) FOREST: 27; HASH(0x465cf50) FOREST: 28; HASH(0x465cfd0) ERROR: __alarm__ignore__(54) FOREST: 29; FOREST: 30; HASH(0x465ada0) Again, the error does not always (or even usually) occur in the 29th iteration of the loop - it can happen in any iteration. Ideas? Thanks!
0
11,298,063
07/02/2012 17:02:31
1,496,666
07/02/2012 16:52:44
1
0
Getting c++ runtime error when using a vector of SDL_Rect in SDL_blitsurface
SDL_BlitSurface(tileSheets.at(sheet), &clip[tile], screen, &tileBox); Works just fine and i initiliaze the clips like this: clip[ 0 ].x = x; clip[ 0 ].y = y; clip[ 0 ].w = 48; clip[ 0 ].h = 48; x += 48; clip[ 1 ].x = x; clip[ 1 ].y = y; clip[ 1 ].w = 48; clip[ 1 ].h = 48; This however doesnt work at all SDL_BlitSurface(tileSheets.at(sheet), &clip.at(tite), screen, &tileBox); I initilize them like this: for(int i = 0; i < number; i++) { SDL_Rect clipBox = {x,y,48,48}; clip.push_back(clipBox); } This is the error i get: http://imageshack.us/photo/my-images/836/83468944.png/ Any clues?
c++
sdl
codeblocks
blocks
null
null
open
Getting c++ runtime error when using a vector of SDL_Rect in SDL_blitsurface === SDL_BlitSurface(tileSheets.at(sheet), &clip[tile], screen, &tileBox); Works just fine and i initiliaze the clips like this: clip[ 0 ].x = x; clip[ 0 ].y = y; clip[ 0 ].w = 48; clip[ 0 ].h = 48; x += 48; clip[ 1 ].x = x; clip[ 1 ].y = y; clip[ 1 ].w = 48; clip[ 1 ].h = 48; This however doesnt work at all SDL_BlitSurface(tileSheets.at(sheet), &clip.at(tite), screen, &tileBox); I initilize them like this: for(int i = 0; i < number; i++) { SDL_Rect clipBox = {x,y,48,48}; clip.push_back(clipBox); } This is the error i get: http://imageshack.us/photo/my-images/836/83468944.png/ Any clues?
0
11,713,386
07/29/2012 22:07:08
613,338
02/11/2011 16:20:19
86
2
MongoDB - How to access an object in an array
I'm not able to describe my thought precisely in words, so here's an example: [ { 'description': 'fruits', 'examples': [ { 'name': 'Apple', 'color': ['red', 'green'] }, { 'name': 'Banana', 'color': 'yellow' } [] }, { 'description': 'vegetables', 'examples': [ { 'name': 'Tomato', 'color': 'red' }, { 'name': 'Carrot', 'color': 'orange' } ] }, { 'description': 'Wweets', 'examples': [ { 'name': 'Chocolate', 'color': ['brown', 'black', 'white'] }, { 'name': 'Candy', 'color': 'various' } } ] Let's go step by step: If I want to see all food categories, I query by the following command db.food.find() I want to see the vegetables db.food.find({ 'description': 'vegetables' }) **Now let's say I forgot how a Carrot looks like (lol). What do I do?** I tried the following (Native node.js MongoDB driver): collection.find({'examples.name': 'Carrot'}, function(err, example){ console.log(example) // It still returns me the whole object! }); As a result I expected MongoDB to return the next highest instance of the object. For example I wanted to do this. console.log(example.color) // 'orange' Do you have any idea? I'm new to document oriented DBs :/
arrays
node.js
mongodb
object
null
null
open
MongoDB - How to access an object in an array === I'm not able to describe my thought precisely in words, so here's an example: [ { 'description': 'fruits', 'examples': [ { 'name': 'Apple', 'color': ['red', 'green'] }, { 'name': 'Banana', 'color': 'yellow' } [] }, { 'description': 'vegetables', 'examples': [ { 'name': 'Tomato', 'color': 'red' }, { 'name': 'Carrot', 'color': 'orange' } ] }, { 'description': 'Wweets', 'examples': [ { 'name': 'Chocolate', 'color': ['brown', 'black', 'white'] }, { 'name': 'Candy', 'color': 'various' } } ] Let's go step by step: If I want to see all food categories, I query by the following command db.food.find() I want to see the vegetables db.food.find({ 'description': 'vegetables' }) **Now let's say I forgot how a Carrot looks like (lol). What do I do?** I tried the following (Native node.js MongoDB driver): collection.find({'examples.name': 'Carrot'}, function(err, example){ console.log(example) // It still returns me the whole object! }); As a result I expected MongoDB to return the next highest instance of the object. For example I wanted to do this. console.log(example.color) // 'orange' Do you have any idea? I'm new to document oriented DBs :/
0
11,713,387
07/29/2012 22:07:11
214,892
11/19/2009 19:16:00
1,713
36
Open jQuery dialog box on PHP header redirect
I have a few pages on my site that are protected from invalid access via checking several `$_SESSION` variables that are set during the login process. If an access request fails, then the page redirects to the standard login form. I've refactored my site to incorporate jQuery dialog boxes to handle the login and registration process and as only the index page is public-facing, these boxes are controlled by the default navigation bar. All other pages are protected via checking `$_SESSION` variables on page load. How can I incorporate the header redirect to the index page and open a warning dialog box that access is not allowed to that specific page?
php
jquery
redirect
null
null
null
open
Open jQuery dialog box on PHP header redirect === I have a few pages on my site that are protected from invalid access via checking several `$_SESSION` variables that are set during the login process. If an access request fails, then the page redirects to the standard login form. I've refactored my site to incorporate jQuery dialog boxes to handle the login and registration process and as only the index page is public-facing, these boxes are controlled by the default navigation bar. All other pages are protected via checking `$_SESSION` variables on page load. How can I incorporate the header redirect to the index page and open a warning dialog box that access is not allowed to that specific page?
0
11,713,388
07/29/2012 22:07:23
1,461,682
06/17/2012 10:24:20
29
0
How to create id of input box of form
I have this form. <table><tr><td> <FORM> <label> ID </label></td> <td> <input type=text id="inputp1_id" size=24 class="text"> </td></tr> <tr><td> <label>Type</label></td><td><select id="inputp1_type" name="inputp1_type"><option value="text">Text</option><option value="integer">Integer</option><option value="float">Float</option><option value="list_values">List of values</option> <option value="range">Range</option><option value="selection_collapsed">Selection (collapsed)</option><option value="selection_expanded">Selection (expanded)</option><option value="subimage">Subimage selection</option> <option value="polygon">Polygon selection</option><option value="horizontal_separator">Horizontal separator</option></select> </td></tr> <tr><td> <label > Description</label></td> <td><input type=text id="inputpi_description" size=24 class="text"> </td><!--style=" width:300px; height:20px;"--> </tr> <tr><td> <label>Value</label></td><td> <input type="text" name="inputp1_value" id="inputp1_value" class="text" size=24></td></tr> <tr><td> <label > Info (help)</label></td><td> <input type=text id="input1_value" size=24 class="text"></td></tr> <tr><td><label > Visible?</label></td><td><input type="checkbox" name="inputp1_visible" id="inputp1_visible"></td></tr></table> <!--</form>--></div> But (it's possible?) can create the id's input box? Because the variable these are "numbered". For example the first id in the form is inputp1_id but the number i want use how variable. It's possible create the id with the Javascript o Jquery? l=3 Id='inputp' +l+'_id' After this create the input text has the `id=inputp3_id`
javascript
jquery
forms
null
null
null
open
How to create id of input box of form === I have this form. <table><tr><td> <FORM> <label> ID </label></td> <td> <input type=text id="inputp1_id" size=24 class="text"> </td></tr> <tr><td> <label>Type</label></td><td><select id="inputp1_type" name="inputp1_type"><option value="text">Text</option><option value="integer">Integer</option><option value="float">Float</option><option value="list_values">List of values</option> <option value="range">Range</option><option value="selection_collapsed">Selection (collapsed)</option><option value="selection_expanded">Selection (expanded)</option><option value="subimage">Subimage selection</option> <option value="polygon">Polygon selection</option><option value="horizontal_separator">Horizontal separator</option></select> </td></tr> <tr><td> <label > Description</label></td> <td><input type=text id="inputpi_description" size=24 class="text"> </td><!--style=" width:300px; height:20px;"--> </tr> <tr><td> <label>Value</label></td><td> <input type="text" name="inputp1_value" id="inputp1_value" class="text" size=24></td></tr> <tr><td> <label > Info (help)</label></td><td> <input type=text id="input1_value" size=24 class="text"></td></tr> <tr><td><label > Visible?</label></td><td><input type="checkbox" name="inputp1_visible" id="inputp1_visible"></td></tr></table> <!--</form>--></div> But (it's possible?) can create the id's input box? Because the variable these are "numbered". For example the first id in the form is inputp1_id but the number i want use how variable. It's possible create the id with the Javascript o Jquery? l=3 Id='inputp' +l+'_id' After this create the input text has the `id=inputp3_id`
0
11,713,299
07/29/2012 21:55:20
369,708
06/17/2010 19:11:57
806
15
Loading images from URL which is behind oAuth
I am developing a google chrome extension which retrieves JSON from server after passing oAuth authorization. The json contains URL for images which I want to show on desktop notification. But I need to pass the oAuth access token along with this request as well. How can I do it?
javascript
oauth
google-chrome-extension
oauth-2.0
null
null
open
Loading images from URL which is behind oAuth === I am developing a google chrome extension which retrieves JSON from server after passing oAuth authorization. The json contains URL for images which I want to show on desktop notification. But I need to pass the oAuth access token along with this request as well. How can I do it?
0
11,713,391
07/29/2012 22:07:28
972,183
09/29/2011 23:56:30
35
1
Java infinite loop
I'm trying to use a while loop to handle user input like so; while(wordsize == 0){ System.out.println("Please enter Int;"); if (user_input.hasNextInt()) { wordsize = user_input.nextInt() ; System.out.println("You have selected " + wordsize + "\n"); } else { System.out.println("Error Invalid Input!"); } } However this loops forever, what im trying to do is ask the user to reenter there data when they enter the wrong details
java
null
null
null
null
null
open
Java infinite loop === I'm trying to use a while loop to handle user input like so; while(wordsize == 0){ System.out.println("Please enter Int;"); if (user_input.hasNextInt()) { wordsize = user_input.nextInt() ; System.out.println("You have selected " + wordsize + "\n"); } else { System.out.println("Error Invalid Input!"); } } However this loops forever, what im trying to do is ask the user to reenter there data when they enter the wrong details
0
11,713,395
07/29/2012 22:07:59
1,402,249
05/18/2012 00:43:28
3
1
PDF417 barcode encoding variation
I am trying to generate PDF417 barcode images, but I am noticing that the online generators give different results. For example, entering the same data and using "text" encoding with the same row/column sizes will give two different barcodes with these two online generators. http://www.racoindustries.com/barcodegenerator/2d/pdf417.aspx http://generator.onbarcode.com/online-pdf417-barcode-generator.aspx What is the explanation behind this variation? Thanks!
pdf
encoding
generator
barcode
null
null
open
PDF417 barcode encoding variation === I am trying to generate PDF417 barcode images, but I am noticing that the online generators give different results. For example, entering the same data and using "text" encoding with the same row/column sizes will give two different barcodes with these two online generators. http://www.racoindustries.com/barcodegenerator/2d/pdf417.aspx http://generator.onbarcode.com/online-pdf417-barcode-generator.aspx What is the explanation behind this variation? Thanks!
0
11,713,397
07/29/2012 22:08:03
1,527,752
07/16/2012 02:21:46
6
0
element in text file
Alright... I've been battling this for quite a while now. I am usually able to find the answers for any of my questions in this website but not for the passed 2 days! Ok, here we go... I am trying to do 2 things: I have a text file (Books.txt) and I am trying to create an application to display fiction and nonfiction (separately) books within a listbox. The text file reads this: Left Behind,Lahaye,F,7,11.25 A Tale of Two Cities,Dickens,F,100,8.24 Hang a Thousand Trees with Ribbons,Rinaldi,F,30,16.79 Saffy's Angel,McKay,F,20,8.22 Each Little Bird that Sings,Wiles,F,10,7.70 Abiding in Christ,Murray,N,3,12.20 Bible Prophecy,Lahaye and Hindson,N,5,14.95 Captivating,Eldredge,N,12,16 Growing Deep in the Christian Life,Swindoll,N,11,19.95 Prayers that Heal the Heart,Virkler,N,4,12.00 Grow in Grace,Ferguson,N,3,11.95 The Good and Beautiful God,Smith,N,7,11.75 Victory Over the Darkness,Anderson,N,12,16 The third to the last element either says "F" for fiction or "N" for nonfiction. I am trying to write a code to where the application looks into the text file, checks to see if element 3 is either an "F" or an "N", and posts only the title of the book (the first element) in the listbox. I've been searching and searching and cannot find the friggin code!!! Help!!! Please!!! For example reasons, my listbox is named lstInventory. thanks!
vb.net
null
null
null
null
null
open
element in text file === Alright... I've been battling this for quite a while now. I am usually able to find the answers for any of my questions in this website but not for the passed 2 days! Ok, here we go... I am trying to do 2 things: I have a text file (Books.txt) and I am trying to create an application to display fiction and nonfiction (separately) books within a listbox. The text file reads this: Left Behind,Lahaye,F,7,11.25 A Tale of Two Cities,Dickens,F,100,8.24 Hang a Thousand Trees with Ribbons,Rinaldi,F,30,16.79 Saffy's Angel,McKay,F,20,8.22 Each Little Bird that Sings,Wiles,F,10,7.70 Abiding in Christ,Murray,N,3,12.20 Bible Prophecy,Lahaye and Hindson,N,5,14.95 Captivating,Eldredge,N,12,16 Growing Deep in the Christian Life,Swindoll,N,11,19.95 Prayers that Heal the Heart,Virkler,N,4,12.00 Grow in Grace,Ferguson,N,3,11.95 The Good and Beautiful God,Smith,N,7,11.75 Victory Over the Darkness,Anderson,N,12,16 The third to the last element either says "F" for fiction or "N" for nonfiction. I am trying to write a code to where the application looks into the text file, checks to see if element 3 is either an "F" or an "N", and posts only the title of the book (the first element) in the listbox. I've been searching and searching and cannot find the friggin code!!! Help!!! Please!!! For example reasons, my listbox is named lstInventory. thanks!
0
11,713,398
07/29/2012 22:08:08
1,118,575
12/28/2011 02:22:55
43
2
New objects on mogenerator
Im new using Mogenerator (it looks great!). I just can't figure out how is the equivalent sentence to: NSManagedObject *mo = [NSEntityDescription ...] How should I create new objects in Mogen? Thanks in advance.
objective-c
core-data
mogenerator
null
null
null
open
New objects on mogenerator === Im new using Mogenerator (it looks great!). I just can't figure out how is the equivalent sentence to: NSManagedObject *mo = [NSEntityDescription ...] How should I create new objects in Mogen? Thanks in advance.
0
11,713,400
07/29/2012 22:08:19
1,561,590
07/29/2012 21:57:05
1
0
Book on Programming languages/compilers concepts
What are some good books which can answer questions like these: What is the stack ? What is the heap ? What is a stackframe ? Why do stackoverflow errors occur ? What are static/class variable in OO ? Why is a static method unable to access a non static member ? Thanks in advance !
compiler
programming-languages
theory
null
null
null
open
Book on Programming languages/compilers concepts === What are some good books which can answer questions like these: What is the stack ? What is the heap ? What is a stackframe ? Why do stackoverflow errors occur ? What are static/class variable in OO ? Why is a static method unable to access a non static member ? Thanks in advance !
0
11,713,401
07/29/2012 22:08:23
371,613
06/20/2010 16:55:21
134
6
Simple Java objects not deeply copying
This question should be rather easy for any Java developer. I swear I looked it up after spending ~2 hours on it, but I can't really understand what's wrong with this code. Basically, I am implementing Karger's minimum cuts algorithm. It requires me to keep merging nodes in a graph and then compute the number of crossing edges at the end (an int value). This algorithm must be repeated n times, always from the starting graph. My problem is that I am unable to create a deep copy of my Graph object, and I can't find the mistake. I have cropped the code to just show the problem and no more, but I am still unable to figure out what's wrong. Here the code is. Class Node: public class Node { public Integer Data; public Node() { Data = 0; } public Node(Node rhs) { Data = rhs.Data.intValue(); } public Node(Integer rhs) { Data = rhs.intValue(); } public void setNode(Integer rhs) { Data = rhs; } Class Graph: public class Graph { public ArrayList<ArrayList<Node>> AdjList; public ArrayList<Node> NodeSet; // This contains all the nodes public Graph() { AdjList = new ArrayList<ArrayList<Node>>(); NodeSet = new ArrayList<Node>(); } public Graph(Graph G) { AdjList = new ArrayList<ArrayList<Node>>(); for (ArrayList<Node> L : G.AdjList) { ArrayList<Node> Lcopy = new ArrayList<Node>(); for (Node N : L) { Node copy = new Node(N); Lcopy.add(copy); } AdjList.add(L); } } public void addNewAdjList(ArrayList<Node> NodeAdjList) { // Input is the adjacency list of a new node // The first element in the NodeAdjList is the node itself, the rest is the adj nodes AdjList.add(NodeAdjList); } public static void printAdjList(ArrayList<Node> Adjlist) { Node start = Adjlist.get(0); System.out.print(start.Data + " : "); for (int j=1; j < Adjlist.size(); ++j) { System.out.print(Adjlist.get(j).Data + ", "); } System.out.print("\n"); } Main: public class Main { /** * @param args */ public static void main(String[] args) { Node Five = new Node(5); Node Seven = new Node(7); Node One = new Node(1); Graph G = new Graph(); ArrayList<Node> L = new ArrayList<Node>(); L.add(Five); L.add(Seven); L.add(One); G.addNewAdjList(L); Graph R = new Graph(G); R.AdjList.get(0).get(1).setNode(19); // Gets node #1 in the first adj list, i.e. 7 Graph.printAdjList(G.AdjList.get(0)); Graph.printAdjList(R.AdjList.get(0)); } } Output: > 5 : 19, 1, > 5 : 19, 1, This kind of puzzles me to be honest. I understand that Java is pass by value only, but objects are always represented by their reference. As far as I understand, my copy constructor for G should always make a deep copy: I am moving through every adjacency list and then I am making a deep copy of the Node. I don't understand why invoking .setNode() on the copied object modifies also the original object (that has a different reference). Previous answers like [1][1] seem to go the same direction I am going, what am I missing here? :S [1]: http://stackoverflow.com/questions/64036/how-do-you-make-a-deep-copy-of-an-object-in-java
java
null
null
null
null
null
open
Simple Java objects not deeply copying === This question should be rather easy for any Java developer. I swear I looked it up after spending ~2 hours on it, but I can't really understand what's wrong with this code. Basically, I am implementing Karger's minimum cuts algorithm. It requires me to keep merging nodes in a graph and then compute the number of crossing edges at the end (an int value). This algorithm must be repeated n times, always from the starting graph. My problem is that I am unable to create a deep copy of my Graph object, and I can't find the mistake. I have cropped the code to just show the problem and no more, but I am still unable to figure out what's wrong. Here the code is. Class Node: public class Node { public Integer Data; public Node() { Data = 0; } public Node(Node rhs) { Data = rhs.Data.intValue(); } public Node(Integer rhs) { Data = rhs.intValue(); } public void setNode(Integer rhs) { Data = rhs; } Class Graph: public class Graph { public ArrayList<ArrayList<Node>> AdjList; public ArrayList<Node> NodeSet; // This contains all the nodes public Graph() { AdjList = new ArrayList<ArrayList<Node>>(); NodeSet = new ArrayList<Node>(); } public Graph(Graph G) { AdjList = new ArrayList<ArrayList<Node>>(); for (ArrayList<Node> L : G.AdjList) { ArrayList<Node> Lcopy = new ArrayList<Node>(); for (Node N : L) { Node copy = new Node(N); Lcopy.add(copy); } AdjList.add(L); } } public void addNewAdjList(ArrayList<Node> NodeAdjList) { // Input is the adjacency list of a new node // The first element in the NodeAdjList is the node itself, the rest is the adj nodes AdjList.add(NodeAdjList); } public static void printAdjList(ArrayList<Node> Adjlist) { Node start = Adjlist.get(0); System.out.print(start.Data + " : "); for (int j=1; j < Adjlist.size(); ++j) { System.out.print(Adjlist.get(j).Data + ", "); } System.out.print("\n"); } Main: public class Main { /** * @param args */ public static void main(String[] args) { Node Five = new Node(5); Node Seven = new Node(7); Node One = new Node(1); Graph G = new Graph(); ArrayList<Node> L = new ArrayList<Node>(); L.add(Five); L.add(Seven); L.add(One); G.addNewAdjList(L); Graph R = new Graph(G); R.AdjList.get(0).get(1).setNode(19); // Gets node #1 in the first adj list, i.e. 7 Graph.printAdjList(G.AdjList.get(0)); Graph.printAdjList(R.AdjList.get(0)); } } Output: > 5 : 19, 1, > 5 : 19, 1, This kind of puzzles me to be honest. I understand that Java is pass by value only, but objects are always represented by their reference. As far as I understand, my copy constructor for G should always make a deep copy: I am moving through every adjacency list and then I am making a deep copy of the Node. I don't understand why invoking .setNode() on the copied object modifies also the original object (that has a different reference). Previous answers like [1][1] seem to go the same direction I am going, what am I missing here? :S [1]: http://stackoverflow.com/questions/64036/how-do-you-make-a-deep-copy-of-an-object-in-java
0
11,713,405
07/29/2012 22:08:49
998,068
10/16/2011 18:02:08
13
1
Way to target specific type of pause using YouTube JS API?
The YouTube JS API just provides some generic events when interacting with the video. The problem is, I only want to do something when the user *intentionally* pauses the video via the pause button or by clicking the video itself. YouTube sends the same event data whether you are pausing the slider intentionally OR navigating to a different section of the video OR using the share elements OR showing the "more info" information. Are ideas on how to differentiate? I want to target specific pause events if that is possible.
javascript
jquery
api
youtube
null
null
open
Way to target specific type of pause using YouTube JS API? === The YouTube JS API just provides some generic events when interacting with the video. The problem is, I only want to do something when the user *intentionally* pauses the video via the pause button or by clicking the video itself. YouTube sends the same event data whether you are pausing the slider intentionally OR navigating to a different section of the video OR using the share elements OR showing the "more info" information. Are ideas on how to differentiate? I want to target specific pause events if that is possible.
0
11,319,269
07/03/2012 21:12:41
1,499,993
07/03/2012 21:10:41
1
0
Hide/Show problems on a questionerre application
I am doing an assignment involving the creation of a simple Quiz type form application. However, whenever I run the program, only the first answer shows for a multiple question and I cannot for the life of me figure out why. This is the contstructor: MultipleChoice dlg = new MultipleChoice( new Question("What is the capital of Zimbabwe?", new Answer("Paris", false), new Answer("Washington D.C.", false), new Answer("Harare", true), new Answer("Cairo", false), new Answer("N'Djamena", false))); if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.Correct) MessageBox.Show("You got something right!"); else MessageBox.Show("You couldn't be more wrong"); } And this is the Question Form Code: private Question Q; public MultipleChoice (Question q) { Q = q; InitializeComponent(); textPrompt.Text = Q.Prompt; if (Q.A != null) { radioA.Text = Q.A.Prompt; } else radioA.Hide(); if (Q.B != null) { radioB.Text = Q.B.Prompt; } radioB.Hide(); if (Q.C != null) { radioC.Text = Q.C.Prompt; } radioC.Hide(); if (Q.D != null) { radioD.Text = Q.D.Prompt; } radioD.Hide(); if (Q.E != null) { radioE.Text = Q.E.Prompt; } radioE.Hide(); } public bool Correct { get { if (Q == null) return false; if (Q.A != null && Q.A.Correct && radioA.Checked) return true; if (Q.B != null && Q.B.Correct && radioB.Checked) return true; if (Q.C != null && Q.C.Correct && radioC.Checked) return true; if (Q.D != null && Q.D.Correct && radioD.Checked) return true; if (Q.E != null && Q.E.Correct && radioE.Checked) return true; return false; } Where have I gone wrong? Thank you, Travis
c#
visual-studio-2010
null
null
null
null
open
Hide/Show problems on a questionerre application === I am doing an assignment involving the creation of a simple Quiz type form application. However, whenever I run the program, only the first answer shows for a multiple question and I cannot for the life of me figure out why. This is the contstructor: MultipleChoice dlg = new MultipleChoice( new Question("What is the capital of Zimbabwe?", new Answer("Paris", false), new Answer("Washington D.C.", false), new Answer("Harare", true), new Answer("Cairo", false), new Answer("N'Djamena", false))); if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.Correct) MessageBox.Show("You got something right!"); else MessageBox.Show("You couldn't be more wrong"); } And this is the Question Form Code: private Question Q; public MultipleChoice (Question q) { Q = q; InitializeComponent(); textPrompt.Text = Q.Prompt; if (Q.A != null) { radioA.Text = Q.A.Prompt; } else radioA.Hide(); if (Q.B != null) { radioB.Text = Q.B.Prompt; } radioB.Hide(); if (Q.C != null) { radioC.Text = Q.C.Prompt; } radioC.Hide(); if (Q.D != null) { radioD.Text = Q.D.Prompt; } radioD.Hide(); if (Q.E != null) { radioE.Text = Q.E.Prompt; } radioE.Hide(); } public bool Correct { get { if (Q == null) return false; if (Q.A != null && Q.A.Correct && radioA.Checked) return true; if (Q.B != null && Q.B.Correct && radioB.Checked) return true; if (Q.C != null && Q.C.Correct && radioC.Checked) return true; if (Q.D != null && Q.D.Correct && radioD.Checked) return true; if (Q.E != null && Q.E.Correct && radioE.Checked) return true; return false; } Where have I gone wrong? Thank you, Travis
0
11,319,270
07/03/2012 21:12:57
1,142,190
01/11/2012 02:22:25
146
3
date format dilemma?
I have this date from twitter, this represents the exact date the tweet is published, Sun, 01 Jul 2012 19:05:54 +0000 what I want is to make its format into MM/DD HH:MM, tried to look for php date formats but couldn't find a way to make it look exactly the way I want it to be. Can someone please help? Thanks.
php
date-format
php-date
null
null
null
open
date format dilemma? === I have this date from twitter, this represents the exact date the tweet is published, Sun, 01 Jul 2012 19:05:54 +0000 what I want is to make its format into MM/DD HH:MM, tried to look for php date formats but couldn't find a way to make it look exactly the way I want it to be. Can someone please help? Thanks.
0
11,319,172
07/03/2012 21:05:13
1,449,291
06/11/2012 15:13:20
29
1
How to implement collapsibles in iOS5?
I want to implement collapsibles in iOS5 for an app. How would I go about doing this? A collapsible is something you click on and the content expands downwards (usually).
ios5
xcode4.3
collapse
null
null
null
open
How to implement collapsibles in iOS5? === I want to implement collapsibles in iOS5 for an app. How would I go about doing this? A collapsible is something you click on and the content expands downwards (usually).
0
11,319,173
07/03/2012 21:05:14
54,082
01/12/2009 08:36:25
433
20
Is it a good practice to use followinf JS syntax?
I often rely on the fact that in Javascript conditional operators do not return true or false but one of the arguments. I often call functions as function(e){ this.someotherfunction.apply(this,e.config || []); } So far I have not come across any issues and when I tried to find out what Douglas Crockford (read JSLint) has to say about it, I haven't found any issue. Are there any dangers in using this kind of syntax ?
javascript
null
null
null
null
null
open
Is it a good practice to use followinf JS syntax? === I often rely on the fact that in Javascript conditional operators do not return true or false but one of the arguments. I often call functions as function(e){ this.someotherfunction.apply(this,e.config || []); } So far I have not come across any issues and when I tried to find out what Douglas Crockford (read JSLint) has to say about it, I haven't found any issue. Are there any dangers in using this kind of syntax ?
0
11,319,152
07/03/2012 21:03:56
344,769
05/19/2010 05:58:50
3,892
182
.htaccess - mod_dir with RewriteRule Proxy
I am running into an unusual problem. I have a series of sites that art pointing to my hosted site, for example purposes: http://sub.mydomain.com/help/ All these other sites use this .htaccess file Options +FollowSymLinks -Indexes RewriteEngine on RewriteRule ^(.*)$ http://sub.mydomain.com/$1 [P,E=Proxy-Host:sub.mydomain.com] It is working great for the most part. Let's call one of these other domains "sub.otherdomain.com". If I go to `http://sub.otherdomain.com/help/` it works fine. If I go to `http://sub.otherdomain.com/help` it is getting redirected to `http://sub.mydomain.com/help/` The reason is because [mod_dir](http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex) is redirecting the / to the main domain. I want it to redirect the / to the proxied domain. Any ideas?
.htaccess
proxy
mod-dir
null
null
null
open
.htaccess - mod_dir with RewriteRule Proxy === I am running into an unusual problem. I have a series of sites that art pointing to my hosted site, for example purposes: http://sub.mydomain.com/help/ All these other sites use this .htaccess file Options +FollowSymLinks -Indexes RewriteEngine on RewriteRule ^(.*)$ http://sub.mydomain.com/$1 [P,E=Proxy-Host:sub.mydomain.com] It is working great for the most part. Let's call one of these other domains "sub.otherdomain.com". If I go to `http://sub.otherdomain.com/help/` it works fine. If I go to `http://sub.otherdomain.com/help` it is getting redirected to `http://sub.mydomain.com/help/` The reason is because [mod_dir](http://httpd.apache.org/docs/2.0/mod/mod_dir.html#directoryindex) is redirecting the / to the main domain. I want it to redirect the / to the proxied domain. Any ideas?
0
11,319,271
07/03/2012 21:12:59
837,168
07/09/2011 22:48:00
26
0
jqgrid Posting name:value pair when deleting row?
I want to send some name:value pair from the row selected along with del command. from below script I want to send the "polpono" value to my php script when del command is issued. any help will be highly appreciated. $(document).ready(function(){ $("#datagrid").jqGrid({ url:'actionpo.php?vid=polpogridjq', datatype: 'xml', mtype: 'GET', colNames:['List#','PO#', 'Item Code','Item Detail','Qty','Price','Tax'], colModel :[ {name:'polistno', width:100,editable:true,editable:true,key:true}, {name:'polpono',index:'polpono', width:100,editable:true}, {name:'politemcode',index:'politemcode', width:100, align:'right',sortable:true,editable:true}, {name:'politemname', width:300, align:'left',sortable:false,editable:true}, {name:'politemqty',width:50, align:'right',sortable:false,editable:true}, {name:'politemvalue', width:80,align:'left',sortable:false,editable:true}, {name:'politemtax', width:50, align:'right',editable:true} ], pager: $('#pager'), rowNum:10, rowList:[10,20,30], sortname: 'polpono', sortorder: 'desc', shrinkToFit: false, rownumbers: false, multiselect: false, viewRecords: false, clearAfterAdd:true, caption: 'Itemised Quantity', editurl: "actionpo.php?vid=gridformcall", }).navGrid('#pager', { edit: true, add: true, del: true ,search:false, refresh:true},{ } }); });
post
jqgrid
delete-row
null
null
null
open
jqgrid Posting name:value pair when deleting row? === I want to send some name:value pair from the row selected along with del command. from below script I want to send the "polpono" value to my php script when del command is issued. any help will be highly appreciated. $(document).ready(function(){ $("#datagrid").jqGrid({ url:'actionpo.php?vid=polpogridjq', datatype: 'xml', mtype: 'GET', colNames:['List#','PO#', 'Item Code','Item Detail','Qty','Price','Tax'], colModel :[ {name:'polistno', width:100,editable:true,editable:true,key:true}, {name:'polpono',index:'polpono', width:100,editable:true}, {name:'politemcode',index:'politemcode', width:100, align:'right',sortable:true,editable:true}, {name:'politemname', width:300, align:'left',sortable:false,editable:true}, {name:'politemqty',width:50, align:'right',sortable:false,editable:true}, {name:'politemvalue', width:80,align:'left',sortable:false,editable:true}, {name:'politemtax', width:50, align:'right',editable:true} ], pager: $('#pager'), rowNum:10, rowList:[10,20,30], sortname: 'polpono', sortorder: 'desc', shrinkToFit: false, rownumbers: false, multiselect: false, viewRecords: false, clearAfterAdd:true, caption: 'Itemised Quantity', editurl: "actionpo.php?vid=gridformcall", }).navGrid('#pager', { edit: true, add: true, del: true ,search:false, refresh:true},{ } }); });
0
11,319,272
07/03/2012 21:13:01
1,426,522
05/30/2012 16:18:54
13
1
Mathematica Combining graphs and "delete x-achses"
I have two plots f1(x) and f2(x). I want to combine them in the way that in the plot there should by f1 on the axis of ordinates and f2 on the axis of abscissae. Any ideas? Thanks, Andreas
graph
mathematica
plot
show
combine
07/03/2012 22:31:50
off topic
Mathematica Combining graphs and "delete x-achses" === I have two plots f1(x) and f2(x). I want to combine them in the way that in the plot there should by f1 on the axis of ordinates and f2 on the axis of abscissae. Any ideas? Thanks, Andreas
2