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,262,225
06/29/2012 12:57:28
1,412,921
05/23/2012 14:46:24
36
1
AsyncTask one more time
Does there is a way to run my AsyncTask after it finish ? My app is to capture an image and put it on imagView then execute an AsyncTask on it. I have another button to take another photo then put it put cannot execute an AysncTask. I know form developer.Android that AsyncTask can not execute only except one time. This is my code. package com.ocr.id; import java.io.File; import java.io.IOException; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.MediaStore; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import com.ocr.id.ip.AndroidImage; import com.ocr.id.ip.Binarization; import com.ocr.id.ip.Crop; import com.ocr.id.ip.Segement; public class PreviewActivity extends Activity { private ImageView previewIV; private final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100; private String path; private boolean crop = true; private boolean resample = true; Crop cropID; Binarization binary; Segement seg; ProgressDialog previewPD; OnClickListener processOnClickListener = new OnClickListener() { public void onClick(View v) { segementTask task = new segementTask(); task.execute(path); } }; private OnClickListener backOnClickListener = new OnClickListener() { public void onClick(View v) { startActivityForResult( new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra( MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(path))), CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } }; protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { previewIV.setImageBitmap(AndroidImage .decodeSampledBitmapFromSDcard(path, 1000, 1000)); } } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.preview); path = getIntent().getExtras().getString("path"); previewIV = (ImageView) findViewById(R.id.previewPicID); Button process = (Button) findViewById(R.id.processID); process.setOnClickListener(processOnClickListener); Button back = (Button) findViewById(R.id.back); back.setOnClickListener(backOnClickListener); previewIV.setImageBitmap(AndroidImage.decodeSampledBitmapFromSDcard( path, 1000, 1000)); } class segementTask extends AsyncTask<String, Integer, Void> { @Override protected void onPreExecute() { previewPD = ProgressDialog.show(PreviewActivity.this, "Id-OCR", "Processing..."); previewPD.setCancelable(false); super.onPreExecute(); } @Override protected Void doInBackground(String... params) { try { seg = new Segement(PreviewActivity.this, params[0]); seg.segmentNumbers(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { previewPD.dismiss(); previewPD = null; Toast.makeText(PreviewActivity.this, "Processing done", Toast.LENGTH_LONG).show(); super.onPostExecute(result); } } }
android
android-asynctask
null
null
null
null
open
AsyncTask one more time === Does there is a way to run my AsyncTask after it finish ? My app is to capture an image and put it on imagView then execute an AsyncTask on it. I have another button to take another photo then put it put cannot execute an AysncTask. I know form developer.Android that AsyncTask can not execute only except one time. This is my code. package com.ocr.id; import java.io.File; import java.io.IOException; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.MediaStore; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.Toast; import com.ocr.id.ip.AndroidImage; import com.ocr.id.ip.Binarization; import com.ocr.id.ip.Crop; import com.ocr.id.ip.Segement; public class PreviewActivity extends Activity { private ImageView previewIV; private final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 100; private String path; private boolean crop = true; private boolean resample = true; Crop cropID; Binarization binary; Segement seg; ProgressDialog previewPD; OnClickListener processOnClickListener = new OnClickListener() { public void onClick(View v) { segementTask task = new segementTask(); task.execute(path); } }; private OnClickListener backOnClickListener = new OnClickListener() { public void onClick(View v) { startActivityForResult( new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra( MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(path))), CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE); } }; protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { previewIV.setImageBitmap(AndroidImage .decodeSampledBitmapFromSDcard(path, 1000, 1000)); } } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.preview); path = getIntent().getExtras().getString("path"); previewIV = (ImageView) findViewById(R.id.previewPicID); Button process = (Button) findViewById(R.id.processID); process.setOnClickListener(processOnClickListener); Button back = (Button) findViewById(R.id.back); back.setOnClickListener(backOnClickListener); previewIV.setImageBitmap(AndroidImage.decodeSampledBitmapFromSDcard( path, 1000, 1000)); } class segementTask extends AsyncTask<String, Integer, Void> { @Override protected void onPreExecute() { previewPD = ProgressDialog.show(PreviewActivity.this, "Id-OCR", "Processing..."); previewPD.setCancelable(false); super.onPreExecute(); } @Override protected Void doInBackground(String... params) { try { seg = new Segement(PreviewActivity.this, params[0]); seg.segmentNumbers(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { previewPD.dismiss(); previewPD = null; Toast.makeText(PreviewActivity.this, "Processing done", Toast.LENGTH_LONG).show(); super.onPostExecute(result); } } }
0
11,262,226
06/29/2012 12:57:31
753,621
05/14/2011 12:53:43
121
13
Intellij IDEA Image comments plugin?
I've need of plugin for IDEA which allows link or attach images (prefferably, svg) to java/xml code comments (because my project is case when one picture is worth thousand words).. So, is there such plugin available? And if there is't, is it hard to implement such plugin by myself?
plugins
comments
javadoc
null
null
null
open
Intellij IDEA Image comments plugin? === I've need of plugin for IDEA which allows link or attach images (prefferably, svg) to java/xml code comments (because my project is case when one picture is worth thousand words).. So, is there such plugin available? And if there is't, is it hard to implement such plugin by myself?
0
11,262,232
06/29/2012 12:57:50
930,450
09/06/2011 10:36:29
1,982
105
What do I have to extend for custom grid with good performance?
I need a GridView with rows with different height. Only for rows, not for items inside a row. In a row the items have the same height. I already tried to do that with Android's GridView but got strange things. The grid distorts when scrolling up and down and at some point, when scrolling up, it dissapears. If I put all rows with the same height, it works, but as soon as they are a bit different, the problem appears. So it seems I have to make a custom view. It has to have very good performance and low memory usage. Would be enough to extend, for example, Relative Layout, and put all my items with certain top and left margin? Or do extend View and draw directly to the canvas? Or a Scroller? Embedded question: Will this, (maybe it depends if I extends some Layout or directly View), manage to load only the things which appear on the screen (the list is very long and I don't want all the objects in memory at once) or do I have to implement this myself? Thanks in advance!
android
gridview
custom-controls
null
null
null
open
What do I have to extend for custom grid with good performance? === I need a GridView with rows with different height. Only for rows, not for items inside a row. In a row the items have the same height. I already tried to do that with Android's GridView but got strange things. The grid distorts when scrolling up and down and at some point, when scrolling up, it dissapears. If I put all rows with the same height, it works, but as soon as they are a bit different, the problem appears. So it seems I have to make a custom view. It has to have very good performance and low memory usage. Would be enough to extend, for example, Relative Layout, and put all my items with certain top and left margin? Or do extend View and draw directly to the canvas? Or a Scroller? Embedded question: Will this, (maybe it depends if I extends some Layout or directly View), manage to load only the things which appear on the screen (the list is very long and I don't want all the objects in memory at once) or do I have to implement this myself? Thanks in advance!
0
11,262,236
06/29/2012 12:58:10
875,311
08/02/2011 19:09:27
696
52
Chrome for iOS Remote Debugger
With the recent release of Chrome for iOS, I was wondering how do you enable remote debugging for Chrome iOS?
google-chrome
google-chrome-devtools
chrome-ios
null
null
null
open
Chrome for iOS Remote Debugger === With the recent release of Chrome for iOS, I was wondering how do you enable remote debugging for Chrome iOS?
0
11,262,237
06/29/2012 12:58:13
1,302,273
03/30/2012 02:47:52
1
2
How to apply hover effect to show and hide buttons on each div?
$(document).ready(function () { $("#divHeader")) { $(this).hover( function () { $(this).find('#edit').show(); $(this).find('#spandate').removeClass("datetime"); $(this).find('#spandate').addClass("edit"); }, function () { $(this).find('#edit').hide(); $(this).find('#spandate').addClass("datetime"); $(this).find('#spandate').removeClass("edit"); }); }); In my page I have 3 div with same name ("divHeader") , But it apply only first div and skip for other two. please tell me how to apply on all <div> using ID ?
jquery
null
null
null
null
null
open
How to apply hover effect to show and hide buttons on each div? === $(document).ready(function () { $("#divHeader")) { $(this).hover( function () { $(this).find('#edit').show(); $(this).find('#spandate').removeClass("datetime"); $(this).find('#spandate').addClass("edit"); }, function () { $(this).find('#edit').hide(); $(this).find('#spandate').addClass("datetime"); $(this).find('#spandate').removeClass("edit"); }); }); In my page I have 3 div with same name ("divHeader") , But it apply only first div and skip for other two. please tell me how to apply on all <div> using ID ?
0
11,261,545
06/29/2012 12:11:06
1,336,939
04/04/2012 18:31:33
67
5
PHP Char causes null when querying a mysql db
There's a field in the database that contains the character with ASCII code: 8216 and the respective closing 8217 (I would say that they are single quotes). An example of a value for this field: ERROR: compilation failed for package <b>‘</b>robustbase<b>’</b> When I try to retrieve it from my php script I get the field *q* as null: $qrow = array("id" => $id, "ip" => mysql_result($result, $_SESSION['row'], 1), "q" => mysql_result($result, $_SESSION['row'], 2), "time" => mysql_result($result, $_SESSION['row'], 3), "ua" => mysql_result($result, $_SESSION['row'], 4), "sess" => mysql_result($result, $_SESSION['row'], 5), "links" => $alinks); The other fields are perfectly fine.
php
mysql
null
null
null
null
open
PHP Char causes null when querying a mysql db === There's a field in the database that contains the character with ASCII code: 8216 and the respective closing 8217 (I would say that they are single quotes). An example of a value for this field: ERROR: compilation failed for package <b>‘</b>robustbase<b>’</b> When I try to retrieve it from my php script I get the field *q* as null: $qrow = array("id" => $id, "ip" => mysql_result($result, $_SESSION['row'], 1), "q" => mysql_result($result, $_SESSION['row'], 2), "time" => mysql_result($result, $_SESSION['row'], 3), "ua" => mysql_result($result, $_SESSION['row'], 4), "sess" => mysql_result($result, $_SESSION['row'], 5), "links" => $alinks); The other fields are perfectly fine.
0
11,261,547
06/29/2012 12:11:09
1,393,855
05/14/2012 13:32:23
21
3
Bluetooth + Phonegap + Android =?
I'm intended to program an interface with HTML/JAVASCRIPT/jQuery to control an electronic device. The communication must be via Bluetooth (there's already an instruction set to control the device in existence, and the device is already Bluetooth-capable), and this interface should be portable to an android app via Phonegap... so I would love to get some advice in how to establish a Bluetooth communication with HTML or JAVASCRIPT, and to port it via Phonegap... tutorials, books, or whatever kind of hint will be warmly wellcomed!
javascript
html
bluetooth
null
null
null
open
Bluetooth + Phonegap + Android =? === I'm intended to program an interface with HTML/JAVASCRIPT/jQuery to control an electronic device. The communication must be via Bluetooth (there's already an instruction set to control the device in existence, and the device is already Bluetooth-capable), and this interface should be portable to an android app via Phonegap... so I would love to get some advice in how to establish a Bluetooth communication with HTML or JAVASCRIPT, and to port it via Phonegap... tutorials, books, or whatever kind of hint will be warmly wellcomed!
0
11,471,584
07/13/2012 13:35:53
829,930
07/05/2011 14:42:44
154
0
How to get ORA error code in C# exception?
My code looks like that: public bool myQuery(string cmd) { try { OracleCommand command = null; command = new OracleCommand(cmd, sqlConnection); command.ExecuteReader(); } catch (Exception ex) { MessageBox.Show(ex.Message, "error!"); return false; } return true; } My issue is when error ORA-02291 occurred in Oracle. It is not catched by Exception. No error was shown.. How to catch that error ?
c#
winforms
oracle
null
null
null
open
How to get ORA error code in C# exception? === My code looks like that: public bool myQuery(string cmd) { try { OracleCommand command = null; command = new OracleCommand(cmd, sqlConnection); command.ExecuteReader(); } catch (Exception ex) { MessageBox.Show(ex.Message, "error!"); return false; } return true; } My issue is when error ORA-02291 occurred in Oracle. It is not catched by Exception. No error was shown.. How to catch that error ?
0
11,471,233
07/13/2012 13:13:18
1,517,769
07/11/2012 12:35:10
3
0
How to multiply values which returns web services and see in listView in Android?
Here is my code! I want to multiply user cost with 12. and I want to add this count(cost*12) to list view.But I add only String columns to list view because of list adapter.How can also add integer value by multplying ? static final String KEY_ITEM= "USER_ID"; static final String KEY_NAME = "USER_NAME"; static final String KEY_SURNAME = "USER_SURNAME"; static final String KEY_DATE = "USER_DATE"; static final String KEY_COST="USER_COST"; HashMap<String, String> map = new HashMap<String, String>(); Element e = (Element) nl.item(i); map.put(KEY_ITEM, conParser.getValue(e, KEY_ITEM)); map.put(KEY_NAME, conParser.getValue(e, KEY_NAME)); map.put(KEY_SURNAME, conParser.getValue(e, KEY_SURNAME)); map.put(KEY_DATE, conParser.getValue(e, KEY_DATE)); map.put(KEY_COST, conParser.getValue(e, KEY_COST)); items.add(map); final ListAdapter adapter = new SimpleAdapter(this, items, R.layout.list_item, new String[] {KEY_ITEM,KEY_NAME,KEY_SURNAME,temp,KEY_DATE,KEY_COST}, new int[] { R.id.kod, R.id.isim,R.id.kisi_sayisi,R.id.adisyon_sayisi,R.id.toplam_satis}); setListAdapter(adapter);
android
listview
null
null
null
null
open
How to multiply values which returns web services and see in listView in Android? === Here is my code! I want to multiply user cost with 12. and I want to add this count(cost*12) to list view.But I add only String columns to list view because of list adapter.How can also add integer value by multplying ? static final String KEY_ITEM= "USER_ID"; static final String KEY_NAME = "USER_NAME"; static final String KEY_SURNAME = "USER_SURNAME"; static final String KEY_DATE = "USER_DATE"; static final String KEY_COST="USER_COST"; HashMap<String, String> map = new HashMap<String, String>(); Element e = (Element) nl.item(i); map.put(KEY_ITEM, conParser.getValue(e, KEY_ITEM)); map.put(KEY_NAME, conParser.getValue(e, KEY_NAME)); map.put(KEY_SURNAME, conParser.getValue(e, KEY_SURNAME)); map.put(KEY_DATE, conParser.getValue(e, KEY_DATE)); map.put(KEY_COST, conParser.getValue(e, KEY_COST)); items.add(map); final ListAdapter adapter = new SimpleAdapter(this, items, R.layout.list_item, new String[] {KEY_ITEM,KEY_NAME,KEY_SURNAME,temp,KEY_DATE,KEY_COST}, new int[] { R.id.kod, R.id.isim,R.id.kisi_sayisi,R.id.adisyon_sayisi,R.id.toplam_satis}); setListAdapter(adapter);
0
11,470,556
07/13/2012 12:30:25
1,523,505
07/13/2012 12:17:30
1
0
Android ListView and multiple threads that updates the listview
I have an activity with one listview showing items. This activity has three buttons and a menu with multiple other buttons. When i push one button, a new thread is launched, gets datas from a web service, fills the listview. Then the listview is shown. The only problem is that each time i push one of the buttons, i launch a thread. Depending on how long it takes for the datas to be retrieved, it happens sometimes that the listview is not filled with the good datas (it the user doesn't wait for one thread to be finished and pushes another button) First i tried to cancel the thread but it does not work (async task or with thread.interrupt) How can i stop previous threads so that the listview will be filled with the last datas ? Thanks for the help :)
android
multithreading
listview
activity
null
null
open
Android ListView and multiple threads that updates the listview === I have an activity with one listview showing items. This activity has three buttons and a menu with multiple other buttons. When i push one button, a new thread is launched, gets datas from a web service, fills the listview. Then the listview is shown. The only problem is that each time i push one of the buttons, i launch a thread. Depending on how long it takes for the datas to be retrieved, it happens sometimes that the listview is not filled with the good datas (it the user doesn't wait for one thread to be finished and pushes another button) First i tried to cancel the thread but it does not work (async task or with thread.interrupt) How can i stop previous threads so that the listview will be filled with the last datas ? Thanks for the help :)
0
11,471,586
07/13/2012 13:36:13
1,372,560
05/03/2012 13:11:37
13
0
Python compare contents of files and replace content of one of them
I am sorry if my title sounds confusing. I am writing a Python script that compares 2 XML files. In both files we have data for which the id's are equal to those in the other file. E.g. Source file: <id>123456</id> <data>blabla</data> ......some other data...... <id>abcde</id> <data>gfkgjk</data> ......some more data.......... Target file: <id>123456</id> <data> </data> ......some other data...... <id>ghijk</id> <data>gfkgjk</data> ......some more data.......... As you can see in the above examples, not all ID's that are in the source file are also in the target file. Furthermore, although 2 data groups have the same ID, one has the "data" tags filled out, the other hasn't. My programme is supposed to have a look at the source file, extract the id and the text between the data tags. Then it looks into the target file, and if there is data with the same ID and empty data tags (like in the example above), it fills in these empty tags with the information from the source file. (By the way: apart from the ID and the data information, the two XMLs are completely different, therefore I can't just keep the source file). Right, I was able to extract the ID and the info between the data tags. Now I'm trying to write a function to compare the ids and replace the empty data info if there is one. However, I'm not very familiar with Python and functions and need some help. Here is what my function looks like: def replace_empty_data(): for x in xmlData_id_source: if xmlData_id_source==xmlData_id_target: target = re.sub(xmlData_2,xmlData,target) return target file_target.close() There's probably loads missing in the function, but I don't know what. It doesn't give me any errors and is simply not working. Variables except x have been defined in earlier parts of the code, so this is not an issue. xmlData_id_source is the ID from the source file xmlData_id_target is the ID from the target file xmlData_2 is the data information from the target file xmlData is the data information from the source file I am grateful for any kind of input. Thanks in advance and kind regards
python
replace
compare
null
null
null
open
Python compare contents of files and replace content of one of them === I am sorry if my title sounds confusing. I am writing a Python script that compares 2 XML files. In both files we have data for which the id's are equal to those in the other file. E.g. Source file: <id>123456</id> <data>blabla</data> ......some other data...... <id>abcde</id> <data>gfkgjk</data> ......some more data.......... Target file: <id>123456</id> <data> </data> ......some other data...... <id>ghijk</id> <data>gfkgjk</data> ......some more data.......... As you can see in the above examples, not all ID's that are in the source file are also in the target file. Furthermore, although 2 data groups have the same ID, one has the "data" tags filled out, the other hasn't. My programme is supposed to have a look at the source file, extract the id and the text between the data tags. Then it looks into the target file, and if there is data with the same ID and empty data tags (like in the example above), it fills in these empty tags with the information from the source file. (By the way: apart from the ID and the data information, the two XMLs are completely different, therefore I can't just keep the source file). Right, I was able to extract the ID and the info between the data tags. Now I'm trying to write a function to compare the ids and replace the empty data info if there is one. However, I'm not very familiar with Python and functions and need some help. Here is what my function looks like: def replace_empty_data(): for x in xmlData_id_source: if xmlData_id_source==xmlData_id_target: target = re.sub(xmlData_2,xmlData,target) return target file_target.close() There's probably loads missing in the function, but I don't know what. It doesn't give me any errors and is simply not working. Variables except x have been defined in earlier parts of the code, so this is not an issue. xmlData_id_source is the ID from the source file xmlData_id_target is the ID from the target file xmlData_2 is the data information from the target file xmlData is the data information from the source file I am grateful for any kind of input. Thanks in advance and kind regards
0
11,471,589
07/13/2012 13:36:30
1,474,261
06/22/2012 08:32:44
21
0
I am getting utOfMemoryError because of not deleting previous bitmaps
In my android app , when i run one of my activity second time i get OutOfMemoryError. I think I need to delete the bitmaps from the firts time when the activity run.But i dont know how i can do this.Thank you
android
outofmemoryerror
null
null
null
null
open
I am getting utOfMemoryError because of not deleting previous bitmaps === In my android app , when i run one of my activity second time i get OutOfMemoryError. I think I need to delete the bitmaps from the firts time when the activity run.But i dont know how i can do this.Thank you
0
11,471,592
07/13/2012 13:36:40
1,498,136
07/03/2012 08:16:34
1
0
Copying data into new sheet depending upon selection of rows or columns based upon highlighted
Hy. This question may be posted on other forums as well but i am unable to find out my answer. please its urgent. I want a macro that could - Copy my selected rows or columns or cells. - makes new file.xlsx - pastes that data in that sheet. THAT'S ALL. Please urgently waiting for macro
excel
vba
excel-vba
copying
null
07/16/2012 02:04:29
not a real question
Copying data into new sheet depending upon selection of rows or columns based upon highlighted === Hy. This question may be posted on other forums as well but i am unable to find out my answer. please its urgent. I want a macro that could - Copy my selected rows or columns or cells. - makes new file.xlsx - pastes that data in that sheet. THAT'S ALL. Please urgently waiting for macro
1
11,465,818
07/13/2012 07:15:46
953,367
09/19/2011 19:11:04
1
0
Richfaces Picklist add items via Ajax
I need to add items to a rich:picklilst after it has loaded via Ajax/jQuery. Everything works well except choosing items from the picklist. Firebug claims: "B.item is undefined" Is there a solution for that problem or any other way to insert new items into a picklist without rerendering the whole picklsit? In my case, we're talking about 3.000 items in the picklist which causes the browser to render about 13.000 DOM elements. Best Regards, Eddy
jquery
ajax
richfaces
seam
null
null
open
Richfaces Picklist add items via Ajax === I need to add items to a rich:picklilst after it has loaded via Ajax/jQuery. Everything works well except choosing items from the picklist. Firebug claims: "B.item is undefined" Is there a solution for that problem or any other way to insert new items into a picklist without rerendering the whole picklsit? In my case, we're talking about 3.000 items in the picklist which causes the browser to render about 13.000 DOM elements. Best Regards, Eddy
0
11,471,286
07/13/2012 13:16:49
1,149,913
01/15/2012 00:32:56
104
19
Eclipse refactor: change constructor method signature for all subclasses
In eclipse, is there a way refactor a superclass constructor method signature so that all of the subclass constructors with the same signature are also refactored in the same way?
java
eclipse
refactoring
null
null
null
open
Eclipse refactor: change constructor method signature for all subclasses === In eclipse, is there a way refactor a superclass constructor method signature so that all of the subclass constructors with the same signature are also refactored in the same way?
0
11,319,309
07/03/2012 21:15:34
833,879
07/07/2011 15:43:36
8
1
How to generate database with table of variable number of columns?
In my Android app, I need to temporarily store some data in a form of table such as follows: id | column 1 | column 2 | ... | column n The data are downloaded from a server whenever users press a button. However, the data table doesn't have a fix number of column (as well as row) every time user downloads it from the server. For example, the server may send data with 3 columns the first time. Then it might send data with 5 columns the second time, etc... Given this scenario, I think the database is probably the right data structure to use. My plan is to create a database, then add and delete tables as necessary. So I have been reading various tutorials on Android database (one example is this one http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android#). It seems to me I cannot create new table with variable number of columns using the sqlite database. Is this correct? In the onCreate(SQLiteDatabase db) method, the "create table" command must be specified with known number of columns and their data types. I could provide several "create table" commands, each with different number of columns but that seems like very crude. Is there a way to create database tables with variable number of columns on the fly? Another alternative probably using several hash tables, each storing one column of the data table. I'm seriously considering this approach if the database approach is not possible. Any better suggestion is welcomed.
android
database
sqlite
null
null
null
open
How to generate database with table of variable number of columns? === In my Android app, I need to temporarily store some data in a form of table such as follows: id | column 1 | column 2 | ... | column n The data are downloaded from a server whenever users press a button. However, the data table doesn't have a fix number of column (as well as row) every time user downloads it from the server. For example, the server may send data with 3 columns the first time. Then it might send data with 5 columns the second time, etc... Given this scenario, I think the database is probably the right data structure to use. My plan is to create a database, then add and delete tables as necessary. So I have been reading various tutorials on Android database (one example is this one http://www.codeproject.com/Articles/119293/Using-SQLite-Database-with-Android#). It seems to me I cannot create new table with variable number of columns using the sqlite database. Is this correct? In the onCreate(SQLiteDatabase db) method, the "create table" command must be specified with known number of columns and their data types. I could provide several "create table" commands, each with different number of columns but that seems like very crude. Is there a way to create database tables with variable number of columns on the fly? Another alternative probably using several hash tables, each storing one column of the data table. I'm seriously considering this approach if the database approach is not possible. Any better suggestion is welcomed.
0
10,892,258
06/05/2012 05:51:51
149,482
08/03/2009 03:53:31
16,968
538
Python's resource.setrlimit on Windows?
What are the Windows equivalents to the resource limit mechanisms exposed on Unix systems by Python's `resource` module?
python
windows
unix
ulimit
setrlimit
null
open
Python's resource.setrlimit on Windows? === What are the Windows equivalents to the resource limit mechanisms exposed on Unix systems by Python's `resource` module?
0
11,319,314
07/03/2012 21:15:59
1,262,638
03/11/2012 17:48:03
8
2
Deleted/updated/added contacts on Android using ContentObserver
How can I get the contacts updated/deleted or added when something has change on the contacts table? Please give me an example :)! Thanks
android
contacts
contentobserver
null
null
07/04/2012 15:22:02
not a real question
Deleted/updated/added contacts on Android using ContentObserver === How can I get the contacts updated/deleted or added when something has change on the contacts table? Please give me an example :)! Thanks
1
11,319,315
07/03/2012 21:16:02
1,217,736
12/21/2011 20:25:35
92
10
EditText.setText() gives index out of bounds
I'm having an error I can't seem to wrap my head around. I'm writing an app that allows the user to send text from an `EditText` to a `TextView`. If the user makes a mistake, the user can hit the space key to bring the most recent text sent from the `EditText` to the `TextView`. This works sometimes, but other times, it gives me an `IndexOutOfBounds` exception. textInput is an EditText, back1,2,3 are the three most recent strings (with back1 the most recent) public void onTextChanged(CharSequence s, int start, int before, int count) { if(count==1&&before==0&&s.toString().equals(" ")){ textInput.setText(back1); }else if(s.toString().equals(back1 + " ")){ textInput.setText(back2); }else if(s.toString().equals(back2 + " ")){ textInput.setText(back3); //causes error if back2 > back3 } textInput.setSelection(textInput.getText().toString().length()); The above code checks if the user hit the space key, and if so, what to do with it. If the user pressed space on an empty EditText, they get the last thing they sent. If they hit space again, they get the next to last thing they sent, and so on. This is still a bit rough, but I hope you get the idea. The OutOfBounds exception comes from taking a large item in the `EditText`, hitting space, and setting the `EditText` to a smaller string. I assumed it was because the cursor is at the end of the `EditText` and could no longer be there when the text got smaller, so I tried adding `textInput.setSelection(0)` right before the `setText()`. That didn't help. I also tried setting the `EditText` to `setText("")`. That didn't work either. If I comment out the lines of `setText(back#)`, everything works fine. An example: A user types in "hello", "hi" and "hey" in that order. back3 = hello, back2 = hi, and back1 = hey. Hitting space once will set the EditText to "hey" A second tap will crash, since the `setSpan(3...4) ends beyond length 2`, presumably because back 1 is larger than back2. It is supposed to set the text in the `EditText` to "hi"
android
edittext
indexoutofboundsexception
null
null
null
open
EditText.setText() gives index out of bounds === I'm having an error I can't seem to wrap my head around. I'm writing an app that allows the user to send text from an `EditText` to a `TextView`. If the user makes a mistake, the user can hit the space key to bring the most recent text sent from the `EditText` to the `TextView`. This works sometimes, but other times, it gives me an `IndexOutOfBounds` exception. textInput is an EditText, back1,2,3 are the three most recent strings (with back1 the most recent) public void onTextChanged(CharSequence s, int start, int before, int count) { if(count==1&&before==0&&s.toString().equals(" ")){ textInput.setText(back1); }else if(s.toString().equals(back1 + " ")){ textInput.setText(back2); }else if(s.toString().equals(back2 + " ")){ textInput.setText(back3); //causes error if back2 > back3 } textInput.setSelection(textInput.getText().toString().length()); The above code checks if the user hit the space key, and if so, what to do with it. If the user pressed space on an empty EditText, they get the last thing they sent. If they hit space again, they get the next to last thing they sent, and so on. This is still a bit rough, but I hope you get the idea. The OutOfBounds exception comes from taking a large item in the `EditText`, hitting space, and setting the `EditText` to a smaller string. I assumed it was because the cursor is at the end of the `EditText` and could no longer be there when the text got smaller, so I tried adding `textInput.setSelection(0)` right before the `setText()`. That didn't help. I also tried setting the `EditText` to `setText("")`. That didn't work either. If I comment out the lines of `setText(back#)`, everything works fine. An example: A user types in "hello", "hi" and "hey" in that order. back3 = hello, back2 = hi, and back1 = hey. Hitting space once will set the EditText to "hey" A second tap will crash, since the `setSpan(3...4) ends beyond length 2`, presumably because back 1 is larger than back2. It is supposed to set the text in the `EditText` to "hi"
0
11,319,317
07/03/2012 21:16:10
1,499,986
07/03/2012 21:09:01
1
0
I'm trying to use media queries to make my site responsive, and I'm failing. I wonder if I'm missing something simple?
The website that I'm working on has a background image and a separate header image, and I'd like to use media queries to get them as well the text on the header image to resize appropriately for different screens. I've played around with a lot of options based on different tutorials, but I still don't think my stylesheet is working as it should be. Here's an example of my css: @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { img {max-width: 90%;} #wrapper { max-width: 90%; } #wrapperbg { max-width: 90%; } #header { max-width: 90%; } #navlist { max-width: 90%; font-size: 80%; font-family: agency, sans-serif; } #navlist2 { max-width: 90%; } #navlist li {max-width: 10%; font-size: 1.5em; font-family: sans-serif; } } I've included the line in the header as well: <meta name="viewport" content="initial-scale=1.0, width=device-width"/> I'm fairly new to trying to use media queries for a responsive design, so I know I'm making some ignorant mistake. Any help would be very appreciated. Thank you.
wordpress
mobile
media-queries
null
null
null
open
I'm trying to use media queries to make my site responsive, and I'm failing. I wonder if I'm missing something simple? === The website that I'm working on has a background image and a separate header image, and I'd like to use media queries to get them as well the text on the header image to resize appropriately for different screens. I've played around with a lot of options based on different tutorials, but I still don't think my stylesheet is working as it should be. Here's an example of my css: @media only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait) { img {max-width: 90%;} #wrapper { max-width: 90%; } #wrapperbg { max-width: 90%; } #header { max-width: 90%; } #navlist { max-width: 90%; font-size: 80%; font-family: agency, sans-serif; } #navlist2 { max-width: 90%; } #navlist li {max-width: 10%; font-size: 1.5em; font-family: sans-serif; } } I've included the line in the header as well: <meta name="viewport" content="initial-scale=1.0, width=device-width"/> I'm fairly new to trying to use media queries for a responsive design, so I know I'm making some ignorant mistake. Any help would be very appreciated. Thank you.
0
11,319,319
07/03/2012 21:16:27
1,188,511
02/03/2012 21:50:23
39
1
log4net BufferingForwardingAppender performance with RollingLogFileAppender
I was doing some very basic benchs of log4net and I tried to decorate a RollingFileAppender with a BufferingForwardingAppender. I experience horrible performance going through the BufferingForwardingAppender instead of directly through the RollingFileAppender and I really don't get the reason. Here is my configuration <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="c:\" /> <appendToFile value="false" /> <rollingStyle value="Composite" /> <datePattern value="'.'MMdd-HH'.log'" /> <maxSizeRollBackups value="168" /> <staticLogFileName value="false" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> </layout> </appender> <appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender"> <bufferSize value="512" /> <appender-ref ref="RollingLogFileAppender" /> </appender> <root> <level value="DEBUG" /> <appender-ref ref="BufferingForwardingAppender" /> </root> And here is the benchmark (very simple code) var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < 100000; i++) { Log.Debug("Hello"); } stopWatch.Stop(); Console.WriteLine("Done in {0} ms", stopWatch.ElapsedMilliseconds); Going directly through RollingFileAppender the output is : Done in 511 ms Whereas going through the BufferingForwardingAppender decorating the RollingFileAppender : Done in 14261 ms That's approx 30 times slower. I thought I would gain some speed by buffering a certain ammount of log before writing them to the file, however for some reason it gets things much worse. Seems to me like the configuration is OK, so this is really weird. Anyone got a clue ? Thanks !
c#
performance
log4net
appender
null
null
open
log4net BufferingForwardingAppender performance with RollingLogFileAppender === I was doing some very basic benchs of log4net and I tried to decorate a RollingFileAppender with a BufferingForwardingAppender. I experience horrible performance going through the BufferingForwardingAppender instead of directly through the RollingFileAppender and I really don't get the reason. Here is my configuration <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="c:\" /> <appendToFile value="false" /> <rollingStyle value="Composite" /> <datePattern value="'.'MMdd-HH'.log'" /> <maxSizeRollBackups value="168" /> <staticLogFileName value="false" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> </layout> </appender> <appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender"> <bufferSize value="512" /> <appender-ref ref="RollingLogFileAppender" /> </appender> <root> <level value="DEBUG" /> <appender-ref ref="BufferingForwardingAppender" /> </root> And here is the benchmark (very simple code) var stopWatch = new Stopwatch(); stopWatch.Start(); for (int i = 0; i < 100000; i++) { Log.Debug("Hello"); } stopWatch.Stop(); Console.WriteLine("Done in {0} ms", stopWatch.ElapsedMilliseconds); Going directly through RollingFileAppender the output is : Done in 511 ms Whereas going through the BufferingForwardingAppender decorating the RollingFileAppender : Done in 14261 ms That's approx 30 times slower. I thought I would gain some speed by buffering a certain ammount of log before writing them to the file, however for some reason it gets things much worse. Seems to me like the configuration is OK, so this is really weird. Anyone got a clue ? Thanks !
0
11,319,323
07/03/2012 21:16:49
1,489,811
06/28/2012 21:38:48
13
0
Can't get templates to work in Django
I'm following this tutorial (http://lightbird.net/dbe/cal1.html) to build a calendar app, but I can't get the templates to work correctly. I made a directory named `cal` in `project/templates` and copied `base.html` there. Then I extended the template `cal/main.html` with the following: {% extends "cal/base.html" %} <!-- ... --> <a href="{% url cal.views.main year|add:'-3' %}">&lt;&lt; Prev</a> <a href="{% url cal.views.main year|add:'3' %}">Next &gt;&gt;</a> {% for year, months in years %} <div class="clear"></div> <h4>{{ year }}</h4> {% for month in months %} <div class= {% if month.current %}"current"{% endif %} {% if not month.current %}"month"{% endif %} > {% if month.entry %}<b>{% endif %} <a href="{% url cal.views.month year month.n %}">{{ month.name }}</a> {% if month.entry %}</b>{% endif %} </div> {% if month.n == 6 %}<br />{% endif %} {% endfor %} {% endfor %} In my `project/urls.py` I have the following configuration: from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^cal/', include('cal.urls')), url(r'^admin/', include(admin.site.urls)), ) In `cal/urls.py` I have the following configuration: from django.conf.urls import patterns, include, url from cal.views import main urlpatterns = patterns('cal.views', (r'^(\d+)/$', main), (r'', main), ) I'm not sure where I went wrong. All that is showing up right now when I run the app is a blank screen with a "Home" button on the top left corner that takes me to the admin page. If anyone could point me in the right direction, it would be greatly appreciated!
django
null
null
null
null
null
open
Can't get templates to work in Django === I'm following this tutorial (http://lightbird.net/dbe/cal1.html) to build a calendar app, but I can't get the templates to work correctly. I made a directory named `cal` in `project/templates` and copied `base.html` there. Then I extended the template `cal/main.html` with the following: {% extends "cal/base.html" %} <!-- ... --> <a href="{% url cal.views.main year|add:'-3' %}">&lt;&lt; Prev</a> <a href="{% url cal.views.main year|add:'3' %}">Next &gt;&gt;</a> {% for year, months in years %} <div class="clear"></div> <h4>{{ year }}</h4> {% for month in months %} <div class= {% if month.current %}"current"{% endif %} {% if not month.current %}"month"{% endif %} > {% if month.entry %}<b>{% endif %} <a href="{% url cal.views.month year month.n %}">{{ month.name }}</a> {% if month.entry %}</b>{% endif %} </div> {% if month.n == 6 %}<br />{% endif %} {% endfor %} {% endfor %} In my `project/urls.py` I have the following configuration: from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^cal/', include('cal.urls')), url(r'^admin/', include(admin.site.urls)), ) In `cal/urls.py` I have the following configuration: from django.conf.urls import patterns, include, url from cal.views import main urlpatterns = patterns('cal.views', (r'^(\d+)/$', main), (r'', main), ) I'm not sure where I went wrong. All that is showing up right now when I run the app is a blank screen with a "Home" button on the top left corner that takes me to the admin page. If anyone could point me in the right direction, it would be greatly appreciated!
0
11,319,324
07/03/2012 21:16:54
648,835
03/07/2011 20:57:06
126
1
Can I target older linux with newer gcc/clang? C++
Right now I compile my C++ software on a certain old version of linux (SLED 10) using the provided gcc and it can run on most newer versions as they have a newer glibc. Problem is, that old gcc doesn't support C++11 and I'd really like to use the new features. Now I have some ideas, but I'm sure others have the same need. What's actually worked for you? Ideas: 1. Build on a newer system, static link to newer glibc. (Not possible, right?) 2. Build on a newer system, compile and link against an older glibc. 3. Build on an older system using an updated gcc, link against older glibc. 4. Build on a newer system, dynamic link to newer glibc, set RPath and provide our glibc with installer. As a bonus, my software also support plugins and has an SDK. I'd really prefer that my customers could compile against my libraries without a huge hassle. Thanks in advance. Ideas welcome, proven solutions preferred.
c++
linux
glibc
null
null
null
open
Can I target older linux with newer gcc/clang? C++ === Right now I compile my C++ software on a certain old version of linux (SLED 10) using the provided gcc and it can run on most newer versions as they have a newer glibc. Problem is, that old gcc doesn't support C++11 and I'd really like to use the new features. Now I have some ideas, but I'm sure others have the same need. What's actually worked for you? Ideas: 1. Build on a newer system, static link to newer glibc. (Not possible, right?) 2. Build on a newer system, compile and link against an older glibc. 3. Build on an older system using an updated gcc, link against older glibc. 4. Build on a newer system, dynamic link to newer glibc, set RPath and provide our glibc with installer. As a bonus, my software also support plugins and has an SDK. I'd really prefer that my customers could compile against my libraries without a huge hassle. Thanks in advance. Ideas welcome, proven solutions preferred.
0
11,319,327
07/03/2012 21:17:10
1,481,978
06/26/2012 07:32:13
3
0
Is there a generic method of accessing DOM elements without an id through Javascript?
I have a `<p>` tag without an `id` attribute that I'd like to remove. Would I be able to use a generic DOM string to access this element? <html> <body> <div> <p> // yada yada </p> </div> </body> </html> In my instance I'm trying to remove the paragraph element with jQuery by: $(function () { var remove = $(" /*Generic label goes here */ ").remove(); }); I thought it would be `document.body.div.firstChild` Is something like this possible?
javascript
jquery
dom
null
null
null
open
Is there a generic method of accessing DOM elements without an id through Javascript? === I have a `<p>` tag without an `id` attribute that I'd like to remove. Would I be able to use a generic DOM string to access this element? <html> <body> <div> <p> // yada yada </p> </div> </body> </html> In my instance I'm trying to remove the paragraph element with jQuery by: $(function () { var remove = $(" /*Generic label goes here */ ").remove(); }); I thought it would be `document.body.div.firstChild` Is something like this possible?
0
11,372,718
07/07/2012 06:03:53
728,286
04/27/2011 23:34:36
53
3
Save frame from webcam to disk with opencv python bindings
I'm trying to use opencv to save frames from a webcam as jpgs or pngs or whatever. It's proving more difficult than I'd thought, despite having examples like the one here: http://stackoverflow.com/questions/11094481/capturing-a-single-image-from-my-webcam-in-java-or-python I am trying to do this: if __name__ == "__main__": print "Press ESC to exit ..." # create windows cv.NamedWindow('Raw', cv.CV_WINDOW_AUTOSIZE) cv.NamedWindow('Processed', cv.CV_WINDOW_AUTOSIZE) # create capture device device = 0 # assume we want first device capture = cv.CaptureFromCAM(0) cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH, 640) cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT, 480) # check if capture device is OK if not capture: print "Error opening capture device" sys.exit(1) while 1: # do forever # capture the current frame frame = cv.QueryFrame(capture) if frame is None: break # mirror cv.Flip(frame, None, 1) # face detection detect(frame) # display webcam image cv.ShowImage('Raw', frame) # handle events k = cv.WaitKey(10) if k == 0x1b: # ESC print 'ESC pressed. Exiting ...' break if k == 0x63 or k == 0x43: print 'capturing!' s, img = capture.read() if s: cv.SaveImage("r'C:\test.jpg", img) As you can see I've tried to make it capture an image when I press the letter c, using a modification of the code suggested by Froyo in that other question. It doesn't work and I can't find documentation to make it work. Please help! Thanks a lot, Alex
python
opencv
webcam
null
null
null
open
Save frame from webcam to disk with opencv python bindings === I'm trying to use opencv to save frames from a webcam as jpgs or pngs or whatever. It's proving more difficult than I'd thought, despite having examples like the one here: http://stackoverflow.com/questions/11094481/capturing-a-single-image-from-my-webcam-in-java-or-python I am trying to do this: if __name__ == "__main__": print "Press ESC to exit ..." # create windows cv.NamedWindow('Raw', cv.CV_WINDOW_AUTOSIZE) cv.NamedWindow('Processed', cv.CV_WINDOW_AUTOSIZE) # create capture device device = 0 # assume we want first device capture = cv.CaptureFromCAM(0) cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH, 640) cv.SetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT, 480) # check if capture device is OK if not capture: print "Error opening capture device" sys.exit(1) while 1: # do forever # capture the current frame frame = cv.QueryFrame(capture) if frame is None: break # mirror cv.Flip(frame, None, 1) # face detection detect(frame) # display webcam image cv.ShowImage('Raw', frame) # handle events k = cv.WaitKey(10) if k == 0x1b: # ESC print 'ESC pressed. Exiting ...' break if k == 0x63 or k == 0x43: print 'capturing!' s, img = capture.read() if s: cv.SaveImage("r'C:\test.jpg", img) As you can see I've tried to make it capture an image when I press the letter c, using a modification of the code suggested by Froyo in that other question. It doesn't work and I can't find documentation to make it work. Please help! Thanks a lot, Alex
0
11,372,821
07/07/2012 06:28:13
1,187,098
02/03/2012 08:54:37
73
1
jquery dynamically adding a selector to existing function as watch object
being new to jquery, I am wondering if it is possible to dynamically add a `selector` or indeed any object to a functions watch list (don't know the proper term yet) `$(selector).function()` For example I have dynamically added a cancel button to a modal. The id of this button is random. is there a way to add it to the below `$('#closeX', '#mask', '#RANDOM_BUTTON_ID')` to perform the same actions as closeX & mask? $('#closeX', #mask').on('click', function() { $('#modalBox').fadeOut(300 , function() { $("#mask").css("display", "none"); // code to remove dynamic button from parent }); return false; });
jquery
selector
null
null
null
null
open
jquery dynamically adding a selector to existing function as watch object === being new to jquery, I am wondering if it is possible to dynamically add a `selector` or indeed any object to a functions watch list (don't know the proper term yet) `$(selector).function()` For example I have dynamically added a cancel button to a modal. The id of this button is random. is there a way to add it to the below `$('#closeX', '#mask', '#RANDOM_BUTTON_ID')` to perform the same actions as closeX & mask? $('#closeX', #mask').on('click', function() { $('#modalBox').fadeOut(300 , function() { $("#mask").css("display", "none"); // code to remove dynamic button from parent }); return false; });
0
11,372,822
07/07/2012 06:28:31
1,305,705
04/01/2012 01:02:06
6
0
How do I make UISearchBar select from the filtered results?
I hope someone can help me. I have a search bar implemented and it does filter the results the way it's supposed to. The problem is that when I select from the filtered results, it selects from the original array. From what I've read, one approach would be to remove all the items from the filtered array and ADD the selected items. The other approach would be to remove all the items that don't match the search criteria. The problem is that I don't know how to do this - despite hours of searching. I would be grateful for any help or pointers in the right direction. Thanks Jacqueline Here is my code: - (void)viewDidLoad { [super viewDidLoad]; self.tableView.scrollEnabled = YES; categories = [NSArray arrayWithObjects: @"Other", @"Breakfast", @"Chemist", @"Computer", @"Dinner", @"Drinks", @"Entertainment", @"Fuel", @"Groceries", @"Haircut", @"Hotel", @"Internet", @"Laundry", @"Lunch", @"Meals", @"Medical", @"Parking", @"Snacks", @"Stationery", @"Taxis", @"Telephone", @"Transport", @"Travel Taxes", nil]; self.allCatgeories = categories; [self.tableView reloadData]; } and - (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope { NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"SELF contains[cd] %@", searchText]; self.searchResults = [self.allCatgeories filteredArrayUsingPredicate:resultPredicate]; }
xcode
null
null
null
null
null
open
How do I make UISearchBar select from the filtered results? === I hope someone can help me. I have a search bar implemented and it does filter the results the way it's supposed to. The problem is that when I select from the filtered results, it selects from the original array. From what I've read, one approach would be to remove all the items from the filtered array and ADD the selected items. The other approach would be to remove all the items that don't match the search criteria. The problem is that I don't know how to do this - despite hours of searching. I would be grateful for any help or pointers in the right direction. Thanks Jacqueline Here is my code: - (void)viewDidLoad { [super viewDidLoad]; self.tableView.scrollEnabled = YES; categories = [NSArray arrayWithObjects: @"Other", @"Breakfast", @"Chemist", @"Computer", @"Dinner", @"Drinks", @"Entertainment", @"Fuel", @"Groceries", @"Haircut", @"Hotel", @"Internet", @"Laundry", @"Lunch", @"Meals", @"Medical", @"Parking", @"Snacks", @"Stationery", @"Taxis", @"Telephone", @"Transport", @"Travel Taxes", nil]; self.allCatgeories = categories; [self.tableView reloadData]; } and - (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope { NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"SELF contains[cd] %@", searchText]; self.searchResults = [self.allCatgeories filteredArrayUsingPredicate:resultPredicate]; }
0
11,372,825
07/07/2012 06:28:47
1,303,585
03/30/2012 15:17:03
1
0
Create a Marquee in html
I want to Create a Marquee that when text Exit from one Side and show on other side like i have code something like that <marquee behavior="scroll" scrollamount="1.5">Hello World</marquee> Its shows Hello World move from left to right when first letter hide that it enters left side then i want that i doesn't hide it begin again from left side. Like H hide from left then H shows at right side.
html
marquee
null
null
null
null
open
Create a Marquee in html === I want to Create a Marquee that when text Exit from one Side and show on other side like i have code something like that <marquee behavior="scroll" scrollamount="1.5">Hello World</marquee> Its shows Hello World move from left to right when first letter hide that it enters left side then i want that i doesn't hide it begin again from left side. Like H hide from left then H shows at right side.
0
11,372,792
07/07/2012 06:20:55
1,484,622
06/27/2012 05:31:04
15
0
Linq Nested Inner Joins
I want to join the following Tables 1. B_Book[1st Table] a)B_BID (Book ID)(PK) b)B_Name c)B_CategroyID (FK) 2. BI_BookInstance [2nd Table] a)BI_IID(Instance ID) b)BI_BID (FK) c)BI_Price 3. BC_BookCategory [3rd Table] a)BC_CategoryID (PK) b)BC_CategoryName First Join B_Book and BI_BookInstance Then join the result of those both with BookCategory. (1st join)[B_BID equals BI_BID] (2nd nested join)[result of 1st join B_CategoryID equals BC_CategoryID]
linq
linq-to-sql
nested-queries
linq-query-syntax
nested-query
null
open
Linq Nested Inner Joins === I want to join the following Tables 1. B_Book[1st Table] a)B_BID (Book ID)(PK) b)B_Name c)B_CategroyID (FK) 2. BI_BookInstance [2nd Table] a)BI_IID(Instance ID) b)BI_BID (FK) c)BI_Price 3. BC_BookCategory [3rd Table] a)BC_CategoryID (PK) b)BC_CategoryName First Join B_Book and BI_BookInstance Then join the result of those both with BookCategory. (1st join)[B_BID equals BI_BID] (2nd nested join)[result of 1st join B_CategoryID equals BC_CategoryID]
0
11,372,840
07/07/2012 06:30:37
489,366
10/27/2010 20:59:12
1
0
call iframe function from parent window
How to call a javascript function in ifram from parent window. i have a jsp page which contains an iframe. jsp page is served by "a.yenama.net" server and iframe is served "b.yenama.net" server. <iframe width="1200" height="640" name="data" id="dataId" > </iframe> <br/> <input type="button" name="data" value="Save data" onclick="callSaveData();" /> tried below code from parent jsp page and recieved permission denied error in IE window.frames['data'].callData(); also tried document.getElementById('dataId').contentWindow.callData(); //didn't work Function in iframe ----------- window.callData = function(){ alert('Iframe function'); } your help is truly appreciated.
javascript
jquery
null
null
null
null
open
call iframe function from parent window === How to call a javascript function in ifram from parent window. i have a jsp page which contains an iframe. jsp page is served by "a.yenama.net" server and iframe is served "b.yenama.net" server. <iframe width="1200" height="640" name="data" id="dataId" > </iframe> <br/> <input type="button" name="data" value="Save data" onclick="callSaveData();" /> tried below code from parent jsp page and recieved permission denied error in IE window.frames['data'].callData(); also tried document.getElementById('dataId').contentWindow.callData(); //didn't work Function in iframe ----------- window.callData = function(){ alert('Iframe function'); } your help is truly appreciated.
0
11,277,494
06/30/2012 20:38:17
622,829
02/18/2011 08:52:38
60
4
why java.nio.charset.Charsets compile error?
import java.nio.charset.Charsets in my class UriCodec.java,but when i use javac(jdk6) compile this class error. for example: javac UriCodec.java
java
javac
standards-compliance
null
null
06/30/2012 20:59:43
not a real question
why java.nio.charset.Charsets compile error? === import java.nio.charset.Charsets in my class UriCodec.java,but when i use javac(jdk6) compile this class error. for example: javac UriCodec.java
1
11,277,495
06/30/2012 20:38:35
501,011
11/08/2010 18:27:43
305
4
In what order are autotools invoked to create a build system?
I'm trying to use autotools to create a build system for a C program. However, after reading `info automake`, I'm still very confused about the order of which tools are invoked by the developer. Let's think about a very simple hello world application. In the root dir of the application there is simple `src/hello.c` and nothing else. What tools need to be called in what order to create `configure` and a `Makefile`? I figured out by myself (partially reading doc, partially just trying) that `autoscan` comes first and generates a "sketch" of the `configure.ac`. Then `autoheader` appearently creates a header file (why?). Next `autoconf` finally creates the `configure` script, which will ultimately create a `config.h`. However, I am still missing a `Makefile` which I believe is created by `automake`, but this requires a `Makefile.am` which I don't know how to generate. Is this file generated at all or hand-written by the developer?
c
autotools
null
null
null
null
open
In what order are autotools invoked to create a build system? === I'm trying to use autotools to create a build system for a C program. However, after reading `info automake`, I'm still very confused about the order of which tools are invoked by the developer. Let's think about a very simple hello world application. In the root dir of the application there is simple `src/hello.c` and nothing else. What tools need to be called in what order to create `configure` and a `Makefile`? I figured out by myself (partially reading doc, partially just trying) that `autoscan` comes first and generates a "sketch" of the `configure.ac`. Then `autoheader` appearently creates a header file (why?). Next `autoconf` finally creates the `configure` script, which will ultimately create a `config.h`. However, I am still missing a `Makefile` which I believe is created by `automake`, but this requires a `Makefile.am` which I don't know how to generate. Is this file generated at all or hand-written by the developer?
0
11,280,360
07/01/2012 07:46:20
118,027
06/05/2009 14:04:37
6,686
283
Uploadify v3.1 passing POST Data
Iam getting Crazy with JQuery Uploadify V3.1. // setup fileuploader $("#file_upload").uploadify({ 'swf': 'flash/uploadify.swf', 'uploader' : 'upload/do-upload', 'debug' : false, 'buttonText': 'Files auswählen', 'multi': true, 'method': 'POST', 'auto': false, 'width': 250, 'queueSizeLimit' : 10, 'fileSizeLimit' : '100MB', 'cancelImg': 'img/uploadify-cancel.png', 'removeCompleted' : true, 'onUploadSuccess' : function(file, data, response) { $('#message').append(data); }, 'onUploadError' : function() { $('#message').html('<h2>Fehler beim Upload</h2>'); } }); To start Download onClick // handle the event stuff $("#event_start_upload").on({ click: function(){ var key = $('#key').val(); if (key.length < KeyLength) { $('#form-encryption-control').addClass('error'); return; } else { $('#form-encryption-control').removeClass('error'); } // some space for new download links $('#message').empty(); $('#file_upload').uploadify('upload','*') } }); My Problem is: I have to pass addtional params to the serverSide, in Uploadify V2 there was an Method uploadifySettings to pass "scriptData" , but not in V3? Someone knows how this works?
javascript
jquery
null
null
null
null
open
Uploadify v3.1 passing POST Data === Iam getting Crazy with JQuery Uploadify V3.1. // setup fileuploader $("#file_upload").uploadify({ 'swf': 'flash/uploadify.swf', 'uploader' : 'upload/do-upload', 'debug' : false, 'buttonText': 'Files auswählen', 'multi': true, 'method': 'POST', 'auto': false, 'width': 250, 'queueSizeLimit' : 10, 'fileSizeLimit' : '100MB', 'cancelImg': 'img/uploadify-cancel.png', 'removeCompleted' : true, 'onUploadSuccess' : function(file, data, response) { $('#message').append(data); }, 'onUploadError' : function() { $('#message').html('<h2>Fehler beim Upload</h2>'); } }); To start Download onClick // handle the event stuff $("#event_start_upload").on({ click: function(){ var key = $('#key').val(); if (key.length < KeyLength) { $('#form-encryption-control').addClass('error'); return; } else { $('#form-encryption-control').removeClass('error'); } // some space for new download links $('#message').empty(); $('#file_upload').uploadify('upload','*') } }); My Problem is: I have to pass addtional params to the serverSide, in Uploadify V2 there was an Method uploadifySettings to pass "scriptData" , but not in V3? Someone knows how this works?
0
11,271,703
06/30/2012 05:26:50
1,492,589
06/30/2012 05:19:42
1
0
how to make sure html element at center of the window
I mean. i want to do some function at the one element at center of the window. while leaving of the elements from the center have to do another function. so how to make sure the html element at center of the window.
javascript
jquery
html
function
window
null
open
how to make sure html element at center of the window === I mean. i want to do some function at the one element at center of the window. while leaving of the elements from the center have to do another function. so how to make sure the html element at center of the window.
0
11,271,704
06/30/2012 05:27:00
168,177
09/03/2009 21:34:24
3,384
230
jQuery - drag div css background
I'd like to be able to click hold my mouse inside a div and move it's background. Searched a lot on google and didn't found what I wanted. Here's the target (the map displayed is the object to drag) : http://pontografico.net/pvt/gamemap/ Any tips? Cheers!
jquery
css
background
draggable
null
null
open
jQuery - drag div css background === I'd like to be able to click hold my mouse inside a div and move it's background. Searched a lot on google and didn't found what I wanted. Here's the target (the map displayed is the object to drag) : http://pontografico.net/pvt/gamemap/ Any tips? Cheers!
0
11,280,366
07/01/2012 07:48:04
1,480,722
06/25/2012 17:56:14
3
0
iPhone Stucture ViewController
OK! I have lots of questions, and a lot of help is necessary! I am designing an iPhone application with a home page. This page has multiple buttons (6) that go to different things. 2 buttons are a simple view that just have some information and go back to the home screen. The next button opens up an email and I believe that will just be one view, so not a whole lot different than the other two. Here is where it gets complicated. One button will take a picture, and another will select one from the library. Once that is done it will edit it and create an object that i will create. That object will be stored in an array, which will be opened by the last button one the home page and a UITableViewController will control that. My first question is should I use a navigation based view controller or just a view controller that I can create myself? Or should I use something that I don't even know about? Please Help!!! And if you help a sincere thank you!
iphone
xcode
view
controller
structure
null
open
iPhone Stucture ViewController === OK! I have lots of questions, and a lot of help is necessary! I am designing an iPhone application with a home page. This page has multiple buttons (6) that go to different things. 2 buttons are a simple view that just have some information and go back to the home screen. The next button opens up an email and I believe that will just be one view, so not a whole lot different than the other two. Here is where it gets complicated. One button will take a picture, and another will select one from the library. Once that is done it will edit it and create an object that i will create. That object will be stored in an array, which will be opened by the last button one the home page and a UITableViewController will control that. My first question is should I use a navigation based view controller or just a view controller that I can create myself? Or should I use something that I don't even know about? Please Help!!! And if you help a sincere thank you!
0
11,280,373
07/01/2012 07:49:10
632,209
02/24/2011 11:27:04
55
0
Add new entities in OpenCart
I was wondering if I can add new entities (classes/tables) in OpenCart to store information that is not included in the default functionality. To be more precise, I would like to add subscription (3/6/12 months) related information, as described here: http://stackoverflow.com/questions/11244247/opencart-subscription-model-x-months If yes, can I just add admin pages for the new class? Would something like: http://stackoverflow.com/questions/10700761/how-to-create-a-custom-admin-page-in-opencart work? Thanks, Iraklis
php
opencart
customclasses
null
null
null
open
Add new entities in OpenCart === I was wondering if I can add new entities (classes/tables) in OpenCart to store information that is not included in the default functionality. To be more precise, I would like to add subscription (3/6/12 months) related information, as described here: http://stackoverflow.com/questions/11244247/opencart-subscription-model-x-months If yes, can I just add admin pages for the new class? Would something like: http://stackoverflow.com/questions/10700761/how-to-create-a-custom-admin-page-in-opencart work? Thanks, Iraklis
0
11,280,376
07/01/2012 07:51:09
949,795
09/17/2011 02:28:48
50
0
my iCloud try to sync with every version
I'm trying hard to solve this problem. I need help. I'm using iCloud with core data to sync my app data. I did everything and finally It works perfectly between iPad and iPhone. only problem is when the device sync with iCloud. It's trying to sync with every version of data so far. not just one time. if I using iPhone long time and after that, I try to use iPad, my iPad tried to sync so many time that every single time when data was stored at iPhone. It should sync just at once not like this. any helps? Thanks.
iphone
ios5
icloud
null
null
null
open
my iCloud try to sync with every version === I'm trying hard to solve this problem. I need help. I'm using iCloud with core data to sync my app data. I did everything and finally It works perfectly between iPad and iPhone. only problem is when the device sync with iCloud. It's trying to sync with every version of data so far. not just one time. if I using iPhone long time and after that, I try to use iPad, my iPad tried to sync so many time that every single time when data was stored at iPhone. It should sync just at once not like this. any helps? Thanks.
0
11,280,379
07/01/2012 07:51:39
974,680
10/01/2011 17:06:06
27
0
Is it possible to write onFocus/lostFocus handler for a DIV using JS or jQuery?
I have a div and when the user clicks the div a function should be called. And when the user clicks something else (anything other than this div) another function should be called. So basically i need to have onFocus() and lostFocus() function calls associated with this DIV. Is it available in JavaScript or even in jQuery? Thanks.
javascript
jquery
onfocus
lost-focus
null
null
open
Is it possible to write onFocus/lostFocus handler for a DIV using JS or jQuery? === I have a div and when the user clicks the div a function should be called. And when the user clicks something else (anything other than this div) another function should be called. So basically i need to have onFocus() and lostFocus() function calls associated with this DIV. Is it available in JavaScript or even in jQuery? Thanks.
0
11,280,380
07/01/2012 07:51:42
1,475,268
06/22/2012 15:29:31
6
0
Correct approach to make a ListBox Page Navigation using MVVM on Windows Phone
I am building an app for Windows Phone, and in this app I have a list of Movies with Title, Plot and Picture. I have this list bound to a ListBox with a custom DataTemplate for the items showing the data. I also created a second page to show the details of each movie. My problem now is the navigation between these pages. I'm using MVVM to build the applications and most of the approaches I've found searching on internet is to use the OnSelectionChanged event in the code-behind, but it goes agains what I want, that is to use MVVM. Other approach I've seen, which is the one I'm trying, is to bind the SelectedItem to a property in the ViewModel, but I can't make it change the property, it seems that I cannot select an item in the listbox. Also, I don't have the visual feedback when I press one of the items in my listbox, like the feedback we have in the settings menu of the phone for example. The code I'm using in the listbox is: <ListBox Margin="0,0,-12,0" ItemsSource="{Binding Movies}" SelectedItem="{Binding SelectedMovieItem}" SelectionMode="Single" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,0,0,17"> <!--Replace rectangle with image--> <Rectangle Height="50" Width="50" Fill="#FFE5001b" Margin="12,0,9,0"/> <StackPanel Width="311"> <TextBlock Text="{Binding Name}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="#000" /> <!--<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>--> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Another approach I've seen is to use the INavigationService to achieve this, I found this article: [http://windowsphonegeek.com/articles/MVVM-in-real-life-Windows-Phone-applications-Part1](http://windowsphonegeek.com/articles/MVVM-in-real-life-Windows-Phone-applications-Part1) I read the parts one and two, but I couldn't understand this one works. So, what I want to know is whether the approach I'm using is the correct to make a page navigation, or if there is a better way using MVVM to do this with visual feedback on the listbox. Thanks in advance!
c#
windows
mvvm
navigation
phone
null
open
Correct approach to make a ListBox Page Navigation using MVVM on Windows Phone === I am building an app for Windows Phone, and in this app I have a list of Movies with Title, Plot and Picture. I have this list bound to a ListBox with a custom DataTemplate for the items showing the data. I also created a second page to show the details of each movie. My problem now is the navigation between these pages. I'm using MVVM to build the applications and most of the approaches I've found searching on internet is to use the OnSelectionChanged event in the code-behind, but it goes agains what I want, that is to use MVVM. Other approach I've seen, which is the one I'm trying, is to bind the SelectedItem to a property in the ViewModel, but I can't make it change the property, it seems that I cannot select an item in the listbox. Also, I don't have the visual feedback when I press one of the items in my listbox, like the feedback we have in the settings menu of the phone for example. The code I'm using in the listbox is: <ListBox Margin="0,0,-12,0" ItemsSource="{Binding Movies}" SelectedItem="{Binding SelectedMovieItem}" SelectionMode="Single" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,0,0,17"> <!--Replace rectangle with image--> <Rectangle Height="50" Width="50" Fill="#FFE5001b" Margin="12,0,9,0"/> <StackPanel Width="311"> <TextBlock Text="{Binding Name}" TextWrapping="NoWrap" Style="{StaticResource PhoneTextExtraLargeStyle}" Foreground="#000" /> <!--<TextBlock Text="{Binding LineTwo}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>--> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Another approach I've seen is to use the INavigationService to achieve this, I found this article: [http://windowsphonegeek.com/articles/MVVM-in-real-life-Windows-Phone-applications-Part1](http://windowsphonegeek.com/articles/MVVM-in-real-life-Windows-Phone-applications-Part1) I read the parts one and two, but I couldn't understand this one works. So, what I want to know is whether the approach I'm using is the correct to make a page navigation, or if there is a better way using MVVM to do this with visual feedback on the listbox. Thanks in advance!
0
11,410,302
07/10/2012 09:25:32
1,514,304
07/10/2012 09:17:07
1
0
Uncaught ReferenceError: Worker is not defined
I am working on Web App using Sencha Touch 1.1 and PhoneGap 1.8. I have been able to make this application run perfectly fine on IOS 5.0 (iPad). But, When I tried to port this application to Android, I am getting an error while instantiating the Worker() object. Here is the line where I am getting the error. var worker = new Worker('app/util/worker.js'); Error message I am getting is "07-10 11:29:23.739: E/Web Console(608): Uncaught ReferenceError: Worker is not defined at file:///android_asset/www/app/util/init.js:188" I am using Android 4.0.3 SDK. I have already looked into various forums and found that, Browser on android does not support Web Workers. Could anyone help me clarify the same and also provide an alternative if it does not work? Thanks Naveen
android
phonegap
sencha-touch
null
null
null
open
Uncaught ReferenceError: Worker is not defined === I am working on Web App using Sencha Touch 1.1 and PhoneGap 1.8. I have been able to make this application run perfectly fine on IOS 5.0 (iPad). But, When I tried to port this application to Android, I am getting an error while instantiating the Worker() object. Here is the line where I am getting the error. var worker = new Worker('app/util/worker.js'); Error message I am getting is "07-10 11:29:23.739: E/Web Console(608): Uncaught ReferenceError: Worker is not defined at file:///android_asset/www/app/util/init.js:188" I am using Android 4.0.3 SDK. I have already looked into various forums and found that, Browser on android does not support Web Workers. Could anyone help me clarify the same and also provide an alternative if it does not work? Thanks Naveen
0
11,410,303
07/10/2012 09:25:36
1,514,291
07/10/2012 09:12:31
1
0
My paragraph - jqPagination
I read this topic http://stackoverflow.com/questions/11362445/how-to-use-jqpagination and I want to use jqPagination. I creat a html file: <html> <head> <link rel="stylesheet" href="https://raw.github.com/beneverard/jqPagination/master/css/jqpagination.css" /> <script src="https://raw.github.com/beneverard/jqPagination/master/js/jquery.jqpagination.js"> </script> <script>$(document).ready(function() { // hide all but the first of our paragraphs $('.some-container p:not(:first)').hide(); $('.pagination').jqPagination({ max_page : $('.some-container p').length, paged : function(page) { // a new 'page' has been requested // hide all paragraphs $('.some-container p').hide(); // but show the one we want $($('.some-container p')[page - 1]).show(); } }); });</script> </head> <body> <div class="some-container"> <p>My first paragraph</p> <p>My second paragraph</p> <p>My third paragraph</p> </div> <div class="pagination"> <a href="#" class="first" data-action="first">&laquo;</a> <a href="#" class="previous" data-action="previous">&lsaquo;</a> <input type="text" readonly="readonly" /> <a href="#" class="next" data-action="next">&rsaquo;</a> <a href="#" class="last" data-action="last">&raquo;</a> </div> </body> </html> but it doesn't work. I try to download jqPagination and open js/scripts.js and replace $(document).ready(function() { // hide all but the first of our paragraphs $('.some-container p:not(:first)').hide(); $('.pagination').jqPagination({ max_page : $('.some-container p').length, paged : function(page) { // a new 'page' has been requested // hide all paragraphs $('.some-container p').hide(); // but show the one we want $($('.some-container p')[page - 1]).show(); } }); }); it doesn't work too. How to make like http://jsfiddle.net/beneverard/2HLZF/? Thanks.
jqpagination
null
null
null
null
null
open
My paragraph - jqPagination === I read this topic http://stackoverflow.com/questions/11362445/how-to-use-jqpagination and I want to use jqPagination. I creat a html file: <html> <head> <link rel="stylesheet" href="https://raw.github.com/beneverard/jqPagination/master/css/jqpagination.css" /> <script src="https://raw.github.com/beneverard/jqPagination/master/js/jquery.jqpagination.js"> </script> <script>$(document).ready(function() { // hide all but the first of our paragraphs $('.some-container p:not(:first)').hide(); $('.pagination').jqPagination({ max_page : $('.some-container p').length, paged : function(page) { // a new 'page' has been requested // hide all paragraphs $('.some-container p').hide(); // but show the one we want $($('.some-container p')[page - 1]).show(); } }); });</script> </head> <body> <div class="some-container"> <p>My first paragraph</p> <p>My second paragraph</p> <p>My third paragraph</p> </div> <div class="pagination"> <a href="#" class="first" data-action="first">&laquo;</a> <a href="#" class="previous" data-action="previous">&lsaquo;</a> <input type="text" readonly="readonly" /> <a href="#" class="next" data-action="next">&rsaquo;</a> <a href="#" class="last" data-action="last">&raquo;</a> </div> </body> </html> but it doesn't work. I try to download jqPagination and open js/scripts.js and replace $(document).ready(function() { // hide all but the first of our paragraphs $('.some-container p:not(:first)').hide(); $('.pagination').jqPagination({ max_page : $('.some-container p').length, paged : function(page) { // a new 'page' has been requested // hide all paragraphs $('.some-container p').hide(); // but show the one we want $($('.some-container p')[page - 1]).show(); } }); }); it doesn't work too. How to make like http://jsfiddle.net/beneverard/2HLZF/? Thanks.
0
11,410,304
07/10/2012 09:25:40
1,244,450
03/02/2012 06:25:55
3
0
PDFBox blurry image when inserted on pdf
import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage; public class pdfBoxTest { public static void WritteBufferedImageToPDF(BufferedImage buff) { PDDocument doc = null; PDPage page = null; PDXObjectImage ximage = null; try { doc = new PDDocument(); page = new PDPage(); doc.addPage(page); ximage = new PDJpeg(doc, buff, 1.0f); PDPageContentStream content = new PDPageContentStream(doc, page); content.drawImage(ximage, 0, 0); content.close(); doc.save("C:/Users/crusader/Desktop/Hello World.pdf"); doc.close(); } catch (IOException ie){ ie.printStackTrace(); //handle exception } //save and close catch (COSVisitorException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String []args) { BufferedImage buff= null; try{ buff = ImageIO.read(new File("C:/Users/crusader/Desktop","tests.jpg")); } catch(IOException ex) { ex.printStackTrace(); } System.out.println(buff.getWidth()); System.out.println(buff.getHeight()); pdfBoxTest.WritteBufferedImageToPDF(buff); } } I am trying to insert images inside a PDF, but the quality makes the images unreadable, how can improve the quality of final PDF document. I have tried other free non GPL license libraries and I think pdfbox is the best, so I would like to be able to use pdfbox.
java
image
quality
pdfbox
null
null
open
PDFBox blurry image when inserted on pdf === import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.edit.PDPageContentStream; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDType1Font; import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage; public class pdfBoxTest { public static void WritteBufferedImageToPDF(BufferedImage buff) { PDDocument doc = null; PDPage page = null; PDXObjectImage ximage = null; try { doc = new PDDocument(); page = new PDPage(); doc.addPage(page); ximage = new PDJpeg(doc, buff, 1.0f); PDPageContentStream content = new PDPageContentStream(doc, page); content.drawImage(ximage, 0, 0); content.close(); doc.save("C:/Users/crusader/Desktop/Hello World.pdf"); doc.close(); } catch (IOException ie){ ie.printStackTrace(); //handle exception } //save and close catch (COSVisitorException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String []args) { BufferedImage buff= null; try{ buff = ImageIO.read(new File("C:/Users/crusader/Desktop","tests.jpg")); } catch(IOException ex) { ex.printStackTrace(); } System.out.println(buff.getWidth()); System.out.println(buff.getHeight()); pdfBoxTest.WritteBufferedImageToPDF(buff); } } I am trying to insert images inside a PDF, but the quality makes the images unreadable, how can improve the quality of final PDF document. I have tried other free non GPL license libraries and I think pdfbox is the best, so I would like to be able to use pdfbox.
0
11,410,204
07/10/2012 09:18:00
1,497,720
07/03/2012 04:41:29
1
0
How to terminate a while if it does not finish within certain time limit?
Say if we have a while loop in BPEL <while>...<while> Is it possible to terminate it if it does not complete within 10s?
bpel
null
null
null
null
null
open
How to terminate a while if it does not finish within certain time limit? === Say if we have a while loop in BPEL <while>...<while> Is it possible to terminate it if it does not complete within 10s?
0
11,410,309
07/10/2012 09:25:58
782,210
06/03/2011 05:21:17
21
1
Basic things required to develop a full fledged CMS?
We have a small business unit and we are planning to migrate our basic website to CMS based. Can anybody tell me what are all the tools we require to develop this. Which will be the best considering the time and budget.
untagged
null
null
null
null
07/20/2012 23:07:44
not constructive
Basic things required to develop a full fledged CMS? === We have a small business unit and we are planning to migrate our basic website to CMS based. Can anybody tell me what are all the tools we require to develop this. Which will be the best considering the time and budget.
4
11,410,310
07/10/2012 09:26:00
1,496,012
07/02/2012 12:04:51
5
0
Filter age from database using PHP
I have a database which has a range of people with an age group. In the database the age data is showing things like 6m for 6 months, 5y for 5 years and so on. I need to be able to filter my data so I can only see the age group below 5. This is what my PHP looks like at the minute. $query = "SELECT DISTINCT code,minimumAge,description FROM recalls WHERE startBasis='age' ORDER BY code"; while ($row = mysql_fetch_array($result)) { if($row['minimumAge'] <= 5){ echo "<option value='" . $row['code'] . "'> " . $row['code'] . " " . $row['minimumAge'] . " " . $row['description'] . "</option>"; } At the minute if you have someone with the age of 6m it won't show up because the number is higher than 5, how do I get it to include the information for anyone under 5y but older than 5m?
php
sql
database
null
null
null
open
Filter age from database using PHP === I have a database which has a range of people with an age group. In the database the age data is showing things like 6m for 6 months, 5y for 5 years and so on. I need to be able to filter my data so I can only see the age group below 5. This is what my PHP looks like at the minute. $query = "SELECT DISTINCT code,minimumAge,description FROM recalls WHERE startBasis='age' ORDER BY code"; while ($row = mysql_fetch_array($result)) { if($row['minimumAge'] <= 5){ echo "<option value='" . $row['code'] . "'> " . $row['code'] . " " . $row['minimumAge'] . " " . $row['description'] . "</option>"; } At the minute if you have someone with the age of 6m it won't show up because the number is higher than 5, how do I get it to include the information for anyone under 5y but older than 5m?
0
11,410,312
07/10/2012 09:26:20
1,511,015
07/09/2012 04:49:29
1
0
(My)SQL full join with three tables
I have tree tables ID A ----------- 1 10 ID B ----------- 1 20 2 30 ID C ----------- 2 40 3 50 Can anybody please tell how to make a view or query prints like this? ID A B C R (A + B - C) ----------------------------------- 1 10 20 0 30 2 0 30 40 -10 3 0 0 50 -50 Thanks in advance.
sql
join
null
null
null
null
open
(My)SQL full join with three tables === I have tree tables ID A ----------- 1 10 ID B ----------- 1 20 2 30 ID C ----------- 2 40 3 50 Can anybody please tell how to make a view or query prints like this? ID A B C R (A + B - C) ----------------------------------- 1 10 20 0 30 2 0 30 40 -10 3 0 0 50 -50 Thanks in advance.
0
11,401,151
07/09/2012 18:46:05
1,459,175
06/15/2012 15:56:09
8
1
zero padding fft
I have an image of size 786*786 and I would like to zero pad it to make it 1024*1024 so I that I can use my radix 2 algorithm. In the input side I would basically add zeros at the end so that the length would be 1024*1024 and my fft would produce a 1024*1024 output, my question is how do I retrieve the correct 786*786 output? Thank you for answering.
fft
null
null
null
null
null
open
zero padding fft === I have an image of size 786*786 and I would like to zero pad it to make it 1024*1024 so I that I can use my radix 2 algorithm. In the input side I would basically add zeros at the end so that the length would be 1024*1024 and my fft would produce a 1024*1024 output, my question is how do I retrieve the correct 786*786 output? Thank you for answering.
0
11,401,156
07/09/2012 18:46:19
1,193,718
02/07/2012 02:55:32
26
2
Convert JSON Object to ArrayBuffer - Javascript
Is there a good way to convert a JSON Object to an ArrayBuffer in Javascript? I'm relatively inexperienced with them, however, I am trying to test out the fastest method for pushing data to a HTML 5 Web Worker (JSON Serialization/Deserialization vs Transferable Objects w/ ArrayBuffers in Chrome - http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast). Any help would be greatly appreciated. Thanks, -Kyle
javascript
json
web-worker
null
null
null
open
Convert JSON Object to ArrayBuffer - Javascript === Is there a good way to convert a JSON Object to an ArrayBuffer in Javascript? I'm relatively inexperienced with them, however, I am trying to test out the fastest method for pushing data to a HTML 5 Web Worker (JSON Serialization/Deserialization vs Transferable Objects w/ ArrayBuffers in Chrome - http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast). Any help would be greatly appreciated. Thanks, -Kyle
0
11,401,159
07/09/2012 18:46:32
184,046
10/04/2009 20:35:01
12,463
52
Passing a template when invoking the JSON serializer?
I have the following: public class BaseEntity<T> where T: class { public OperationStatus OperationStatus { set; get; } public List<T> List { set; get; } protected internal BaseEntity() { if (OperationStatus == null) { OperationStatus = new OperationStatus(); OperationStatus.IsSuccess = true; } this.List = new List<T>(); } internal BaseEntity(IEnumerable<T> list) { if (OperationStatus == null) { OperationStatus = new OperationStatus(); OperationStatus.IsSuccess = true; } this.List = new List<T>(); foreach (T k in list) { this.List.Add(k); } } } public class KeyValuePair { public string key; public string value; } public class KeyValuePairList : BaseEntity<KeyValuePair> { public KeyValuePairList() { } public KeyValuePairList(IEnumerable<KeyValuePair> list) : base(list) { } } // Multiple other classes like KeyValuePair but all have the // same behavior so they have been derived from BaseEntity Now in my code, I am trying to map a JSON string to an instance of `KeyValuePair` list and I'm currently doing it as follows: result = @"{ \"d\": { \"OperationStatus\": { \"IsSuccess\": true, \"ErrorMessage\": null, \"ErrorCode\": null, \"InnerException\": null }, \"List\": [{ \"key\": \"Key1\", "\value\": \"Value1\" }, { \"key\": \"Key2\", \"value\": \"Value2\" }] } }" **Attempt #1** JavaScriptSerializer serializer = new JavaScriptSerializer(); KeyValuePairList output = serializer.Deserialize<KeyValuePairList>(result); However, this does not work because the constructor of `KeyValuePairList` is not being called with any arguments. If I remove that constructor, JSON serialization fails with an error `No parameterless constructor found`. How can I tell `KeyValuePairList` to use `KeyValuePair` as the template in its invocation? Or maybe how can I adapt JSON serializer for this purpose? **Attempt #2** I tried `JSON.net` too, as follows: var oo = JsonConvert.DeserializeObject<KeyValuePairList>(result); Any suggestions on how to make this work?
c#
json
json.net
null
null
null
open
Passing a template when invoking the JSON serializer? === I have the following: public class BaseEntity<T> where T: class { public OperationStatus OperationStatus { set; get; } public List<T> List { set; get; } protected internal BaseEntity() { if (OperationStatus == null) { OperationStatus = new OperationStatus(); OperationStatus.IsSuccess = true; } this.List = new List<T>(); } internal BaseEntity(IEnumerable<T> list) { if (OperationStatus == null) { OperationStatus = new OperationStatus(); OperationStatus.IsSuccess = true; } this.List = new List<T>(); foreach (T k in list) { this.List.Add(k); } } } public class KeyValuePair { public string key; public string value; } public class KeyValuePairList : BaseEntity<KeyValuePair> { public KeyValuePairList() { } public KeyValuePairList(IEnumerable<KeyValuePair> list) : base(list) { } } // Multiple other classes like KeyValuePair but all have the // same behavior so they have been derived from BaseEntity Now in my code, I am trying to map a JSON string to an instance of `KeyValuePair` list and I'm currently doing it as follows: result = @"{ \"d\": { \"OperationStatus\": { \"IsSuccess\": true, \"ErrorMessage\": null, \"ErrorCode\": null, \"InnerException\": null }, \"List\": [{ \"key\": \"Key1\", "\value\": \"Value1\" }, { \"key\": \"Key2\", \"value\": \"Value2\" }] } }" **Attempt #1** JavaScriptSerializer serializer = new JavaScriptSerializer(); KeyValuePairList output = serializer.Deserialize<KeyValuePairList>(result); However, this does not work because the constructor of `KeyValuePairList` is not being called with any arguments. If I remove that constructor, JSON serialization fails with an error `No parameterless constructor found`. How can I tell `KeyValuePairList` to use `KeyValuePair` as the template in its invocation? Or maybe how can I adapt JSON serializer for this purpose? **Attempt #2** I tried `JSON.net` too, as follows: var oo = JsonConvert.DeserializeObject<KeyValuePairList>(result); Any suggestions on how to make this work?
0
11,401,164
07/09/2012 18:46:56
863,678
07/26/2011 14:43:13
375
21
Set dispatchTouchEvent for List View without creating custom List View class. (for disabling scroll)
I'm basically trying to disable the scroll on List View. Which can be done by @Override public boolean dispatchTouchEvent(MotionEvent ev){ if(ev.getAction()==MotionEvent.ACTION_MOVE){ ev.setAction(MotionEvent.ACTION_CANCEL); } super.dispatchTouchEvent(ev); return true; } **But I do not want to create a custom List View (widget) class for this.** Is there any way I could do it like `myListView.dispatchTouchEvent(ev)`??? Thanks in advance.
android
list
listview
android-layout
android-listview
null
open
Set dispatchTouchEvent for List View without creating custom List View class. (for disabling scroll) === I'm basically trying to disable the scroll on List View. Which can be done by @Override public boolean dispatchTouchEvent(MotionEvent ev){ if(ev.getAction()==MotionEvent.ACTION_MOVE){ ev.setAction(MotionEvent.ACTION_CANCEL); } super.dispatchTouchEvent(ev); return true; } **But I do not want to create a custom List View (widget) class for this.** Is there any way I could do it like `myListView.dispatchTouchEvent(ev)`??? Thanks in advance.
0
11,401,103
07/09/2012 18:42:37
379,008
06/29/2010 12:49:08
2,914
59
MVC Client Validation from Service Layer
I'm following this article http://www.asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-a-service-layer-cs to include a Service Layer with Business Logic in my MVC Web Application. I'm able to pass message from the Service Layer to the View Model in a Html.ValidationSummary using ModelState Class. I perform basic validation logic on the View Model (using DataAnnotation attributes) and I have ClientValidation enabled by default which displaying the error message on **every single field of my form**. The Business logic error message which come from the Service Layer are being displayed on Html.ValidationSummary only after Posting the form to the Server. After Validation from the Service Layer I would like highlight one or more fields and have the message from the Service Layer showing on these fields instead that the Html.ValidationSummary. Any idea how to do it? Thanks
jquery
asp.net-mvc
asp.net-mvc-3
mvc
razor
null
open
MVC Client Validation from Service Layer === I'm following this article http://www.asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-a-service-layer-cs to include a Service Layer with Business Logic in my MVC Web Application. I'm able to pass message from the Service Layer to the View Model in a Html.ValidationSummary using ModelState Class. I perform basic validation logic on the View Model (using DataAnnotation attributes) and I have ClientValidation enabled by default which displaying the error message on **every single field of my form**. The Business logic error message which come from the Service Layer are being displayed on Html.ValidationSummary only after Posting the form to the Server. After Validation from the Service Layer I would like highlight one or more fields and have the message from the Service Layer showing on these fields instead that the Html.ValidationSummary. Any idea how to do it? Thanks
0
11,401,104
07/09/2012 18:42:41
1,500,076
07/03/2012 22:05:08
1
0
how to serialize svg so it can fit into a cookie
so what i want is to serialize my svg image so that it can be stored into a cookie, send that cookie over, and when the user comes back with the cookie on them, i can unserialize the svg and use that svg. so basically my problems comes down to serializing svg into something that can be stored in a cookie. how do i do this. i know there are serialize() and unserialize() in php, but serialize takes in a mixed value and im not sure that svg would fall into that category. i researched mixed values a bit and it looks like it can take in stuff like struct, arrays, int and stuff like that, but not svg. if im wrong about this plz tell me because using serialize and unserialize would make things much easier.
serialization
null
null
null
null
null
open
how to serialize svg so it can fit into a cookie === so what i want is to serialize my svg image so that it can be stored into a cookie, send that cookie over, and when the user comes back with the cookie on them, i can unserialize the svg and use that svg. so basically my problems comes down to serializing svg into something that can be stored in a cookie. how do i do this. i know there are serialize() and unserialize() in php, but serialize takes in a mixed value and im not sure that svg would fall into that category. i researched mixed values a bit and it looks like it can take in stuff like struct, arrays, int and stuff like that, but not svg. if im wrong about this plz tell me because using serialize and unserialize would make things much easier.
0
11,401,146
07/09/2012 18:45:41
1,512,829
07/09/2012 18:33:46
1
0
numpy array iteration to track maximum number so far
Is there a simple way of iterating through a two dimensional array to store maximum value obtained so far while traversing along a particular dimension. For example, i have an array: [[2 , 1, 5], [-1, -1, 4], [4, 3, 2], [2 , 3, 4]] and I would like the following output: [[2 , 2, 5], [-1, -1, 4], [4, 4, 4], [2 , 3, 4]] Thanks!
numpy
null
null
null
null
null
open
numpy array iteration to track maximum number so far === Is there a simple way of iterating through a two dimensional array to store maximum value obtained so far while traversing along a particular dimension. For example, i have an array: [[2 , 1, 5], [-1, -1, 4], [4, 3, 2], [2 , 3, 4]] and I would like the following output: [[2 , 2, 5], [-1, -1, 4], [4, 4, 4], [2 , 3, 4]] Thanks!
0
11,298,224
07/02/2012 17:18:47
1,493,550
06/30/2012 21:02:22
13
0
What is this ? in the beginning of the console output after reading a text file encoded with Unicode?
I've been tinkering with reading files(text files encoded in Unicode) and for some reason I get a question mark in the beginning of the output. Here's the code. #include <iostream> #include <Windows.h> #include <fcntl.h> #include <io.h> int main(void) { HANDLE hFile = CreateFile(L"dog.txt", GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); _setmode(_fileno(stdout), _O_U16TEXT); //Making sure the console will //display the wide characters //correctly. See below for link LARGE_INTEGER li; GetFileSizeEx(hFile,&li); WCHAR* pBuf = new WCHAR[li.QuadPart / sizeof(WCHAR)]; //Allocating space for //the file. DWORD dwRead = 0; BOOL bFinishRead = FALSE; do { bFinishRead = ReadFile(hFile,pBuf,li.QuadPart,&dwRead,NULL); } while(!bFinishRead); pBuf[li.QuadPart / sizeof(WCHAR)] = 0; //Making sure the end of the output //is null-terminated. std::wcout << pBuf << std::endl; std::cin.get(); return 1; } dog.txt One Two Three Console output ?One Two Three I already eliminated a lot of gibberish by making sure the end of the output is null-terminated but the ? in the beginning puzzles me. As for the _setmode(_fileno(stdout), _O_U16TEXT); see http://stackoverflow.com/questions/2492077/output-unicode-strings-in-windows-console-app **Note:** My code is Windows-oriented and I intend to keep it that way if possible. Thanks.
c++
c
winapi
unicode
null
null
open
What is this ? in the beginning of the console output after reading a text file encoded with Unicode? === I've been tinkering with reading files(text files encoded in Unicode) and for some reason I get a question mark in the beginning of the output. Here's the code. #include <iostream> #include <Windows.h> #include <fcntl.h> #include <io.h> int main(void) { HANDLE hFile = CreateFile(L"dog.txt", GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); _setmode(_fileno(stdout), _O_U16TEXT); //Making sure the console will //display the wide characters //correctly. See below for link LARGE_INTEGER li; GetFileSizeEx(hFile,&li); WCHAR* pBuf = new WCHAR[li.QuadPart / sizeof(WCHAR)]; //Allocating space for //the file. DWORD dwRead = 0; BOOL bFinishRead = FALSE; do { bFinishRead = ReadFile(hFile,pBuf,li.QuadPart,&dwRead,NULL); } while(!bFinishRead); pBuf[li.QuadPart / sizeof(WCHAR)] = 0; //Making sure the end of the output //is null-terminated. std::wcout << pBuf << std::endl; std::cin.get(); return 1; } dog.txt One Two Three Console output ?One Two Three I already eliminated a lot of gibberish by making sure the end of the output is null-terminated but the ? in the beginning puzzles me. As for the _setmode(_fileno(stdout), _O_U16TEXT); see http://stackoverflow.com/questions/2492077/output-unicode-strings-in-windows-console-app **Note:** My code is Windows-oriented and I intend to keep it that way if possible. Thanks.
0
11,298,225
07/02/2012 17:18:49
1,070,108
11/28/2011 20:46:14
121
4
Pass Managed Function Pointer As Unmanaged Callback
I am attempting to pass a managed function pointer `void (*)(void *)` to my unmanaged library. My unmanaged library calls this callback with a pointer to a frame of data protected by a CriticalSection. While the managed callback is running, nothing else can modify the frame of data due to the Critical Section. However, I am getting Access Violations and Heap Corruptions just by entering the callback. So far I have done the follow: //Start Streaming streaming_thread_ = gcnew Thread(gcnew ThreadStart(&Form1::WorkerThreadFunc)); streaming_thread_->Start(); Where: extern "C" { #include "libavcodec\avcodec.h" #include "libavutil\avutil.h" } namespace TEST_OCU { delegate void myCallbackDelegate(void * usr_data); //Declare a delegate for my unmanaged code public ref class Form1 : public System::Windows::Forms::Form { public: static void WorkerThreadFunc() { myCallbackDelegate^ del = gcnew myCallbackDelegate(&Form1::frame_callback); MessageBox::Show("Starting to Streaming", "Streaming Info"); if(rtsp_connection_ != NULL) rtsp_connection_->StartStreaming(); //rtsp_connection_->StartStreaming((void (*)(void *)) System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(del).ToPointer() ); MessageBox::Show("Done Streaming", "Streaming Info"); } static void __cdecl frame_callback(void * frame) { AVFrame * casted_frame = (AVFrame *)frame; } private: static RTSPConnection * rtsp_connection_ = NULL; } } - I've omitted a lot of pointless code... - `StartStreaming` defaults to a NULL pointer, in this case I get no corruption - `StartStreaming` with the delegated function pointer causes heap corruption Could anyone give me a breadcrumb? Thank you so much in advance.
c++
.net
winapi
c++-cli
unmanaged
null
open
Pass Managed Function Pointer As Unmanaged Callback === I am attempting to pass a managed function pointer `void (*)(void *)` to my unmanaged library. My unmanaged library calls this callback with a pointer to a frame of data protected by a CriticalSection. While the managed callback is running, nothing else can modify the frame of data due to the Critical Section. However, I am getting Access Violations and Heap Corruptions just by entering the callback. So far I have done the follow: //Start Streaming streaming_thread_ = gcnew Thread(gcnew ThreadStart(&Form1::WorkerThreadFunc)); streaming_thread_->Start(); Where: extern "C" { #include "libavcodec\avcodec.h" #include "libavutil\avutil.h" } namespace TEST_OCU { delegate void myCallbackDelegate(void * usr_data); //Declare a delegate for my unmanaged code public ref class Form1 : public System::Windows::Forms::Form { public: static void WorkerThreadFunc() { myCallbackDelegate^ del = gcnew myCallbackDelegate(&Form1::frame_callback); MessageBox::Show("Starting to Streaming", "Streaming Info"); if(rtsp_connection_ != NULL) rtsp_connection_->StartStreaming(); //rtsp_connection_->StartStreaming((void (*)(void *)) System::Runtime::InteropServices::Marshal::GetFunctionPointerForDelegate(del).ToPointer() ); MessageBox::Show("Done Streaming", "Streaming Info"); } static void __cdecl frame_callback(void * frame) { AVFrame * casted_frame = (AVFrame *)frame; } private: static RTSPConnection * rtsp_connection_ = NULL; } } - I've omitted a lot of pointless code... - `StartStreaming` defaults to a NULL pointer, in this case I get no corruption - `StartStreaming` with the delegated function pointer causes heap corruption Could anyone give me a breadcrumb? Thank you so much in advance.
0
11,298,227
07/02/2012 17:18:53
1,496,653
07/02/2012 16:43:07
1
0
WCF Input/Output DataContract definition guidelines
I need some guidance on what is the best way to define DataContracts for following scenario : 1. I have 2 web methods one to upload the raw data 2. This data is used on the server for certain calculations. i.e. An item has a set of calculations, 3. So my entity design is such that Item entity has collection of Calculation entities. The collection is not marked as a DataMember. 4. The GetItemDetails method returns each item with it's collection of calculations. 5. I have ended up defining 2 differet DataContracts for Upload and GetItemDetails operations because Item is my main entity which is used in all my business logic operations but its collection of calculations is data that gets generated at server side and must be returned on demand (GetItemDetails ). Since it's processing data it seems inappropriate to expose it at the time of Upload as no input is expected in the calculation collection. 6. In my GetItemDetails method, I use 'Item' entity and load collection of items with resp. calculation collections and then translate it into my output datacontract which has item and collection both exposed. This approach has the disadvantage of having to maintain 2 data contracts for the same Entity representation. I tried to search for option to dynamically adding DataMember attribute on the Calculation collection for GetItemDetails method with no success. I hope the scenario is clear. My question is what is the best way to define data contracts in such scenarios so that client doesn't have to deal with 2 different proxy classes for representing the same entiy for Upload and Get. Will it be a correct solution if same entity is used for both so that my upload contract exposes (and then ignores any input in) Calculation collection even though user is not expected to provide it to my Upload operation ? I will appreciate any help on this.
wcf
datacontracts
null
null
null
null
open
WCF Input/Output DataContract definition guidelines === I need some guidance on what is the best way to define DataContracts for following scenario : 1. I have 2 web methods one to upload the raw data 2. This data is used on the server for certain calculations. i.e. An item has a set of calculations, 3. So my entity design is such that Item entity has collection of Calculation entities. The collection is not marked as a DataMember. 4. The GetItemDetails method returns each item with it's collection of calculations. 5. I have ended up defining 2 differet DataContracts for Upload and GetItemDetails operations because Item is my main entity which is used in all my business logic operations but its collection of calculations is data that gets generated at server side and must be returned on demand (GetItemDetails ). Since it's processing data it seems inappropriate to expose it at the time of Upload as no input is expected in the calculation collection. 6. In my GetItemDetails method, I use 'Item' entity and load collection of items with resp. calculation collections and then translate it into my output datacontract which has item and collection both exposed. This approach has the disadvantage of having to maintain 2 data contracts for the same Entity representation. I tried to search for option to dynamically adding DataMember attribute on the Calculation collection for GetItemDetails method with no success. I hope the scenario is clear. My question is what is the best way to define data contracts in such scenarios so that client doesn't have to deal with 2 different proxy classes for representing the same entiy for Upload and Get. Will it be a correct solution if same entity is used for both so that my upload contract exposes (and then ignores any input in) Calculation collection even though user is not expected to provide it to my Upload operation ? I will appreciate any help on this.
0
11,298,228
07/02/2012 17:18:56
1,457,507
06/15/2012 00:01:49
15
3
WCF Binding advice for dispatched units
I plan to build a WCF based application that will allow for users in the field to be connected to a dispatch center and be able to get updates on their calls and request information from the system while they are performing their calls. I am looking for advice on how to connect the clients to the server. I was thinking that I would use NetTcpBinding. But do I use a callback structure or do I just make a netTcpBiding connection in both directions to maintain the connection? I will probably only have about 100 online at any time, and there will be a dispatching center that would update or send the field personnel out to the client sites. We would use cellphone data to transfer the data over the internet and a product called Netmotion that will let the client computer look like it is setting on the home network. Any advice would be appreciated.
wcf
architecture
null
null
null
null
open
WCF Binding advice for dispatched units === I plan to build a WCF based application that will allow for users in the field to be connected to a dispatch center and be able to get updates on their calls and request information from the system while they are performing their calls. I am looking for advice on how to connect the clients to the server. I was thinking that I would use NetTcpBinding. But do I use a callback structure or do I just make a netTcpBiding connection in both directions to maintain the connection? I will probably only have about 100 online at any time, and there will be a dispatching center that would update or send the field personnel out to the client sites. We would use cellphone data to transfer the data over the internet and a product called Netmotion that will let the client computer look like it is setting on the home network. Any advice would be appreciated.
0
11,298,230
07/02/2012 17:18:59
1,080,350
12/04/2011 18:12:12
181
0
SSE instruction need the data aligned
Must the data be 16-byte aligned so that it can be processed by the SSE instruction without segmentation fault? The compiler I tried is gcc with option -msse2. I want use _mm_cmpgt_epi32 to compare a large int array. I found that it can not be executed at any location of the array except the position with subscript of the multiples of 4.
sse
null
null
null
null
null
open
SSE instruction need the data aligned === Must the data be 16-byte aligned so that it can be processed by the SSE instruction without segmentation fault? The compiler I tried is gcc with option -msse2. I want use _mm_cmpgt_epi32 to compare a large int array. I found that it can not be executed at any location of the array except the position with subscript of the multiples of 4.
0
11,298,231
07/02/2012 17:19:00
566,892
01/07/2011 12:57:54
53
4
Liferay Scopes: Web Content Display & Page Display
I am starting to use Scopes on a Site using Liferay CE 6.1 GA1. I have one Site, and two scopes within this site: S1 and S2. I am facing two issues: 1/ When trying to display the Web Content that I added in S1 through the Control Panel, the Web Content Display doesn't display anything. I can select the correct Web Content when selecting scope in portlet configuration as S1, but when I save it it is simply not displayed on the page. No error message is thrown whatsoever in the console. 2/ When trying to save a Display Page for scoped Web Content (either in S1 or S2), this simply does not work. Once more, no error message is thrown, but the Page Display setting is simply not saved. Is that normal, a bug, or am I doing something wrong? Thank you all for your help! TBW.
scope
liferay
null
null
null
null
open
Liferay Scopes: Web Content Display & Page Display === I am starting to use Scopes on a Site using Liferay CE 6.1 GA1. I have one Site, and two scopes within this site: S1 and S2. I am facing two issues: 1/ When trying to display the Web Content that I added in S1 through the Control Panel, the Web Content Display doesn't display anything. I can select the correct Web Content when selecting scope in portlet configuration as S1, but when I save it it is simply not displayed on the page. No error message is thrown whatsoever in the console. 2/ When trying to save a Display Page for scoped Web Content (either in S1 or S2), this simply does not work. Once more, no error message is thrown, but the Page Display setting is simply not saved. Is that normal, a bug, or am I doing something wrong? Thank you all for your help! TBW.
0
11,298,238
07/02/2012 17:19:18
751,062
05/12/2011 17:51:33
45
0
Force showing keyboard in metro?
I'd like to be able to force the keyboard to show on screen in my Metro app. My goal is to test out different layouts/controls and get a feel for the interaction. My problem is that I'm running Win8 on a MacBook Pro (Parallels) and I don't know how to override the physical keyboard and show it on screen instead. Similarly, I'd like to be able to force rotation if possible.
windows-8
null
null
null
null
null
open
Force showing keyboard in metro? === I'd like to be able to force the keyboard to show on screen in my Metro app. My goal is to test out different layouts/controls and get a feel for the interaction. My problem is that I'm running Win8 on a MacBook Pro (Parallels) and I don't know how to override the physical keyboard and show it on screen instead. Similarly, I'd like to be able to force rotation if possible.
0
11,298,242
07/02/2012 17:19:51
1,439,758
06/06/2012 12:39:44
10
0
Semaphores remain open after application exits
I have a 3rd party application written in C for Linux platform. The application creates semaphores using below code: union semun { int Value; struct semid_ds *Buffer; unsigned short * Array; } Arg; Arg.Value = 0; SemId = semget(IPC_PRIVATE , ONE_SEMAPHORE, 0666 | IPC_CREAT); semctl(SemId, 0, SETVAL, Arg); When the application exits, these semaphores are deleted by the application using below code: semctl(SemId, 0, IPC_RMID); If the application is stopped abnormally (such as by sending multiple SIGINT signals), these semaphores remain open. These semaphores can be seen open by using below command: ipcs -s These semaphores have to be removed from the system manually by using ipcrm command. How can I ensure that the semaphores created by the application get deleted when the application finally exits? I have read that exit() call closes all open named semaphores. However these are not named semaphores. I thank you in advance for your help.
c
linux
posix
semaphore
null
null
open
Semaphores remain open after application exits === I have a 3rd party application written in C for Linux platform. The application creates semaphores using below code: union semun { int Value; struct semid_ds *Buffer; unsigned short * Array; } Arg; Arg.Value = 0; SemId = semget(IPC_PRIVATE , ONE_SEMAPHORE, 0666 | IPC_CREAT); semctl(SemId, 0, SETVAL, Arg); When the application exits, these semaphores are deleted by the application using below code: semctl(SemId, 0, IPC_RMID); If the application is stopped abnormally (such as by sending multiple SIGINT signals), these semaphores remain open. These semaphores can be seen open by using below command: ipcs -s These semaphores have to be removed from the system manually by using ipcrm command. How can I ensure that the semaphores created by the application get deleted when the application finally exits? I have read that exit() call closes all open named semaphores. However these are not named semaphores. I thank you in advance for your help.
0
11,298,243
07/02/2012 17:20:05
1,147,364
01/13/2012 09:30:42
179
16
LinqToSql Queries instead of some SQL query
SELECT * FROM register WHERE user_id LIKE 'a%' SELECT * FROM register WHERE user_id LIKE '%m' SELECT * FROM register WHERE user_id LIKE '%andru%' SELECT R.name,C.country_name,S.state_name FROM register R JOIN country C ON R.country_id=C.country_id JOIN state S ON R.state_id=S.state_id SELECT R.name,C.country_name,S.state_name FROM register R INNER JOIN country C ON R.country_id=C.country_id INNER JOIN state S ON R.state_id=S.state_id Now i need **LinqToSql** Queries instead of these query
c#
wpf
linq-to-sql
null
null
null
open
LinqToSql Queries instead of some SQL query === SELECT * FROM register WHERE user_id LIKE 'a%' SELECT * FROM register WHERE user_id LIKE '%m' SELECT * FROM register WHERE user_id LIKE '%andru%' SELECT R.name,C.country_name,S.state_name FROM register R JOIN country C ON R.country_id=C.country_id JOIN state S ON R.state_id=S.state_id SELECT R.name,C.country_name,S.state_name FROM register R INNER JOIN country C ON R.country_id=C.country_id INNER JOIN state S ON R.state_id=S.state_id Now i need **LinqToSql** Queries instead of these query
0
11,627,721
07/24/2012 09:16:48
1,503,484
07/05/2012 09:15:03
3
0
Search Telerik MVC Grid from an Ajax.BeginForm and Rebind the grid with new Model
I want to search Telerik MVC 2.0 Grid (aspx ViewEngine ) .. I have a " UploadFiles " View on which a Grid is rendered at first then clicking on a " Show History " Ajax.ActionLink opens a PartialView "SearchGrid " . In this View there are 2 Telerik MVC DatePickers and a submit button .. On clicking of Submit button sends DatePicker Values back to UploadFiles Controller's " SearchByDates( DateTime? frmDate,DateTime? toDate)" Action ... Here in this action I am sending frmDate,toDate Values to WorkerService Class which in turn sends values to UploadedFilesServices class ... Here in this class UploadDate Item range is matched in between frmDate and toDate ... then an IEnumerable<UploadFilesDescriptor> is sent back to UploadServices class using a LINQ query ... Result of this query is sent back to UploadFiles Controller through UploadServices , UploadWorkerServices ...Everything works fine till this point ... But My problem is with Ajax , after UploadFilesViewModel's GetUploadDescriptor is bound with UploadFilesGrid , again a call is made to SearchByDates action ... but only url.Action is called and not parameters are passed ... When at first the call to this action is made FormCollection doesn't contain anything but when next time a new call is made FormCollection values contain frmDate,toDate.. Finally an empty Grid is displayed .. I don't know what I am doing wrong ... My Index View :- <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TMG/Default.Master" Inherits="System.Web.Mvc.ViewPage<TMG.Framework.Web.MVC.Models.UploadedFilesViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> <%: Html.Resource("UploadedFilesIndexTitle") %> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div class="top-titlecon"> <%:Html.Resource("UploadedFilesIndexTitle")%> </div> <div id="renderForm"> </div> <div class="spacer"> </div> <div> <%Html.RenderPartial("UploadedFilesGrid");%> </div> My GridView:- <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TMG.Framework.Web.MVC.Models.UploadedFilesViewModel>" %> <div id="result"> <div> <%: Ajax.ActionLink ( "Show History", "SearchGrid", null, new AjaxOptions { HttpMethod = "Get", InsertionMode = InsertionMode.Replace, UpdateTargetId = "renderForm", OnSuccess = "updateTarget" }, new { @class = "t-button" } )%> </div> <% var model = Model.GetUploadFileDescriptor; %> <div id="di"> <% Html.Telerik().Grid<UploadedFilesDescriptor>() .Name("UploadedFilesGrid") .DataKeys(datakeys => datakeys.Add(m => m.Id)) .ClientEvents ( events => events.OnDataBound ( "rebindFileListGrid" ) ) columns.Bound(c => c.UploadedDate) .HtmlAttributes(new { @style = "text-align:center;" }) .Width(100); }) .DataBinding(databinding => databinding .Ajax() .Select("GetUploadedFilesList", "UploadFiles")) .EnableCustomBinding ( true ) .Render(); %> </div> </div> : My SearchGrid PartialView :- <% using (Ajax.BeginForm( "SearchByDates","UploadFiles", new AjaxOptions { UpdateTargetId = "divUploadGrid", LoadingElementId = "LoadingImage" }, new { @id = "itemForm" } )) { %> <%= Html.Telerik().DatePicker().Name("frmDate") %> &nbsp; to &nbsp; <%= Html.Telerik().DatePicker().Name("toDate")%> &nbsp; &nbsp; <input type="submit" id="ProfileSearchSubmit" name="ProfileSearchSubmit" onclick="aClick();" value="Search" /> <div id="divUploadFileGrid"> --I am again Rendering the Serached Grid with same model, columns </div> //my Javascript Jquery Ajax Function function aClick() { debugger; var to = $('#toDate').val().toString(); var frm = $('#frmDate').val().toString(); var params = "frmDate=" + frm + "&toDate=" + to; //var url = '<= Url.Action("SearchByDates","UploadFiles") %>'; if (params != null) { $.ajax({ url: '<%= Url.Action("SearchByDates","UploadFiles") %>' + "?" + params, cache: false, success: function (html) { $("#divUploadGrid").show(); // $("#divUploadGrid").html(html); // $("#LoadingImage").css("display", "none"); // $("#divUploadGrid").css("display", "block"); }, complete: function () { //RegisterAjaxEvents(); $("#LoadingImage").css("display", "none"); $("#divUploadGrid").css("display", "block"); $("#result").hide(); // EnableCustomerSearchControls(); } }); } }; :- Controller Action :- public ActionResult SearchByDates( DateTime? frmDate, DateTime? toDate,FormCollection colletion) { try { var fr = colletion["frmDate"]; var to = colletion["toDate"]; if (fr == null || to == null) { DateTime? fromDate = frmDate.Value; DateTime? toDates = toDate.Value; UploadedFilesViewModel model = new UploadedFilesViewModel ( ); model.GetUploadFileDescriptor = _workerService.GetUploadGridByDates ( fromDate, toDates ); return PartialView ( "SearchGrid", model ); } else { DateTime? fromDate = frmDate.Value; DateTime? toDates = toDate.Value; UploadedFilesViewModel model = new UploadedFilesViewModel ( ); model.GetUploadFileDescriptor = _workerService.GetUploadGridByDates ( fromDate, toDates ); return PartialView ( "SearchedGrid", model ); } } catch (Exception ex) { throw ex; } return null; } I think that there must be something wrong in this above Ajax Function .. but what it is that I don't know
mvc
telerik
grid
null
null
07/24/2012 23:06:54
not a real question
Search Telerik MVC Grid from an Ajax.BeginForm and Rebind the grid with new Model === I want to search Telerik MVC 2.0 Grid (aspx ViewEngine ) .. I have a " UploadFiles " View on which a Grid is rendered at first then clicking on a " Show History " Ajax.ActionLink opens a PartialView "SearchGrid " . In this View there are 2 Telerik MVC DatePickers and a submit button .. On clicking of Submit button sends DatePicker Values back to UploadFiles Controller's " SearchByDates( DateTime? frmDate,DateTime? toDate)" Action ... Here in this action I am sending frmDate,toDate Values to WorkerService Class which in turn sends values to UploadedFilesServices class ... Here in this class UploadDate Item range is matched in between frmDate and toDate ... then an IEnumerable<UploadFilesDescriptor> is sent back to UploadServices class using a LINQ query ... Result of this query is sent back to UploadFiles Controller through UploadServices , UploadWorkerServices ...Everything works fine till this point ... But My problem is with Ajax , after UploadFilesViewModel's GetUploadDescriptor is bound with UploadFilesGrid , again a call is made to SearchByDates action ... but only url.Action is called and not parameters are passed ... When at first the call to this action is made FormCollection doesn't contain anything but when next time a new call is made FormCollection values contain frmDate,toDate.. Finally an empty Grid is displayed .. I don't know what I am doing wrong ... My Index View :- <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TMG/Default.Master" Inherits="System.Web.Mvc.ViewPage<TMG.Framework.Web.MVC.Models.UploadedFilesViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> <%: Html.Resource("UploadedFilesIndexTitle") %> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <div class="top-titlecon"> <%:Html.Resource("UploadedFilesIndexTitle")%> </div> <div id="renderForm"> </div> <div class="spacer"> </div> <div> <%Html.RenderPartial("UploadedFilesGrid");%> </div> My GridView:- <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TMG.Framework.Web.MVC.Models.UploadedFilesViewModel>" %> <div id="result"> <div> <%: Ajax.ActionLink ( "Show History", "SearchGrid", null, new AjaxOptions { HttpMethod = "Get", InsertionMode = InsertionMode.Replace, UpdateTargetId = "renderForm", OnSuccess = "updateTarget" }, new { @class = "t-button" } )%> </div> <% var model = Model.GetUploadFileDescriptor; %> <div id="di"> <% Html.Telerik().Grid<UploadedFilesDescriptor>() .Name("UploadedFilesGrid") .DataKeys(datakeys => datakeys.Add(m => m.Id)) .ClientEvents ( events => events.OnDataBound ( "rebindFileListGrid" ) ) columns.Bound(c => c.UploadedDate) .HtmlAttributes(new { @style = "text-align:center;" }) .Width(100); }) .DataBinding(databinding => databinding .Ajax() .Select("GetUploadedFilesList", "UploadFiles")) .EnableCustomBinding ( true ) .Render(); %> </div> </div> : My SearchGrid PartialView :- <% using (Ajax.BeginForm( "SearchByDates","UploadFiles", new AjaxOptions { UpdateTargetId = "divUploadGrid", LoadingElementId = "LoadingImage" }, new { @id = "itemForm" } )) { %> <%= Html.Telerik().DatePicker().Name("frmDate") %> &nbsp; to &nbsp; <%= Html.Telerik().DatePicker().Name("toDate")%> &nbsp; &nbsp; <input type="submit" id="ProfileSearchSubmit" name="ProfileSearchSubmit" onclick="aClick();" value="Search" /> <div id="divUploadFileGrid"> --I am again Rendering the Serached Grid with same model, columns </div> //my Javascript Jquery Ajax Function function aClick() { debugger; var to = $('#toDate').val().toString(); var frm = $('#frmDate').val().toString(); var params = "frmDate=" + frm + "&toDate=" + to; //var url = '<= Url.Action("SearchByDates","UploadFiles") %>'; if (params != null) { $.ajax({ url: '<%= Url.Action("SearchByDates","UploadFiles") %>' + "?" + params, cache: false, success: function (html) { $("#divUploadGrid").show(); // $("#divUploadGrid").html(html); // $("#LoadingImage").css("display", "none"); // $("#divUploadGrid").css("display", "block"); }, complete: function () { //RegisterAjaxEvents(); $("#LoadingImage").css("display", "none"); $("#divUploadGrid").css("display", "block"); $("#result").hide(); // EnableCustomerSearchControls(); } }); } }; :- Controller Action :- public ActionResult SearchByDates( DateTime? frmDate, DateTime? toDate,FormCollection colletion) { try { var fr = colletion["frmDate"]; var to = colletion["toDate"]; if (fr == null || to == null) { DateTime? fromDate = frmDate.Value; DateTime? toDates = toDate.Value; UploadedFilesViewModel model = new UploadedFilesViewModel ( ); model.GetUploadFileDescriptor = _workerService.GetUploadGridByDates ( fromDate, toDates ); return PartialView ( "SearchGrid", model ); } else { DateTime? fromDate = frmDate.Value; DateTime? toDates = toDate.Value; UploadedFilesViewModel model = new UploadedFilesViewModel ( ); model.GetUploadFileDescriptor = _workerService.GetUploadGridByDates ( fromDate, toDates ); return PartialView ( "SearchedGrid", model ); } } catch (Exception ex) { throw ex; } return null; } I think that there must be something wrong in this above Ajax Function .. but what it is that I don't know
1
11,627,722
07/24/2012 09:16:49
916,140
08/28/2011 05:17:07
304
1
boost / creating streams
Can you provide a simple example of the simplest code to create a boost "in" stream (boost::iostreams)? Im trying to create a stream that can be assigned to a file_sink later on. Thanx in advance.
c++
boost
stream
null
null
07/25/2012 09:46:08
not a real question
boost / creating streams === Can you provide a simple example of the simplest code to create a boost "in" stream (boost::iostreams)? Im trying to create a stream that can be assigned to a file_sink later on. Thanx in advance.
1
11,627,876
07/24/2012 09:25:25
1,300,679
03/29/2012 11:52:48
1
0
Using Skype presence control over HTTPS
I would like to create a page, that displays the skype status of logined user like this: http://www.skype.com/intl/en-us/tell-a-friend/get-a-skype-button/ It works fine on http, but i have to use https protocol. MyStatus link is a http link that displays the status of user, but browsers doesn't display this correctly or display a notification because of http link. Has anyone had experience with this? Thank you in advance.
https
skype
null
null
null
null
open
Using Skype presence control over HTTPS === I would like to create a page, that displays the skype status of logined user like this: http://www.skype.com/intl/en-us/tell-a-friend/get-a-skype-button/ It works fine on http, but i have to use https protocol. MyStatus link is a http link that displays the status of user, but browsers doesn't display this correctly or display a notification because of http link. Has anyone had experience with this? Thank you in advance.
0
11,627,846
07/24/2012 09:23:55
1,261,166
03/10/2012 15:12:58
363
24
Keep cmd.exe open
I have a python script which I have made dropable using a registry-key, but it does not seem to work. The cmd.exe window just flashes by, can I somehow make the window stay up, or save the output?
python
registry
cmd
cmd.exe
null
null
open
Keep cmd.exe open === I have a python script which I have made dropable using a registry-key, but it does not seem to work. The cmd.exe window just flashes by, can I somehow make the window stay up, or save the output?
0
11,627,889
07/24/2012 09:25:57
1,548,119
07/24/2012 09:02:26
1
0
Parse JSON and display values in Rails
I have some JSON saved ina database that I am retrieving and parsing but for some reason cannot loop through the parsed JSON and return it's values. <% @submission.each do |submission| %> <div class="field"> <p class="submissionDate"> <% @dog = JSON.parse(submission.self_interests) %> #Gets the JSON from the self_interests field <% @dog.each do |self_interests| %> <%= self_interests.company_name %> #trying to get the company_name from the parsed array <% end %> </p> <% end %> if I use `<%= self_interests %>` instead of `<%= self_interests.company_name %>` it outputs the parsed array as expected. {"self_interest"=>{"appointment_date"=>"2012-07-19", "company_name"=>"asdasd", "company_registration"=>"asdas", "created_at"=>"2012-07-18T15:49:33+02:00", "date_deleted"=>nil, "date_registered"=>"2012-07-10", "date_terminated"=>"2012-07-27", "id"=>16, "trading_name"=>"asdasd", "transacting_with"=>1, "type_of_business"=>"asdasdasd", "updated_at"=>"2012-07-18T15:49:33+02:00", "user_id"=>2}} Any help with this will be much appreciated, its been wracking my brain hard. I am quite new to Rails so it might be something obvious I am missing.
arrays
ruby-on-rails-3
json
activerecord
activesupport
null
open
Parse JSON and display values in Rails === I have some JSON saved ina database that I am retrieving and parsing but for some reason cannot loop through the parsed JSON and return it's values. <% @submission.each do |submission| %> <div class="field"> <p class="submissionDate"> <% @dog = JSON.parse(submission.self_interests) %> #Gets the JSON from the self_interests field <% @dog.each do |self_interests| %> <%= self_interests.company_name %> #trying to get the company_name from the parsed array <% end %> </p> <% end %> if I use `<%= self_interests %>` instead of `<%= self_interests.company_name %>` it outputs the parsed array as expected. {"self_interest"=>{"appointment_date"=>"2012-07-19", "company_name"=>"asdasd", "company_registration"=>"asdas", "created_at"=>"2012-07-18T15:49:33+02:00", "date_deleted"=>nil, "date_registered"=>"2012-07-10", "date_terminated"=>"2012-07-27", "id"=>16, "trading_name"=>"asdasd", "transacting_with"=>1, "type_of_business"=>"asdasdasd", "updated_at"=>"2012-07-18T15:49:33+02:00", "user_id"=>2}} Any help with this will be much appreciated, its been wracking my brain hard. I am quite new to Rails so it might be something obvious I am missing.
0
11,627,890
07/24/2012 09:25:59
1,548,172
07/24/2012 09:20:32
1
0
Running multiple Javascript scripts only when certain HTML elements exist?
Here's the situation. I'm building a site which uses lots of scripts looking somewhat like this: function getRandomArrayIndex(source_array) { return Math.floor(Math.random() * source_array.length); } function getRandomArrayEntry(source_array) { var random_index = getRandomArrayIndex(source_array); return source_array[random_index]; } function getRandomBlah() { var blahs = [ ["A"], ["B"], ["C"], ["D"], ["E"], ["F"], ["G"], ["H"], ["I"], ["L"], ["M"], ["N"], ["O"], ["P"], ["R"], ["S"], ["T"], ["V"], ["W"], ["Y"], ]; var random_blah = getRandomArrayEntry(blahs); return random_blah; } function displayBlah(blah) { const TEXT_ROW = 0; const LINK_ROW = 1; var blah_text = blah[TEXT_ROW]; var blah_link = blah[LINK_ROW]; if (blah_link != null) { document.getElementById("blah").innerHTML = '<a href="' + blah_link + '">' + blah_text + '</a>'; } else { document.getElementById("blah").innerHTML = blah_text; } } function generateRandomBlah(){ var random_blah = getRandomBlah(); displayBlah(random_blah); } And this will, when called with <body onload="generateRandomBlah()">, insert one of the letters at random into <span id="blah"></span>. So there's about 15 of these scripts, each with their own functions named slightly differently for different uses - generateRandomBlah2, etc, with a corresponding different place in the HTML for each script to do its work. Because I'm not a very good coder, the way the whole thing works is that in the 'body onload' tag, there's about 15 different 'generateRandomBlah()' functions just within this one tag. The nature of the site means that on any one page, I will only need 2 or 3 of these scripts at once, but I require the ability to call *any* of them on *any* page. As you can see, my current tactic is to just call them all at once, and if the corresponding <span id> doesn't exist for a script, it'll just ignore that fact and move onto the next one. Except that it doesn't ignore the fact that there's no corresponding <span>. As soon as one <span> isn't present, the rest of the scripts break and don't actually do what they're supposed to do. Looking at the code in Chrome's 'inspect code' shows an error at the first script which happens to break: "Uncaught TypeError: Cannot set property 'innerHTML' of null". I see a couple of potential solutions, but I might be completely off: 1) Add some code into each script which tells it that, if there's no <span id> on the page to insert its code, it ends gracefully and moves onto the next one - gradually (obviously in less than a second speed-wise) going through the scripts and only running them if <span id> actually exists. (As you can see, the problem is that a script will get 'snagged' on the fact that there's no place to insert its code and doesn't just end gracefully if that happens. 2) Get rid of the 'onload' stuff and just make each script self-containing, calling its own function. I don't know if this would fix the problem, though. Anyway, some help would be much appreciated, as I'm stumped. Thanks!
javascript
onload
null
null
null
null
open
Running multiple Javascript scripts only when certain HTML elements exist? === Here's the situation. I'm building a site which uses lots of scripts looking somewhat like this: function getRandomArrayIndex(source_array) { return Math.floor(Math.random() * source_array.length); } function getRandomArrayEntry(source_array) { var random_index = getRandomArrayIndex(source_array); return source_array[random_index]; } function getRandomBlah() { var blahs = [ ["A"], ["B"], ["C"], ["D"], ["E"], ["F"], ["G"], ["H"], ["I"], ["L"], ["M"], ["N"], ["O"], ["P"], ["R"], ["S"], ["T"], ["V"], ["W"], ["Y"], ]; var random_blah = getRandomArrayEntry(blahs); return random_blah; } function displayBlah(blah) { const TEXT_ROW = 0; const LINK_ROW = 1; var blah_text = blah[TEXT_ROW]; var blah_link = blah[LINK_ROW]; if (blah_link != null) { document.getElementById("blah").innerHTML = '<a href="' + blah_link + '">' + blah_text + '</a>'; } else { document.getElementById("blah").innerHTML = blah_text; } } function generateRandomBlah(){ var random_blah = getRandomBlah(); displayBlah(random_blah); } And this will, when called with <body onload="generateRandomBlah()">, insert one of the letters at random into <span id="blah"></span>. So there's about 15 of these scripts, each with their own functions named slightly differently for different uses - generateRandomBlah2, etc, with a corresponding different place in the HTML for each script to do its work. Because I'm not a very good coder, the way the whole thing works is that in the 'body onload' tag, there's about 15 different 'generateRandomBlah()' functions just within this one tag. The nature of the site means that on any one page, I will only need 2 or 3 of these scripts at once, but I require the ability to call *any* of them on *any* page. As you can see, my current tactic is to just call them all at once, and if the corresponding <span id> doesn't exist for a script, it'll just ignore that fact and move onto the next one. Except that it doesn't ignore the fact that there's no corresponding <span>. As soon as one <span> isn't present, the rest of the scripts break and don't actually do what they're supposed to do. Looking at the code in Chrome's 'inspect code' shows an error at the first script which happens to break: "Uncaught TypeError: Cannot set property 'innerHTML' of null". I see a couple of potential solutions, but I might be completely off: 1) Add some code into each script which tells it that, if there's no <span id> on the page to insert its code, it ends gracefully and moves onto the next one - gradually (obviously in less than a second speed-wise) going through the scripts and only running them if <span id> actually exists. (As you can see, the problem is that a script will get 'snagged' on the fact that there's no place to insert its code and doesn't just end gracefully if that happens. 2) Get rid of the 'onload' stuff and just make each script self-containing, calling its own function. I don't know if this would fix the problem, though. Anyway, some help would be much appreciated, as I'm stumped. Thanks!
0
11,660,221
07/25/2012 23:29:53
294,470
03/16/2010 03:42:48
133
6
UIScrollView fails to AutoScroll to child UITextField
I'm having problems with a custom UIScrollView class. Roughly speaking, i have a ScrollView onscreen, with several subviews. At the very bottom of that UIScrollView, i'm attaching a UITextView, and below that, a UITextField. So far, so good. The contentSize of the scrollView is correctly set, and the 'scrollEnabled' flag is set to YES. Both, the UITextView and the UITextField, have a custom InputAccesory view. It's a simple toolbar, with the previous / next buttons. The handling code of the toolbar is the following: - (IBAction)btnSegmentedPressed { [_segmentedControl setUserInteractionEnabled:NO]; // Get the firstResponder ASSERT(_scrollView); UIView* firstResponder = [_scrollView findFirstResponder]; if(firstResponder == nil) { return; } // What's the nextView tag? NSInteger nextViewTag = [firstResponder tag]; if(_segmentedControl.selectedSegmentIndex == 0) { --nextViewTag; } else { ++nextViewTag; } // Do we have a nextView? UIView* nextView = [_scrollView viewWithTag:nextViewTag]; if(nextView != nil) { [nextView becomeFirstResponder]; [self refreshToolbar]; } } I'm struggling with an ugly bug, in which... when the UITextView has several lines in it, the UIScrollView will fail to automatically scroll to the next firstResponder. (It will remain below the toolbar). By the way, i'm handling the keyboard events, and applying a bottom inset to the scrollView, as described here: http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html#//apple_ref/doc/uid/TP40009542-CH5-SW1. Any suggestions / ideas will be very welcome. Thank you!
ios
ios5
uikit
null
null
null
open
UIScrollView fails to AutoScroll to child UITextField === I'm having problems with a custom UIScrollView class. Roughly speaking, i have a ScrollView onscreen, with several subviews. At the very bottom of that UIScrollView, i'm attaching a UITextView, and below that, a UITextField. So far, so good. The contentSize of the scrollView is correctly set, and the 'scrollEnabled' flag is set to YES. Both, the UITextView and the UITextField, have a custom InputAccesory view. It's a simple toolbar, with the previous / next buttons. The handling code of the toolbar is the following: - (IBAction)btnSegmentedPressed { [_segmentedControl setUserInteractionEnabled:NO]; // Get the firstResponder ASSERT(_scrollView); UIView* firstResponder = [_scrollView findFirstResponder]; if(firstResponder == nil) { return; } // What's the nextView tag? NSInteger nextViewTag = [firstResponder tag]; if(_segmentedControl.selectedSegmentIndex == 0) { --nextViewTag; } else { ++nextViewTag; } // Do we have a nextView? UIView* nextView = [_scrollView viewWithTag:nextViewTag]; if(nextView != nil) { [nextView becomeFirstResponder]; [self refreshToolbar]; } } I'm struggling with an ugly bug, in which... when the UITextView has several lines in it, the UIScrollView will fail to automatically scroll to the next firstResponder. (It will remain below the toolbar). By the way, i'm handling the keyboard events, and applying a bottom inset to the scrollView, as described here: http://developer.apple.com/library/ios/#documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html#//apple_ref/doc/uid/TP40009542-CH5-SW1. Any suggestions / ideas will be very welcome. Thank you!
0
11,660,222
07/25/2012 23:29:54
429,850
08/24/2010 17:28:26
2,254
88
Can I have inputs without forms in a Rails view?
I want to have a few check boxes on my page, and a link that accesses the value of these check boxes to pass in a `link_to` helper. I did not want to use a form because the view essentially has a number of links interspersed, and it doesn't naturally seem to be a form with one logical submit button. I have something like <% for p in @some_array %> <!--other stuff .... --> <input value=<%= p.id %> id=<%= p.id %> name="selected[]" type=checkbox> <!--other stuff .... --> <%= link_to "View all selected thing(s)", :action => 'show_selected', :selected_things => selected[] %> But it doesn't seem to recognize the variable `selected` which stores the inputs. It raises undefined local variable or method `selected' for #<#<Class:0x000001021b4a38>:0x00000102319a90>
html
ruby-on-rails
forms
mvc
null
null
open
Can I have inputs without forms in a Rails view? === I want to have a few check boxes on my page, and a link that accesses the value of these check boxes to pass in a `link_to` helper. I did not want to use a form because the view essentially has a number of links interspersed, and it doesn't naturally seem to be a form with one logical submit button. I have something like <% for p in @some_array %> <!--other stuff .... --> <input value=<%= p.id %> id=<%= p.id %> name="selected[]" type=checkbox> <!--other stuff .... --> <%= link_to "View all selected thing(s)", :action => 'show_selected', :selected_things => selected[] %> But it doesn't seem to recognize the variable `selected` which stores the inputs. It raises undefined local variable or method `selected' for #<#<Class:0x000001021b4a38>:0x00000102319a90>
0
11,660,224
07/25/2012 23:30:10
1,482,644
06/26/2012 12:02:39
31
0
c# - Optimize SQLite Select statement
I am using System.Data.SQLite for my database, and my select statements are very slow. It takes around 3-5 minutes to query around 5000 rows of data. Here is the code I am using: string connectionString; connectionString = string.Format(@"Data Source={0}", documentsFolder + ";Version=3;New=False;Compress=True;"); //Open a new SQLite Connection SQLiteConnection conn = new SQLiteConnection(connectionString); conn.Open(); SQLiteCommand cmd = new SQLiteCommand(); cmd.Connection = conn; cmd.CommandText = "Select * From urls"; //Assign the data from urls to dr SQLiteDataReader dr = cmd.ExecuteReader(); SQLiteCommand com = new SQLiteCommand(); com.CommandText = "Select * From visits"; SQLiteDataReader visit = com.ExecuteReader(); List<int> dbID2 = new List<int>(); while (visit.Read()) { dbID2.Add(int.Parse(visit[1].ToString())); } //Read from dr while (dr.Read()) { string url = dr[1].ToString(); string title = dr[2].ToString(); long visitlong = Int64.Parse(dr[5].ToString()); string browser = "Chrome"; int dbID = int.Parse(dr[0].ToString()); bool exists = dbID2.Any(item => item == dbID); int frequency = int.Parse(dr["visit_count"].ToString()); bool containsBoth = url.Contains("file:///"); if (exists) { if (containsBoth == false) { var form = Form.ActiveForm as TestURLGUI2.Form1; URLs.Add(new URL(url, title, browser, visited, frequency)); Console.WriteLine(String.Format("{0} {1}", title, browser)); } } } //Close the connection conn.Close(); And here is another example that takes long: IEnumerable<URL> ExtractUserHistory(string folder, bool display) { // Get User history info DataTable historyDT = ExtractFromTable("moz_places", folder); // Get visit Time/Data info DataTable visitsDT = ExtractFromTable("moz_historyvisits", folder); // Loop each history entry foreach (DataRow row in historyDT.Rows) { // Select entry Date from visits var entryDate = (from dates in visitsDT.AsEnumerable() where dates["place_id"].ToString() == row["id"].ToString() select dates).LastOrDefault(); // If history entry has date if (entryDate != null) { // Obtain URL and Title strings string url = row["Url"].ToString(); string title = row["title"].ToString(); int frequency = int.Parse(row["visit_count"].ToString()); string visit_type; //Add a URL to list URLs URLs.Add(new URL(url, title, browser, visited, frequency)); // Add entry to list // URLs.Add(u); if (title != "") { Console.WriteLine(String.Format("{0} {1}", title, browser)); } } } return URLs; } DataTable ExtractFromTable(string table, string folder) { SQLiteConnection sql_con; SQLiteCommand sql_cmd; SQLiteDataAdapter DB; DataTable DT = new DataTable(); // FireFox database file string dbPath = folder + "\\places.sqlite"; // If file exists if (File.Exists(dbPath)) { // Data connection sql_con = new SQLiteConnection("Data Source=" + dbPath + ";Version=3;New=False;Compress=True;"); // Open the Connection sql_con.Open(); sql_cmd = sql_con.CreateCommand(); // Select Query string CommandText = "select * from " + table; // Populate Data Table DB = new SQLiteDataAdapter(CommandText, sql_con); DB.Fill(DT); // Clean up sql_con.Close(); } return DT; } Now, how can I optimize these so that they are faster?
c#
sqlite
select
null
null
null
open
c# - Optimize SQLite Select statement === I am using System.Data.SQLite for my database, and my select statements are very slow. It takes around 3-5 minutes to query around 5000 rows of data. Here is the code I am using: string connectionString; connectionString = string.Format(@"Data Source={0}", documentsFolder + ";Version=3;New=False;Compress=True;"); //Open a new SQLite Connection SQLiteConnection conn = new SQLiteConnection(connectionString); conn.Open(); SQLiteCommand cmd = new SQLiteCommand(); cmd.Connection = conn; cmd.CommandText = "Select * From urls"; //Assign the data from urls to dr SQLiteDataReader dr = cmd.ExecuteReader(); SQLiteCommand com = new SQLiteCommand(); com.CommandText = "Select * From visits"; SQLiteDataReader visit = com.ExecuteReader(); List<int> dbID2 = new List<int>(); while (visit.Read()) { dbID2.Add(int.Parse(visit[1].ToString())); } //Read from dr while (dr.Read()) { string url = dr[1].ToString(); string title = dr[2].ToString(); long visitlong = Int64.Parse(dr[5].ToString()); string browser = "Chrome"; int dbID = int.Parse(dr[0].ToString()); bool exists = dbID2.Any(item => item == dbID); int frequency = int.Parse(dr["visit_count"].ToString()); bool containsBoth = url.Contains("file:///"); if (exists) { if (containsBoth == false) { var form = Form.ActiveForm as TestURLGUI2.Form1; URLs.Add(new URL(url, title, browser, visited, frequency)); Console.WriteLine(String.Format("{0} {1}", title, browser)); } } } //Close the connection conn.Close(); And here is another example that takes long: IEnumerable<URL> ExtractUserHistory(string folder, bool display) { // Get User history info DataTable historyDT = ExtractFromTable("moz_places", folder); // Get visit Time/Data info DataTable visitsDT = ExtractFromTable("moz_historyvisits", folder); // Loop each history entry foreach (DataRow row in historyDT.Rows) { // Select entry Date from visits var entryDate = (from dates in visitsDT.AsEnumerable() where dates["place_id"].ToString() == row["id"].ToString() select dates).LastOrDefault(); // If history entry has date if (entryDate != null) { // Obtain URL and Title strings string url = row["Url"].ToString(); string title = row["title"].ToString(); int frequency = int.Parse(row["visit_count"].ToString()); string visit_type; //Add a URL to list URLs URLs.Add(new URL(url, title, browser, visited, frequency)); // Add entry to list // URLs.Add(u); if (title != "") { Console.WriteLine(String.Format("{0} {1}", title, browser)); } } } return URLs; } DataTable ExtractFromTable(string table, string folder) { SQLiteConnection sql_con; SQLiteCommand sql_cmd; SQLiteDataAdapter DB; DataTable DT = new DataTable(); // FireFox database file string dbPath = folder + "\\places.sqlite"; // If file exists if (File.Exists(dbPath)) { // Data connection sql_con = new SQLiteConnection("Data Source=" + dbPath + ";Version=3;New=False;Compress=True;"); // Open the Connection sql_con.Open(); sql_cmd = sql_con.CreateCommand(); // Select Query string CommandText = "select * from " + table; // Populate Data Table DB = new SQLiteDataAdapter(CommandText, sql_con); DB.Fill(DT); // Clean up sql_con.Close(); } return DT; } Now, how can I optimize these so that they are faster?
0
11,660,226
07/25/2012 23:30:16
1,007,493
10/21/2011 16:13:21
52
0
How to Make this Image Slider?
How can I make a slider like the one on this page? http://peachtreedesigns.com/ I was trying to use Nivo slider, but I couldn't get it to work. Also, I need moving text at the beginning like in the link above, which I don't think Nivo slider can do.
javascript
html
image
slider
null
07/27/2012 00:27:15
not a real question
How to Make this Image Slider? === How can I make a slider like the one on this page? http://peachtreedesigns.com/ I was trying to use Nivo slider, but I couldn't get it to work. Also, I need moving text at the beginning like in the link above, which I don't think Nivo slider can do.
1
11,660,228
07/25/2012 23:30:26
1,553,055
07/25/2012 23:09:14
1
0
Passing a string from Java to a bash script
So I have a client and a server Java program. The client uses Java processbuilder to execute the script but my problem is that the user inputs information that needs to be passed to the bash script. So, essentially, I need to know how to send three different strings to three different variables that are being read by the bash script. This script is copying a file so I would rather not make a txt file with java and have the script read the file. I would also like a way for this to be able to run on OS X and Windows so improvements are welcome. I am using Java 7 on Ubuntu currently. Here is a snippet of what I am trying to do: .java Scanner bob = new Scanner(System.in); String workingDirectory = new String(System.getProperty("user.dir")); File tempDir = new File(workingDirectory); String script = new String(workingDirectory + "/copyjava.sh"); System.out.print("Designate the location of the file: "); String loc = bob.next(); System.out.print("Type the name of the file w/ extension: "); String name = bob.next(); System.out.print("What is the location of THIS file? "); //I know there is a way to do this automagically but I can't remember how... String wkspace = bob.next(); ProcessBuilder pb = new ProcessBuilder( script, loc, name, wkspace); pb.start(); File myFile = new File (name); Script: read loc read name read wkspace cd $LOC cp $name $wkspace
java
linux
unix
scripting
.bash-profile
null
open
Passing a string from Java to a bash script === So I have a client and a server Java program. The client uses Java processbuilder to execute the script but my problem is that the user inputs information that needs to be passed to the bash script. So, essentially, I need to know how to send three different strings to three different variables that are being read by the bash script. This script is copying a file so I would rather not make a txt file with java and have the script read the file. I would also like a way for this to be able to run on OS X and Windows so improvements are welcome. I am using Java 7 on Ubuntu currently. Here is a snippet of what I am trying to do: .java Scanner bob = new Scanner(System.in); String workingDirectory = new String(System.getProperty("user.dir")); File tempDir = new File(workingDirectory); String script = new String(workingDirectory + "/copyjava.sh"); System.out.print("Designate the location of the file: "); String loc = bob.next(); System.out.print("Type the name of the file w/ extension: "); String name = bob.next(); System.out.print("What is the location of THIS file? "); //I know there is a way to do this automagically but I can't remember how... String wkspace = bob.next(); ProcessBuilder pb = new ProcessBuilder( script, loc, name, wkspace); pb.start(); File myFile = new File (name); Script: read loc read name read wkspace cd $LOC cp $name $wkspace
0
11,660,230
07/25/2012 23:30:42
1,553,081
07/25/2012 23:26:16
1
0
What is the correct way to append via loop in racket?
started learning racket today. I was attempting to find the correct way to append via a loop but could not find the answer or figure out the syntax myself. For example, if I want a row of nine circles using hc-append, how can I do this without manually typing out nine nested hc-append procedures?
loops
racket
null
null
null
null
open
What is the correct way to append via loop in racket? === started learning racket today. I was attempting to find the correct way to append via a loop but could not find the answer or figure out the syntax myself. For example, if I want a row of nine circles using hc-append, how can I do this without manually typing out nine nested hc-append procedures?
0
11,660,232
07/25/2012 23:31:13
1,552,979
07/25/2012 22:04:59
1
0
Practical way of getting a picture of a library object
I´m making a level creator for my platformer game on AS3. I´m looking for a way of getting a graphical representation of a library object on my .fla, so the user can insert that object on the world on the desired coordinate. What I mean with this is that I just want a picture of the first frame of the mc, without taking its properties and methods (without the need to make a .jpg containing that image), because that´s when problems begin to appear, and I just want the object functionality on play mode, not the level creator. Let´s say, for example, a ball that bounces all the time by updating its location every frame. On the level creator I just want to get the ball picture to insert it on the desired location. If I take the whole ball object to the level creator it won´t stop bouncing and it will mess things up. I hope I´m clear... I just want to know if there is a practical solution to this; if not then I´ll make a class where all the world objects would extend to, that has a init() function that initializes all the object functionality, so it´s called only on play mode and not on level creator. Thanks for reading anyway.
actionscript-3
flash
null
null
null
null
open
Practical way of getting a picture of a library object === I´m making a level creator for my platformer game on AS3. I´m looking for a way of getting a graphical representation of a library object on my .fla, so the user can insert that object on the world on the desired coordinate. What I mean with this is that I just want a picture of the first frame of the mc, without taking its properties and methods (without the need to make a .jpg containing that image), because that´s when problems begin to appear, and I just want the object functionality on play mode, not the level creator. Let´s say, for example, a ball that bounces all the time by updating its location every frame. On the level creator I just want to get the ball picture to insert it on the desired location. If I take the whole ball object to the level creator it won´t stop bouncing and it will mess things up. I hope I´m clear... I just want to know if there is a practical solution to this; if not then I´ll make a class where all the world objects would extend to, that has a init() function that initializes all the object functionality, so it´s called only on play mode and not on level creator. Thanks for reading anyway.
0
11,660,233
07/25/2012 23:31:12
1,553,078
07/25/2012 23:25:13
1
0
About VB.2008 [How to Copy Text button]?
Hello guys I'm doing a weird kind of program. Well what I want to know is I created several botãos Oh I want this guy when clicking the example: 'Help' ai automatically copies the word 'Help' ... It is for visual basic 2008 can someone help me?
2d-games
null
null
null
null
null
open
About VB.2008 [How to Copy Text button]? === Hello guys I'm doing a weird kind of program. Well what I want to know is I created several botãos Oh I want this guy when clicking the example: 'Help' ai automatically copies the word 'Help' ... It is for visual basic 2008 can someone help me?
0
11,660,235
07/25/2012 23:31:35
1,390,722
05/12/2012 06:58:50
11
0
Find out username(who) modified file in C#
I am using a FileSystemWatcher to monitor a folder. But when there is some event happening in the directory, I don't know how to search who made a impact on that file. I tried to use EventLog. It just couldn't work. Is there another way to do it?
c#
filesystemwatcher
null
null
null
null
open
Find out username(who) modified file in C# === I am using a FileSystemWatcher to monitor a folder. But when there is some event happening in the directory, I don't know how to search who made a impact on that file. I tried to use EventLog. It just couldn't work. Is there another way to do it?
0
11,660,236
07/25/2012 23:31:37
1,080,804
10/24/2011 17:50:57
3
0
python reference a property like a function
I am interested in setting a bunch of class properties. For simplicity, lets say a property can be represented by getter/setter functions. What I want (in simple function terms) is (inside some arbitrary class): def setter1(self, value): self.a = value def setter2(self, value): self.b = value func_list = [self.setter1, self.setter2] value_list = [1, 2] for ind in range(len(func_list)): func_list[ind](value_list[ind]) The only thing not elegant is when I access these functions separately later on in the code. This is precisely why I want to implement a similar arrangement but with properties - so that later on in the code I still have the convenience of self.a = 1 rather than self.setter1(1). Obviously I want to ensure read only access. I understand if this is asking too much though - just wanted to hear it from a pythonaut before I make the assumption python isn't capable. I understand the dir(), vars(), class.__dict()__ methods all return references - but correct me if I'm wrong in thinking they only return the value of the property or its string representation (I want the setter *method*). In summary, I want the ability to pass properties like functions (in that I have full use of their methodology). I have tried creating a function that sets the value of the property (but I get an error saying AttributeError: can't set attribute). I believe this is because only the setter function can set the value. I have viewed answers to (but none seem elegant): http://stackoverflow.com/questions/1224962/create-properties-using-lambda-getter-and-setter http://stackoverflow.com/questions/5876049/in-a-python-object-how-can-i-see-a-list-of-properties-that-have-been-defined-wi http://stackoverflow.com/questions/3681272/can-i-get-a-reference-to-a-python-property
python
list
properties
reference
setter
null
open
python reference a property like a function === I am interested in setting a bunch of class properties. For simplicity, lets say a property can be represented by getter/setter functions. What I want (in simple function terms) is (inside some arbitrary class): def setter1(self, value): self.a = value def setter2(self, value): self.b = value func_list = [self.setter1, self.setter2] value_list = [1, 2] for ind in range(len(func_list)): func_list[ind](value_list[ind]) The only thing not elegant is when I access these functions separately later on in the code. This is precisely why I want to implement a similar arrangement but with properties - so that later on in the code I still have the convenience of self.a = 1 rather than self.setter1(1). Obviously I want to ensure read only access. I understand if this is asking too much though - just wanted to hear it from a pythonaut before I make the assumption python isn't capable. I understand the dir(), vars(), class.__dict()__ methods all return references - but correct me if I'm wrong in thinking they only return the value of the property or its string representation (I want the setter *method*). In summary, I want the ability to pass properties like functions (in that I have full use of their methodology). I have tried creating a function that sets the value of the property (but I get an error saying AttributeError: can't set attribute). I believe this is because only the setter function can set the value. I have viewed answers to (but none seem elegant): http://stackoverflow.com/questions/1224962/create-properties-using-lambda-getter-and-setter http://stackoverflow.com/questions/5876049/in-a-python-object-how-can-i-see-a-list-of-properties-that-have-been-defined-wi http://stackoverflow.com/questions/3681272/can-i-get-a-reference-to-a-python-property
0
11,660,239
07/25/2012 23:31:52
1,536,327
07/18/2012 22:59:45
1
0
Resetting Sql Server 2008 login (no access using management studio)
I setup Sql Server 2008 a while ago on my machine. I tried to connect with Management Studio and get the error login failed for user. Its been such a long time since I set this up that I cannot remember the credentials. How do I reset the credentials so this will work or do I have to uninstall and re-install?
sql
sql-server-2008
ssms
null
null
null
open
Resetting Sql Server 2008 login (no access using management studio) === I setup Sql Server 2008 a while ago on my machine. I tried to connect with Management Studio and get the error login failed for user. Its been such a long time since I set this up that I cannot remember the credentials. How do I reset the credentials so this will work or do I have to uninstall and re-install?
0
11,660,243
07/25/2012 23:33:02
1,524,894
07/14/2012 00:54:31
1
0
Pygame - Space Invaders Aliens
currently I have a row of aliens, and now I'm trying to make bullets shoot from a random alien once the current bullets go off screen. so far I have this for the bullets: http://pastebin.com/fR0gzkh6 which shoots a bullet from an alien at the starting point and continues to shoot from that x coord, but how can I make it take the current x coords of various different aliens and shoot from their current x coord. this is the alien class: http://pastebin.com/kRpthdh4 and this is how i create a group of sprites for the aliens: for i in range(5): self.alien_sprites.add(Alien((i*100)+10, 0))
python
pygame
null
null
null
null
open
Pygame - Space Invaders Aliens === currently I have a row of aliens, and now I'm trying to make bullets shoot from a random alien once the current bullets go off screen. so far I have this for the bullets: http://pastebin.com/fR0gzkh6 which shoots a bullet from an alien at the starting point and continues to shoot from that x coord, but how can I make it take the current x coords of various different aliens and shoot from their current x coord. this is the alien class: http://pastebin.com/kRpthdh4 and this is how i create a group of sprites for the aliens: for i in range(5): self.alien_sprites.add(Alien((i*100)+10, 0))
0
11,660,244
07/25/2012 23:33:09
1,192,805
02/06/2012 16:55:08
1
0
how to get ASI to retrieve image from server if newer than cached image
I'm using ASI's cache for images. I'm running into an issue when the image is updated on the server but ASI does not retrieve the newer image and replace it in the cache. I've tried a few combinations of cache flags but I'm pretty sure I don't have the right combo of fields. This is the configuration. ASIDownloadCache * cache = [ASIDownloadCache sharedCache]; [cache setShouldRespectCacheControlHeaders:NO]; [self setDownloadCache:[ASIDownloadCache sharedCache]]; [self setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy]; [self setCachePolicy:ASIAskServerIfModifiedCachePolicy| ASIOnlyLoadIfNotCachedCachePolicy| ASIFallbackToCacheIfLoadFailsCachePolicy]; My understanding is that it should: a) check if the image is updated on the server, if so the newer version is retrieved, used, and replaced in the cache b) if the server has old data and the cache has expired image, use expired image c) use cached image if request fails I've verified that the image is newer on the server, however after a request to get the new image is finished, it redisplays the older image. Any ideas what needs to change to get it working?
ios
asihttprequest
null
null
null
null
open
how to get ASI to retrieve image from server if newer than cached image === I'm using ASI's cache for images. I'm running into an issue when the image is updated on the server but ASI does not retrieve the newer image and replace it in the cache. I've tried a few combinations of cache flags but I'm pretty sure I don't have the right combo of fields. This is the configuration. ASIDownloadCache * cache = [ASIDownloadCache sharedCache]; [cache setShouldRespectCacheControlHeaders:NO]; [self setDownloadCache:[ASIDownloadCache sharedCache]]; [self setCacheStoragePolicy:ASICachePermanentlyCacheStoragePolicy]; [self setCachePolicy:ASIAskServerIfModifiedCachePolicy| ASIOnlyLoadIfNotCachedCachePolicy| ASIFallbackToCacheIfLoadFailsCachePolicy]; My understanding is that it should: a) check if the image is updated on the server, if so the newer version is retrieved, used, and replaced in the cache b) if the server has old data and the cache has expired image, use expired image c) use cached image if request fails I've verified that the image is newer on the server, however after a request to get the new image is finished, it redisplays the older image. Any ideas what needs to change to get it working?
0
11,660,246
07/25/2012 23:33:41
994,585
10/14/2011 01:32:48
10
0
Magento Customers Cannot Login
I recently moved my Magento store to a new server and now customers are unable to login to their accounts. On the login page, when you enter the correct email and password, the page simply refreshes, with no message or anything. If you enter the wrong password, it will give you a message telling you so. This leads me to believe that it's a cookie/session issue (maybe the cookie is expiring immediately?) The problem is I have no idea how to go about fixing it... I have already cleared the var/cache and var/session folders, as well as my browser cache, with no success. Any tips or advice would be appreciated. P.S. I'm running Magento 6.2 on MageMojo.com hosting
session
magento
cookies
login
session-cookies
null
open
Magento Customers Cannot Login === I recently moved my Magento store to a new server and now customers are unable to login to their accounts. On the login page, when you enter the correct email and password, the page simply refreshes, with no message or anything. If you enter the wrong password, it will give you a message telling you so. This leads me to believe that it's a cookie/session issue (maybe the cookie is expiring immediately?) The problem is I have no idea how to go about fixing it... I have already cleared the var/cache and var/session folders, as well as my browser cache, with no success. Any tips or advice would be appreciated. P.S. I'm running Magento 6.2 on MageMojo.com hosting
0
11,660,247
07/25/2012 23:33:46
1,530,469
07/17/2012 02:26:27
1
0
Display db images using ContentFlow (coverflow) IllegalStateException error
I'm currently using a third party image coverflow (http://www.jacksasylum.eu/ContentFlow/) to display images which are being saved within a database. I'm using Java, JPA, and Richfaces for this. I have set up an image servlet to handle the image display. I have a Richfaces datatable set up and I only want to display images of selected records within the coverflow. This functionality is in place to do this. I have a command button to render the image coverflow within an OutputPanel. My images display correctly down the page without errors before implementing the coverflow. So, I know my underlying functionality works as desired. The issue is that when I implement the coverflow by placing specific div tags around my img tags as instructed I get the following error: Error Rendering View[/index.xhtml]: java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2636) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.Request.getSession(Request.java:2375) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:841) [jbossweb-7.0.10.Final.jar:] at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:155) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at javax.faces.context.ExternalContextWrapper.getSession(ExternalContextWrapper.java:396) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at com.sun.faces.renderkit.ServerSideStateHelper.writeState(ServerSideStateHelper.java:175) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:166) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:] at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_32] Here is some of my code: **ImgServlet.java** /** * Servlet implementation class ImgServlet */ @WebServlet(name = "ImgServlet", urlPatterns = {"/ImgServlet/*"}) public class ImgServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Inject Screenshot model; @PersistenceUnit(unitName = "primary") private EntityManagerFactory emf; public ImgServlet() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub PrintWriter writer = response.getWriter(); ServletContext sc = getServletContext(); String classString = "Screenshot"; String idString = request.getParameter("id"); if (classString == null || classString.isEmpty() || idString == null || idString.isEmpty()) { response.sendError(HttpServletResponse.SC_NOT_FOUND); // 404. return; } Long id = Long.parseLong(idString.trim()); PhotoInterface entry = null; EntityManager em = null; try { em = emf.createEntityManager(); } catch (Throwable e1) { e1.printStackTrace(); } try { entry = em.find(Screenshot.class, id); } catch (Exception ex) { //Log.log(ex.getMessage()); } if (entry == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); // 404. return; } ServletOutputStream out = null; try { response.reset(); // It works ok without setting any of these... //response.setContentType(image.getContentType()); //response.setHeader("Content-Length", String.valueOf(image.getLength())); //response.setHeader("Content-Disposition", "inline; filename=\"" + image.getName() + "\""); response.setContentType("image/png"); out = response.getOutputStream(); if (entry.getPng() != null && entry.getPng().length != 0) { out.write(entry.getPng()); getServletContext().log("Found png!!"); } else getServletContext().log("png is NULL!!!"); } catch (IOException e) { getServletContext().log("Error finding png!!!"); } finally { close(out); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } private static void close(Closeable resource) { if (resource != null) { try { resource.close(); } catch (IOException e) { // Do your thing with the exception. Print it, log it or mail it. } } } } **contentflow_src.js** - javascript used to render the coverflow and an example can be viewed at > http://www.jacksasylum.eu/ContentFlow/download.php **This currently works in my xhtml (without ContentFlow Div tags inside the outputPanel):** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:my="http://java.sun.com/jsf/composite/components" xmlns:s="http://jboss.com/products/seam/taglib" > <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <h:outputStylesheet name="screen.css" library="css"/> <script language="JavaScript" type="text/javascript" src="contentflow_src.js" load="slideshow lightbox"> </script> </h:head> <h:body> <h:form id="form"> <p:dataTable var="scrshot"> .................... .................... </p:dataTable> <p:commandButton id="viewDetails" value="View Selected Screenshots" icon="ui-icon-search" update=":form:imgBlock"/> <p:outputPanel id="imgBlock" layout="block"> <a4j:repeat var="img" value="#{screenshotListProducer.selectedScreenshots}"> <img src="ImgServlet?id=#{img.id}" title="#{img.time}"/> </a4j:repeat> </p:outputPanel> </h:form> </h:body> </ui:composition> </html> **This doesn't work in my xhtml (after implementing the ContentFlow by wrapping with the Div tags inside the outputPanel) and triggers the error:** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:my="http://java.sun.com/jsf/composite/components" xmlns:s="http://jboss.com/products/seam/taglib" > <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <h:outputStylesheet name="screen.css" library="css"/> <script language="JavaScript" type="text/javascript" src="contentflow_src.js" load="slideshow lightbox"> </script> </h:head> <h:body> <h:form id="form"> <p:dataTable var="scrshot"> .................... .................... </p:dataTable> <p:commandButton id="viewDetails" value="View Selected Screenshots" icon="ui-icon-search" update=":form:imgBlock"/> <p:outputPanel id="imgBlock" layout="block"> <div class="ContentFlow" id="ContentFlow"> <div class="flow"> <a4j:repeat var="img" value="#{screenshotListProducer.selectedScreenshots}"> <div class="item"> <img src="ImgServlet?id=#{img.id}" title="#{img.time}"/> </div> </a4j:repeat> </div> </div> </p:outputPanel> </h:form> </h:body> </ui:composition> </html> Sorry about all of the code. If anyone can help it will be greatly appreciated! I've gone in circles for days trying to get the ContentFlow to play nice with my session.
database
servlets
jpa
coverflow
illegalstateexception
null
open
Display db images using ContentFlow (coverflow) IllegalStateException error === I'm currently using a third party image coverflow (http://www.jacksasylum.eu/ContentFlow/) to display images which are being saved within a database. I'm using Java, JPA, and Richfaces for this. I have set up an image servlet to handle the image display. I have a Richfaces datatable set up and I only want to display images of selected records within the coverflow. This functionality is in place to do this. I have a command button to render the image coverflow within an OutputPanel. My images display correctly down the page without errors before implementing the coverflow. So, I know my underlying functionality works as desired. The issue is that when I implement the coverflow by placing specific div tags around my img tags as instructed I get the following error: Error Rendering View[/index.xhtml]: java.lang.IllegalStateException: Cannot create a session after the response has been committed at org.apache.catalina.connector.Request.doGetSession(Request.java:2636) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.Request.getSession(Request.java:2375) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:841) [jbossweb-7.0.10.Final.jar:] at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:155) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at javax.faces.context.ExternalContextWrapper.getSession(ExternalContextWrapper.java:396) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at com.sun.faces.renderkit.ServerSideStateHelper.writeState(ServerSideStateHelper.java:175) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:166) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.5-jbossorg-1.jar:2.1.5-SNAPSHOT] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.0.Final.jar:2.0.0.Final] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:] at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:] at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.0.Final.jar:7.1.0.Final] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.10.Final.jar:] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.10.Final.jar:] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.10.Final.jar:] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_32] Here is some of my code: **ImgServlet.java** /** * Servlet implementation class ImgServlet */ @WebServlet(name = "ImgServlet", urlPatterns = {"/ImgServlet/*"}) public class ImgServlet extends HttpServlet { private static final long serialVersionUID = 1L; @Inject Screenshot model; @PersistenceUnit(unitName = "primary") private EntityManagerFactory emf; public ImgServlet() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub PrintWriter writer = response.getWriter(); ServletContext sc = getServletContext(); String classString = "Screenshot"; String idString = request.getParameter("id"); if (classString == null || classString.isEmpty() || idString == null || idString.isEmpty()) { response.sendError(HttpServletResponse.SC_NOT_FOUND); // 404. return; } Long id = Long.parseLong(idString.trim()); PhotoInterface entry = null; EntityManager em = null; try { em = emf.createEntityManager(); } catch (Throwable e1) { e1.printStackTrace(); } try { entry = em.find(Screenshot.class, id); } catch (Exception ex) { //Log.log(ex.getMessage()); } if (entry == null) { response.sendError(HttpServletResponse.SC_NOT_FOUND); // 404. return; } ServletOutputStream out = null; try { response.reset(); // It works ok without setting any of these... //response.setContentType(image.getContentType()); //response.setHeader("Content-Length", String.valueOf(image.getLength())); //response.setHeader("Content-Disposition", "inline; filename=\"" + image.getName() + "\""); response.setContentType("image/png"); out = response.getOutputStream(); if (entry.getPng() != null && entry.getPng().length != 0) { out.write(entry.getPng()); getServletContext().log("Found png!!"); } else getServletContext().log("png is NULL!!!"); } catch (IOException e) { getServletContext().log("Error finding png!!!"); } finally { close(out); } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub } private static void close(Closeable resource) { if (resource != null) { try { resource.close(); } catch (IOException e) { // Do your thing with the exception. Print it, log it or mail it. } } } } **contentflow_src.js** - javascript used to render the coverflow and an example can be viewed at > http://www.jacksasylum.eu/ContentFlow/download.php **This currently works in my xhtml (without ContentFlow Div tags inside the outputPanel):** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:my="http://java.sun.com/jsf/composite/components" xmlns:s="http://jboss.com/products/seam/taglib" > <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <h:outputStylesheet name="screen.css" library="css"/> <script language="JavaScript" type="text/javascript" src="contentflow_src.js" load="slideshow lightbox"> </script> </h:head> <h:body> <h:form id="form"> <p:dataTable var="scrshot"> .................... .................... </p:dataTable> <p:commandButton id="viewDetails" value="View Selected Screenshots" icon="ui-icon-search" update=":form:imgBlock"/> <p:outputPanel id="imgBlock" layout="block"> <a4j:repeat var="img" value="#{screenshotListProducer.selectedScreenshots}"> <img src="ImgServlet?id=#{img.id}" title="#{img.time}"/> </a4j:repeat> </p:outputPanel> </h:form> </h:body> </ui:composition> </html> **This doesn't work in my xhtml (after implementing the ContentFlow by wrapping with the Div tags inside the outputPanel) and triggers the error:** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:my="http://java.sun.com/jsf/composite/components" xmlns:s="http://jboss.com/products/seam/taglib" > <h:head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <h:outputStylesheet name="screen.css" library="css"/> <script language="JavaScript" type="text/javascript" src="contentflow_src.js" load="slideshow lightbox"> </script> </h:head> <h:body> <h:form id="form"> <p:dataTable var="scrshot"> .................... .................... </p:dataTable> <p:commandButton id="viewDetails" value="View Selected Screenshots" icon="ui-icon-search" update=":form:imgBlock"/> <p:outputPanel id="imgBlock" layout="block"> <div class="ContentFlow" id="ContentFlow"> <div class="flow"> <a4j:repeat var="img" value="#{screenshotListProducer.selectedScreenshots}"> <div class="item"> <img src="ImgServlet?id=#{img.id}" title="#{img.time}"/> </div> </a4j:repeat> </div> </div> </p:outputPanel> </h:form> </h:body> </ui:composition> </html> Sorry about all of the code. If anyone can help it will be greatly appreciated! I've gone in circles for days trying to get the ContentFlow to play nice with my session.
0
11,660,250
07/25/2012 23:34:08
967,070
09/27/2011 12:50:47
144
9
jQuery DatePicker Not Working With jQuery 1.7.2
Not sure I can give much more detail, but datepicker is working fine with jQuery 1.4.2, but when including 1.7.2 the datepicker does not appear at all, with no javascript errors given. jQuery UI Core 1.8 is also included. Any known issues out there? Havent been able to find anything in my brief research. Thanks in advance.
jquery
jquery-ui
datepicker
null
null
null
open
jQuery DatePicker Not Working With jQuery 1.7.2 === Not sure I can give much more detail, but datepicker is working fine with jQuery 1.4.2, but when including 1.7.2 the datepicker does not appear at all, with no javascript errors given. jQuery UI Core 1.8 is also included. Any known issues out there? Havent been able to find anything in my brief research. Thanks in advance.
0
11,660,253
07/25/2012 23:34:17
105,562
05/12/2009 18:44:28
3,120
53
Deadlock on queue.pop - Ruby
This results in a: deadlock detected (fatal) error require 'thread' @queue = Queue.new x = @queue.pop Why doesn't this work?
ruby
null
null
null
null
null
open
Deadlock on queue.pop - Ruby === This results in a: deadlock detected (fatal) error require 'thread' @queue = Queue.new x = @queue.pop Why doesn't this work?
0
11,660,238
07/25/2012 23:31:39
125,212
06/18/2009 16:05:40
285
21
What is the proper command to encode a video for Google TV (Logitech revue) for streaming using mencoder
I am pretty new to Streaming but I have a nodeJS app up and streaming a video that I can see in my browser. It doesn't, however, work on the Google TV browser so I created a Simple Android App using the VideoView and setting the URL to the GET request location of the file. I can't seem to get it to work. I believe it is not properly encoded, because I can get it to work with this [url][1]. Can someone please give me the proper arguments to encode an HD MKV to a Google TV readable format? Preferably using mencoder or avconv, because I am on a linux PC. [Here][2] is the supported video format from Google. [1]: http://stackoverflow.com/questions/8575048/having-error-message-sorry-this-video-cant-play-to-play-online-video-in-video [2]: https://developers.google.com/tv/android/docs/gtv_media_formats
video
streaming
google-tv
null
null
null
open
What is the proper command to encode a video for Google TV (Logitech revue) for streaming using mencoder === I am pretty new to Streaming but I have a nodeJS app up and streaming a video that I can see in my browser. It doesn't, however, work on the Google TV browser so I created a Simple Android App using the VideoView and setting the URL to the GET request location of the file. I can't seem to get it to work. I believe it is not properly encoded, because I can get it to work with this [url][1]. Can someone please give me the proper arguments to encode an HD MKV to a Google TV readable format? Preferably using mencoder or avconv, because I am on a linux PC. [Here][2] is the supported video format from Google. [1]: http://stackoverflow.com/questions/8575048/having-error-message-sorry-this-video-cant-play-to-play-online-video-in-video [2]: https://developers.google.com/tv/android/docs/gtv_media_formats
0
11,226,685
06/27/2012 12:54:35
644,348
03/04/2011 08:28:06
3,231
206
Are instance variables considered harmful?
Lately, it seems that explicitly declared instance variables in Objective-C are considered a thing to avoid, with the preference being to use "private" (i.e., @implementation-local) properties. The last example of this is the WWDC '12 presentation on advances in Objective-C. What I haven't been able to find is a rationale for this preference, and I have searched a lot. Is there some crucial piece of documentation that I have missed, or is there a simple explanation that a kind soul could provide here?
objective-c
null
null
null
null
null
open
Are instance variables considered harmful? === Lately, it seems that explicitly declared instance variables in Objective-C are considered a thing to avoid, with the preference being to use "private" (i.e., @implementation-local) properties. The last example of this is the WWDC '12 presentation on advances in Objective-C. What I haven't been able to find is a rationale for this preference, and I have searched a lot. Is there some crucial piece of documentation that I have missed, or is there a simple explanation that a kind soul could provide here?
0
11,226,688
06/27/2012 12:54:41
1,431,292
06/01/2012 17:45:24
15
0
SNMP OID for network traffic
i'm working on a script that will monitor traffic on specific hosts from nagios. I have studied some scripts already made and have gathered almost all the info i need to do it but i have encountered a problem in identifying the OID's necessary for the traffic. I wanted to use `IF-MIB::ifOutOctets.1` and `IF-MIB::ifInOctets.1` to get the incoming and outgoing traffic but when i tested with the following line: snmpwalk -v 1 -c public myComputer OID i got the same result for both the OID's and that doesn't seem right. I'm wandering if there are other variables i could try instead of those i'm using now.
snmp
nagios
net-snmp
oid
mib
null
open
SNMP OID for network traffic === i'm working on a script that will monitor traffic on specific hosts from nagios. I have studied some scripts already made and have gathered almost all the info i need to do it but i have encountered a problem in identifying the OID's necessary for the traffic. I wanted to use `IF-MIB::ifOutOctets.1` and `IF-MIB::ifInOctets.1` to get the incoming and outgoing traffic but when i tested with the following line: snmpwalk -v 1 -c public myComputer OID i got the same result for both the OID's and that doesn't seem right. I'm wandering if there are other variables i could try instead of those i'm using now.
0
11,226,690
06/27/2012 12:54:44
1,173,588
01/27/2012 13:48:00
362
26
filling image button inside layout param: android
I am creating a simple toolbar using RelativeLayout and to a button image i am using following code, ImageButton back = new ImageButton(ctx.getContext()); RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); backLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL); back.setLayoutParams(backLayoutParams); back.setContentDescription("Back Button"); back.setId(2); try { back.setImageBitmap(loadDrawable("icon_left.png")); } catch (IOException e) { Log.e(LOG_TAG, e.getMessage(), e); } back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // } }); for adding it to the toolbar toolbar.addView(back); for toolbar i am using, RelativeLayout toolbar = new RelativeLayout(ctx.getContext()); toolbar.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,60)); Problem is that the button image doesnt FILLS inside layout param. i tried using setMargin it works, but it doesnot scales with various screen resolutions. ![enter image description here][1] Need directions on how to do this. [1]: http://i.stack.imgur.com/QT1Mh.png
android
android-layout
null
null
null
null
open
filling image button inside layout param: android === I am creating a simple toolbar using RelativeLayout and to a button image i am using following code, ImageButton back = new ImageButton(ctx.getContext()); RelativeLayout.LayoutParams backLayoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); backLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL); back.setLayoutParams(backLayoutParams); back.setContentDescription("Back Button"); back.setId(2); try { back.setImageBitmap(loadDrawable("icon_left.png")); } catch (IOException e) { Log.e(LOG_TAG, e.getMessage(), e); } back.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // } }); for adding it to the toolbar toolbar.addView(back); for toolbar i am using, RelativeLayout toolbar = new RelativeLayout(ctx.getContext()); toolbar.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,60)); Problem is that the button image doesnt FILLS inside layout param. i tried using setMargin it works, but it doesnot scales with various screen resolutions. ![enter image description here][1] Need directions on how to do this. [1]: http://i.stack.imgur.com/QT1Mh.png
0
11,226,691
06/27/2012 12:54:57
1,324,601
04/10/2012 16:44:21
141
3
How to change WCF project Platform Target to x86?
I wrote a project that uses third party project and I can only run it if the "Platform target" under "Build" under "Project Properties" is set to "X86" and NOT "Any CPU" in My project However when I'm trying to use this third party project with My WCF project, the "Platform Target" feature does not appear under the WCF Project properties and therefore it fails to run. Does anyone know how to set the "Platform Target" of a WCF project or how can I make the third party project run on "Any CPU" Thanks !
c#
wcf
visual-studio-2010
projects-and-solutions
platform
null
open
How to change WCF project Platform Target to x86? === I wrote a project that uses third party project and I can only run it if the "Platform target" under "Build" under "Project Properties" is set to "X86" and NOT "Any CPU" in My project However when I'm trying to use this third party project with My WCF project, the "Platform Target" feature does not appear under the WCF Project properties and therefore it fails to run. Does anyone know how to set the "Platform Target" of a WCF project or how can I make the third party project run on "Any CPU" Thanks !
0
11,226,614
06/27/2012 12:50:06
805,584
06/19/2011 17:42:59
264
21
datatables create filter checkbox
Does anyone have examples on how to create a datatables.net filter checkbox? I want to display only rows that have a value above X or below Y being controlled by a checkbox. Thanks!
datatable
datatables
datatables.net
null
null
null
open
datatables create filter checkbox === Does anyone have examples on how to create a datatables.net filter checkbox? I want to display only rows that have a value above X or below Y being controlled by a checkbox. Thanks!
0
11,226,694
06/27/2012 12:55:13
646,844
03/06/2011 11:15:06
371
20
git sudo user access denied
In my ternimal when I run git clone -q [email protected]:zzzz/yyyy/plat.git I am able to clone the project but if I run sudo git clone -q [email protected]:zzzz/yyyy/plat.git and give the correct password I get Permission denied (publickey). fatal: The remote end hung up unexpectedly any idea why is this ?
linux
ruby-on-rails-3
git
permissions
null
null
open
git sudo user access denied === In my ternimal when I run git clone -q [email protected]:zzzz/yyyy/plat.git I am able to clone the project but if I run sudo git clone -q [email protected]:zzzz/yyyy/plat.git and give the correct password I get Permission denied (publickey). fatal: The remote end hung up unexpectedly any idea why is this ?
0
11,226,698
06/27/2012 12:55:20
1,362,524
04/28/2012 07:11:26
13
1
Getting callback is undefined error in firebug console while creating a datasource using kendo ui
My webservice generates jsonp response same as http://demos.kendoui.com/service/products. When i try to create datasource for my webservice i am getting callback is not defined error in firebug console. Webservice response. callback([{"category":null,"productName":"Puma","productId":1,"quantity":0,"price":3000.0,"categoryId":1,"description":"ok"}]) But when i use kendo ui webservice (http://demos.kendoui.com/service/Products) i am getting a valid datasource. Code : $(document).ready(function() { var dataSource = new kendo.data.DataSource({ transport: { read: { //url: "http://demos.kendoui.com/service/products", url: "http://localhost:8080/mobile-services/rest/categories/1/products.json", dataType: "jsonp" } }, pageSize: 12 }); $("#pager").kendoPager({ dataSource: dataSource }); $("#listView").kendoListView({ dataSource: dataSource, template: kendo.template($("#template").html()) }); }); please suggest.
web-services
kendo-ui
null
null
null
null
open
Getting callback is undefined error in firebug console while creating a datasource using kendo ui === My webservice generates jsonp response same as http://demos.kendoui.com/service/products. When i try to create datasource for my webservice i am getting callback is not defined error in firebug console. Webservice response. callback([{"category":null,"productName":"Puma","productId":1,"quantity":0,"price":3000.0,"categoryId":1,"description":"ok"}]) But when i use kendo ui webservice (http://demos.kendoui.com/service/Products) i am getting a valid datasource. Code : $(document).ready(function() { var dataSource = new kendo.data.DataSource({ transport: { read: { //url: "http://demos.kendoui.com/service/products", url: "http://localhost:8080/mobile-services/rest/categories/1/products.json", dataType: "jsonp" } }, pageSize: 12 }); $("#pager").kendoPager({ dataSource: dataSource }); $("#listView").kendoListView({ dataSource: dataSource, template: kendo.template($("#template").html()) }); }); please suggest.
0
11,226,699
06/27/2012 12:55:27
713,867
04/18/2011 17:35:48
36
0
Showing percentage complete when doing ftp transfer?
Is there a way to show the percentage of transfer complete when doing a ftp transfer with get/put?
ftp
command
null
null
null
null
open
Showing percentage complete when doing ftp transfer? === Is there a way to show the percentage of transfer complete when doing a ftp transfer with get/put?
0
11,226,701
06/27/2012 12:55:29
358,794
06/04/2010 19:31:22
472
5
Property file path Eclipse vs Deployed Java Web App
I'm maintaining properties files containing database credentials in protected folders on our internal server for each app that I deploy. I'm not allowed to store the credentials within the WAR file. When testing on my PC the path is a windows mount, but when I depoloy to the server it is a unix path I have been handling the retreival as such //siteDbCedentialFolder obtained from web.xml Properties prop = new Properties(); InputStream in = null; try { //assume running on server first in = new FileInputStream("/abc/data/" + siteDbCedentialFolder + "/props.txt"); } catch (java.io.IOException ex) { // Probabaly Running locally in = new FileInputStream("W:/internal/abc/data/" + siteDbCedentialFolder + "/props.txt"); } catch (Exception xx) { xx.printStackTrace(); } prop.load(in); in.close(); is my approach to use a catch to get the local path OK or is there a better way to code this?
java
eclipse
path
null
null
null
open
Property file path Eclipse vs Deployed Java Web App === I'm maintaining properties files containing database credentials in protected folders on our internal server for each app that I deploy. I'm not allowed to store the credentials within the WAR file. When testing on my PC the path is a windows mount, but when I depoloy to the server it is a unix path I have been handling the retreival as such //siteDbCedentialFolder obtained from web.xml Properties prop = new Properties(); InputStream in = null; try { //assume running on server first in = new FileInputStream("/abc/data/" + siteDbCedentialFolder + "/props.txt"); } catch (java.io.IOException ex) { // Probabaly Running locally in = new FileInputStream("W:/internal/abc/data/" + siteDbCedentialFolder + "/props.txt"); } catch (Exception xx) { xx.printStackTrace(); } prop.load(in); in.close(); is my approach to use a catch to get the local path OK or is there a better way to code this?
0
11,226,702
06/27/2012 12:55:33
1,227,541
02/23/2012 05:33:08
3
0
what is stream and stream wrapper in php
As per my understanding about stream in php,Stream is an interface that provide methods for reading from and writing to a resource and this interface is implemented by different types of stream wrapper(http,ftp,file etc) for providing specific functionality. So When we say fopen() opens up stream,does it mean instantiation of a specific stream wrapper object. Please clarify me if i am wrong Thanks
php
file
stream
null
null
null
open
what is stream and stream wrapper in php === As per my understanding about stream in php,Stream is an interface that provide methods for reading from and writing to a resource and this interface is implemented by different types of stream wrapper(http,ftp,file etc) for providing specific functionality. So When we say fopen() opens up stream,does it mean instantiation of a specific stream wrapper object. Please clarify me if i am wrong Thanks
0
11,226,703
06/27/2012 12:55:47
1,468,601
06/20/2012 08:37:01
1
0
The remote server returned an error: (404) Not Found
I want to upload file to https server I have written the below code to upload file to https server. but its giving error : The remote server returned an error: (404) Not Found. MY code is as below. Check what is wrong in the code? try { using (WebClient webClient = new WebClient()) { webClient.Credentials = new NetworkCredential(username, password); string filePath = filepath; webClient.UploadFile(@"https://us.itranscript.net/Upload/test.txt", "PUT", filePath); webClient.Dispose(); } } catch (Exception err) { } Help me
c#-4.0
null
null
null
null
null
open
The remote server returned an error: (404) Not Found === I want to upload file to https server I have written the below code to upload file to https server. but its giving error : The remote server returned an error: (404) Not Found. MY code is as below. Check what is wrong in the code? try { using (WebClient webClient = new WebClient()) { webClient.Credentials = new NetworkCredential(username, password); string filePath = filepath; webClient.UploadFile(@"https://us.itranscript.net/Upload/test.txt", "PUT", filePath); webClient.Dispose(); } } catch (Exception err) { } Help me
0
11,226,704
06/27/2012 12:55:47
1,359,101
04/26/2012 15:33:46
6
0
Regex works in textwrangler but something isn't right in my ruby script
Could I get someone to punch holes in my script? My regex works fine to find urls in textwrangler but when I run my script the parseducc.txt file is putting bits and pieces of things on different lines. export = File.new("parseducc.txt" , "w+") File.open("uccdata.txt").each_line do |line| line.scan(/(([a-zA-Z0-9-])+\.)+([a-zA-Z]){3,4}/) do |x| export.puts x end end ## sample output ## >dhl-usa.<br> >a<br> >m<br> >upsfreight.<br> >t<br> >m<br> >fedex.<br> >x<br> >m<br> >myyellow.<br> >w<br> >m<br> My goal with this script is to scan through a file line by line and pull out the URLs and dump them one per line into a new output file. I have tried several variations of this script but clearly I am missing something. I'm guessing it is in my regex but I've used different variations of that which I found on regexlib.com and they displayed vary similar problems.
ruby
regex
script
null
null
null
open
Regex works in textwrangler but something isn't right in my ruby script === Could I get someone to punch holes in my script? My regex works fine to find urls in textwrangler but when I run my script the parseducc.txt file is putting bits and pieces of things on different lines. export = File.new("parseducc.txt" , "w+") File.open("uccdata.txt").each_line do |line| line.scan(/(([a-zA-Z0-9-])+\.)+([a-zA-Z]){3,4}/) do |x| export.puts x end end ## sample output ## >dhl-usa.<br> >a<br> >m<br> >upsfreight.<br> >t<br> >m<br> >fedex.<br> >x<br> >m<br> >myyellow.<br> >w<br> >m<br> My goal with this script is to scan through a file line by line and pull out the URLs and dump them one per line into a new output file. I have tried several variations of this script but clearly I am missing something. I'm guessing it is in my regex but I've used different variations of that which I found on regexlib.com and they displayed vary similar problems.
0
11,349,478
07/05/2012 17:30:35
1,277,137
03/18/2012 16:35:53
4
0
Some troubles while converting authors id to User model
My Post model have list of authors id class Post(Document): authors_id = ListField(IntField(required=True), required=True) But sometime I need to use default Django _User_ class. How most rapidly I can do it? (I'm using sqlite for users and sessions and MongoDB (mongoengine ODM) for other. Don't ask why:)) I was tried to write it: def get_authors(self): authors = list() for i in self.authors_id: authors.append(get_user(IntField.to_python(self.authors_id[i]))) return authors ...and it raises 'list index out of range' exception. (authors id not empty, really). What I'm doing wrong?
django
mongodb
mongoengine
null
null
null
open
Some troubles while converting authors id to User model === My Post model have list of authors id class Post(Document): authors_id = ListField(IntField(required=True), required=True) But sometime I need to use default Django _User_ class. How most rapidly I can do it? (I'm using sqlite for users and sessions and MongoDB (mongoengine ODM) for other. Don't ask why:)) I was tried to write it: def get_authors(self): authors = list() for i in self.authors_id: authors.append(get_user(IntField.to_python(self.authors_id[i]))) return authors ...and it raises 'list index out of range' exception. (authors id not empty, really). What I'm doing wrong?
0