Search Results

Search found 6433 results on 258 pages for 'trouble shooting'.

Page 21/258 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • Trouble with creating WPF window extended on the title area (like Office 2007/2010)

    - by Rikker Serg
    I want to make WPF window extended on the title area (like Office 2007/2010). I implemented DwmWindow (see DwmTest.zip) where I put required stuff. Commonly, it works fine except one disgusting thing: the window appears as white rectangle (see DwmIssue.png) and after a few second this rectangle disappears and the content of the window is shown (see DwmIssueCorrect.png). This bug is essential only for my window. If I remove this lines it works fine (without it aero will not showed on title): HwndSource mainWindowSrc = HwndSource.FromHwnd(handle); if (mainWindowSrc != null) mainWindowSrc.CompositionTarget.BackgroundColor = Colors.Transparent; NativeMethods.MARGINS margins = new NativeMethods.MARGINS(0, 50, 0, 0); NativeMethods.DwmExtendFrameIntoClientArea(handle, margins); How can I eliminate this white rectangle? (To run a sample DwmTest.zip WinVista/7 with DWM enabled and .NET 4.0 is required. To compile sample you will need Visual Studio 2010)

    Read the article

  • Trouble with pointers and references in C++

    - by KingNestor
    I have a PolygonList and a Polygon type, which are std::lists of Points or lists of lists of points. class Point { public: int x, y; Point(int x1, int y1) { x = x1; y = y1; } }; typedef std::list<Point> Polygon; typedef std::list<Polygon> PolygonList; // List of all our polygons PolygonList polygonList; However, I'm confused on reference variables and pointers. For example, I would like to be able to reference the first Polygon in my polygonList, and push a new Point to it. So I attempted to set the front of the polygonList to a Polygon called currentPolygon like so: Polygon currentPolygon = polygonList.front(); currentPolygon.push_front(somePoint); and now, I can add points to currentPolygon, but these changes end up not being reflected in that same polygon in the polygonList. Is currentPolygon simply a copy of the Polygon in the front of polygonList? When I later iterate over polygonList all the points I've added to currentPolygon aren't shown. It works if I do this: polygonList.front().push_front(somePoint); Why aren't these the same and how can I create a reference to the physical front polygon rather than a copy of it?

    Read the article

  • having trouble in mysql if statement

    - by user225269
    I just want to simplify what I am doing before, having multiple php files for all data to be listed. Here is my html form: <table border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D3D3D3"> <tr> <form name="formcheck" method="post" action="list.php" onsubmit="return formCheck(this);"> <td> <table border="0" cellpadding="3" cellspacing="1" bgcolor=""> <tr> <td colspan="16" height="25" style="background:#5C915C; color:white; border:white 1px solid; text-align: left"><strong><font size="3">List Students</td> </tr> <tr> <td width="30" height="35"><font size="3">*List:</td> <td width="30"><input name="specific" type="text" id="specific" maxlength="25" value=""> </td> <td><font size="3">*By:</td> <td> <select name="general" id="general"> <font size="3"> <option>Year</option> <option>Address</option> </select></td></td> </tr> <tr> <td width="10"><input align="right" type="submit" name="Submit" value="Submit" > </td> </tr> </form> </table> And here's the form action: <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $gyear= $_POST['general']; if ("YEAR"==$_POST['general']) { $result = mysql_query("SELECT * FROM student WHERE YEAR='{$_POST["specific"]}'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> <th>LASTNAME</th> <th>FIRSTNAME</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['YEAR'] . "</td>"; echo "<td>" . $row['LASTNAME'] . "</td>"; echo "<td>" . $row['FIRSTNAME'] . "</td>"; echo "</tr>"; } echo "</table>"; } mysql_close($con); ?> Please help, how do I equate the YEAR(column in mysql database) and the option box(general). if ("YEAR"==$_POST['general']) please correct me if I'm wrong.

    Read the article

  • trouble setting up anonymous login in ejabberd

    - by sofia
    Hi, In ejabberd.cfg I have the following {host_config, "thisislove-MacBook-2.local", [{auth_method, [internal, anonymous]}, {allow_multiple_connections, false}, {anonymous_protocol, both}]}. but when using speeqe javascript client (speeqe.com) to connect, I see it sends <body rid='1366284187' xmlns='http://jabber.org/protocol/httpbind' to='thisislove-macbook-2.local' xml:lang='en' wait='60' hold='1' window='5' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/> and the server responds with <body xmlns='http://jabber.org/protocol/httpbind' sid='f89bf034b02fa6b884bb0c55be3f1f69e45e3866' wait='60' requests='2' inactivity='30' maxpause='120' polling='2' ver='1.8' from='thisislove-macbook-2.local' secure='true' authid='353072658' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' xmpp:version='1.0'><stream:features xmlns:stream='http://etherx.jabber.org/streams'><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms><register xmlns='http://jabber.org/features/iq-register'/></stream:features></body> Notice the mechanisms, DIGEST-MD5 & PLAIN. If I'm not mistaken it should have ANONYMOUS as a mechanism as well. So what happens is that speeqe simply terminates the connection. As such I'm thinking i must be missing something in the anonymous configuration or the muc config. In the mod_muc configg, I have {mod_muc, [ %%{host, "conference.@HOST@"}, {access, muc}, {access_create, muc}, {access_persistent, muc}, {access_admin, muc_admin}, {max_room_name, 190}, {max_room_desc, 190}, {max_users, 500} ]} So what am I missing? Thanks

    Read the article

  • Trouble implementing Singleton pattern in Tomcat web application due to Class Loader

    - by jwegan
    I'm trying to implement a Singleton in Tomcat 6.24 on Linux with x86_64 OpenJDK 1.6. My application is just a bunch of JSPs and some static content and the JSPs make calls to my Java code. Currently the web.xml just looks like this: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <description> App Name </description> <display-name>App Name</display-name> <!-- The Usual Welcome File List --> <welcome-file-list> <welcome-file>pages/index.jsp</welcome-file> </welcome-file-list> </web-app> Before when I was trying to load my Singleton it was getting instantiated twice since the class was getting loaded by two different class loaders (I'm not sure why) and each loader would create an instance of the singleton which is not acceptable for my application. I finally figured out if I exported my code as a jar and put it in $CATALINA_HOME/lib then there was only one instance, but this is not an elegant solution. I've been googling for hours, but I haven't come up with anything yet. I'm wondering if there is some other solution. Currently I'm not precompling my JSPs, could this be part of the problem? Could I write a servlet to ensure the singleton is created? If so how do I do that?

    Read the article

  • Trouble adding Image to a JPanel

    - by user1276078
    I'm making a video game, and I need to add an image to a JPanel and then add that JPanel to a JFrame. All of the tutorials I've seen say to add it to a JLabel, but the image needs to be able to move around. Unless you can move a JLabel around, I can't do that. How would I be able to add an Image directly to a JPanel. This is what I have so far, but it is just like it was on a JApplet class Penguin extends JPanel { public Image image; public void paintComponent( Graphics g ) { image = getImage( getDocumentBase(), "Penguins.jpg" ); g.drawImage( image, 0, 0, this ); } }

    Read the article

  • Trouble determining onclick's target

    - by pwseo
    I've tried and tried... and I can't seem to make this work in IE (tested version 6) Can anybody help me? IE complains about an error but refuses to tell which error it is... var a = document.getElementsByTagName("a"); for (i = 0; i < a.length; i++) { if (a[i].getAttribute("class") == "info-link") { a[i].onclick = function(e) { e = e || window.event; var target = e.srcElement || e.target; var info = target.parentNode.getElementsByTagName("div")[0]; if (info.style.display == "none" || info.style.display == "") { info.style.display = "block"; } else { info.style.display = "none"; } return false; } } } <div class="auxdata"> <a href="#" class="info-link">Esta questão possuí dados anexos. Clique para ver.</a> <div style="display: none;" class="info-inner"> <!-- variable stuff here --> </div> </div>

    Read the article

  • Android: Having trouble creating a subclass of application to share data with multiple Activities

    - by Mike
    Hello, I just finished a couple of activities in my game and now I was going to start to wire them both up to use real game data, instead of the test data I was using just to make sure each piece worked. Since multiple Activities will need access to this game data, I started researching the best way to pass this data to my Activities. I know about using putExtra with intents, but my GameData class has quite a bit of data and not just simple key value pairs. Besides quite a few basic data types, it also has large arrays. I didn't really want to try and pass all that, unless I can pass the entire object, instead of just key/data pairs. I read the following post and thought it would be the way to go, but so far, I haven't got it to work. Android: How to declare global variables? I created a simple test app to try this method out, but it keeps crashing and my code seems to look the same as in the post above - except I changed the names. Here is the error I am getting. Can someone help me understand what I am doing wrong? 12-23 00:50:49.762: ERROR/AndroidRuntime(608): Caused by: java.lang.ClassCastException: android.app.Application It crashes on the following statement: GameData newGameData = ((GameData)getApplicationContext()); Here is my code: package mrk.examples.StaticGameData; import android.app.Application; public class GameData extends Application { private int intTest; GameData () { intTest = 0; } public int getIntTest(){ return intTest; } public void setIntTest(int value){ intTest = value; } } // My main activity package mrk.examples.StaticGameData; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; public class StaticGameData extends Activity { int intStaticTest; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); GameData newGameData = ((GameData)getApplicationContext()); newGameData.setIntTest(0); intStaticTest = newGameData.getIntTest(); Log.d("StaticGameData", "Well: IntStaticTest = " + intStaticTest); newGameData.setIntTest(1); Log.d("StaticGameData", "Well: IntStaticTest = " + intStaticTest + " newGameData: " + newGameData.getIntTest()); Intent intentNew = new Intent(this, PassData2Activity.class); startActivity (intentNew); } } // My test Activity to see if it can access the data and its previous state from the last activity package mrk.examples.StaticGameData; import android.app.Activity; import android.os.Bundle; import android.util.Log; public class PassData2Activity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); GameData gamedataPass = ((GameData)getApplicationContext()); Log.d("PassData2Activity", "IntTest = " + gamedataPass.getIntTest()); } } Below is the relevant portion of my manifest: <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".StaticGameData" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".PassData2Activity"></activity> </application> <application android:name=".GameData" android:icon="@drawable/icon" android:label="@string/app_name"> </application> Thanks in advance for helping me understand why this code is crashing. Also, if you think this is just the wrong approach to let multiple activities have access to the same data, please give your suggestion. Please keep in mind that I am talking about quite a few variables and some large arrays.

    Read the article

  • Trouble dragging and dropping gui components onto other .net forms using NHibernate

    - by IsaacB
    Hi, using VS2008, here. I have a GUI component that loads some stuff from a database mapped by nhibernate in its constructor. When I drag and drop this component onto another form from the toolbox, NHibernate complains that it can't find the config file in program files\visual studio 9\common7\ide. Why is it looking here for the cfg file? I'm actually calling database stuff through another project in the same solution, and the cfg file is located at the root of that project. copy/pasting the cfg file over to there does work, but I'm working with svn here and I don't want to have configuration files outside the repository. Something else that would help would be turning off how it tries to load the data in the form design screen. How would I do that?

    Read the article

  • Trouble with Canvas rendering in Safari/Opera

    - by Jon
    Been banging my head against this one for a while, and figured I'd turn to the experts for some advice. I've made a jQuery snippet that grabs the values from a table and plots them in a line graph on a canvas element (also generated by the JS). All's well in Firefox and Chrome, but Safari and Opera aren't displaying the plotted points. I've reviewed in Firebug, Web Inspector debugger, JSLint, and checked the markup with the w3 validator, but still can't find anything glaringly obvious. Any chance one of you guys could help me out? Here's a page with a simplified example: http://bit.ly/aAshPQ Thanks!

    Read the article

  • ASP.NET MVC Viewmodel trouble...

    - by ile
    I've already started similar topic, but still didn't find final solution... So here I am with new one :) ... I'm developing NerdDinner from scratch and now I came to point where I define DinnerViewModel. Following these instructions (starting from Listing 5) I came to this: namespace Nerd.Controllers { // View Model Classes public class DinnerViewModel { public DinnerViewModel(List<Dinner> dinners) { this.Dinners = dinners; } public List<Dinner> Dinners { get; private set; } } public class DinnerController : Controller { private DinnerRepository dinnerRepository = new DinnerRepository(); .... public ActionResult NewDinners() { // Create list of products var dinners = new List<Dinner>(); dinners.Add(new Dinner(/*Something to add*/)); // Return view return View(new DinnerViewModel(dinners)); } } } Also, the Dinner table in this new version of NerdDinner is a bit shortened (it contains of DinnerID, Title, EventDate and Description fields). No matter what I try to add here dinners.Add(new Dinner(/*Something to add*/)); I always get following error Error 1 'Nerd.Model.Dinner' does not contain a constructor that takes '1' arguments C:\Documents and Settings\ilija\My Documents\Visual Studio 2008\Projects\Nerd\Nerd\Controllers\DinnerController.cs 150 25 Nerd Because I'm total beginner in C# and generally OOP, I have no idea what to do here... I suppose I need to declare a constructor, but how and where exactly? Thanks, Ile

    Read the article

  • Trouble adding success flag to onbeforeunload

    - by Dirty Bird Design
    having issues with onbeforeunload. I have a long form broken into segments via a jquery wizard plug in. I need to pop a confirm dialog if you hit back, refresh, close etc on any step but need it to NOT POP the confirm dialog on click of the submit button. had it working, or at least I thought, it doesn't now. <script type="text/javascript"> var okToSubmit = false; window.onbeforeunload = function() { document.getElementById('Register').onclick = function() { okToSubmit = true; }; if(!okToSubmit) return "Using the browsers back button will cause you to lose all form data. Please use the Next and Back buttons on the form"; }; </script> 'Register' is the submit button ID. Please help!

    Read the article

  • Trouble with setting entry point for GWT service

    - by Xorty
    Hello. I've followed serveral tutorials and read official docs at code.google.com, but still didn't manage to resolve this thing. I am creating simple service that'll check if user can be logged. CLIENT SIDE: public interface LoginService extends RemoteService { /** * Checks, if user has valid login. * @param user User's login. * @return True if such a login is in the database. */ boolean isValidUser(User user); } And here is Async interface: public interface LoginServiceAsync { /** * Checks, if user has valid login. * @param user User's login. * @param callback the callback to return True if such a login is in the database. */ void isValidUser(User user, AsyncCallback<Boolean> callback); } SERVER SIDE: public class LoginServiceImpl extends RemoteServiceServlet implements LoginService { /** * serial version UID */ private static final long serialVersionUID = 1044980345057997696L; /**{@inheritDoc} */ @Override public boolean isValidUser(User user) { boolean success = true; //TODO change } } Now I have entry point class MailClient.java. I append here widget like: CustomWidgets.getLoginWidget(this); // access rootPanel and append widget Now I need to make actual call to my service, and here is problem: LoginServiceAsync loginService = (LoginServiceAsync) GWT.create(LoginService.class); User user = new User(boxName.getText(), boxPassword.getText()); AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() { @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); //TODO change } @Override public void onSuccess(Boolean result) { Window.alert("success"); //TODO change } }; ((ServiceDefTarget) loginService).setServiceEntryPoint(GWT.getModuleBaseURL()+"login"); // dunno what should be here So to recap, I don't know how to set service's entry point. Here's my MailClient.gwt.xml file: <module> <inherits name="com.google.gwt.user.User"/> <inherits name="com.google.gwt.user.theme.standard.Standard"/> <entry-point class="com.xorty.mailclient.client.MailClient"/> <servlet path="/login" class="com.xorty.mailclient.server.servlets.LoginServiceImpl" /> <inherits name="com.xorty.mailclient.MailClient"/> <inherits name="com.xorty.mailclient.MailClient"/> <inherits name="com.xorty.mailclient.MailClient"/> <inherits name="com.xorty.mailclient.MailClient"/> <inherits name="com.xorty.mailclient.MailClient"/> </module> My web.xml file: <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <!-- Default page to serve --> <welcome-file-list> <welcome-file>MailClient.html</welcome-file> </welcome-file-list> <servlet> <servlet-name>LoginService</servlet-name> <servlet-class>com.xorty.mailclient.server.servlets.LoginServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>LoginService</servlet-name> <url-pattern>/com.xorty.mailclient.MailClient/login</url-pattern> </servlet-mapping> </web-app> And here is screenshot of project structure:

    Read the article

  • Trouble getting email attachment from Exchange

    - by JimR
    I am getting the error message “The remote server returned an error: (501) Not Implemented.” when I try to use the HttpWebRequest.GetResponse() using the GET Method to get an email attachment from exchange. I have tried to change the HttpVersion and don’t think it is a permissions issue since I can search the inbox. I know my credentials are correct as they are used to get HREF using the HttpWebRequest.Method = Search on the inbox (https://mail.mailserver.com/exchange/testemailaccount/Inbox/). HREF = https://mail.mailserver.com/exchange/testemailaccount/Inbox/testemail.EML/attachment.csv Sample Code: HttpWebRequest req = (System.Net.HttpWebRequest) HttpWebRequest.CreateHREF); req.Method = "GET"; req.Credentials = this.mCredentialCache; string data = string.Empty; using (WebResponse resp = req.GetResponse()) { Encoding enc = Encoding.Default; if (resp == null) { throw new Exception("Response contains no information."); } using (StreamReader sr = new StreamReader(resp.GetResponseStream(), Encoding.ASCII)) { data = sr.ReadToEnd(); } }

    Read the article

  • Properties are making trouble

    - by DhavalR
    In my application I have added a Properties.cs file which contains properties that I am would use through out the application. I am getting NullReferenceException = Object reference not set to an instance of an object. Here is the code for Properties.cs public class Properties { private static string type1; public static string Type1 { get { return type1; } set { type1= value; } } } And when I access this property in one of my form I am getting error. e.g. if (Properties.Type1.Equals(string.Empty) || Properties.Type1.Equals(null)) { //// Do something }

    Read the article

  • Trouble using South with Django and Heroku

    - by Dan
    I had an existing Django project that I've just added South to. I ran syncdb locally. I ran manage.py schemamigration app_name locally I ran manage.py migrate app_name --fake locally I commit and pushed to heroku master I ran syncdb on heroku I ran manage.py schemamigration app_name on heroku I ran manage.py migrate app_name on heroku I then receive this: $ heroku run python notecard/manage.py migrate notecards Running python notecard/manage.py migrate notecards attached to terminal... up, run.1 Running migrations for notecards: - Migrating forwards to 0005_initial. > notecards:0003_initial Traceback (most recent call last): File "notecard/manage.py", line 14, in <module> execute_manager(settings) File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/app/lib/python2.7/site-packages/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "/app/lib/python2.7/site-packages/django/core/management/base.py", line 220, in execute output = self.handle(*args, **options) File "/app/lib/python2.7/site-packages/south/management/commands/migrate.py", line 105, in handle ignore_ghosts = ignore_ghosts, File "/app/lib/python2.7/site-packages/south/migration/__init__.py", line 191, in migrate_app success = migrator.migrate_many(target, workplan, database) File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 221, in migrate_many result = migrator.__class__.migrate_many(migrator, target, migrations, database) File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 292, in migrate_many result = self.migrate(migration, database) File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 125, in migrate result = self.run(migration) File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 99, in run return self.run_migration(migration) File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 81, in run_migration migration_function() File "/app/lib/python2.7/site-packages/south/migration/migrators.py", line 57, in <lambda> return (lambda: direction(orm)) File "/app/notecard/notecards/migrations/0003_initial.py", line 15, in forwards ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), File "/app/lib/python2.7/site-packages/south/db/generic.py", line 226, in create_table ', '.join([col for col in columns if col]), File "/app/lib/python2.7/site-packages/south/db/generic.py", line 150, in execute cursor.execute(sql, params) File "/app/lib/python2.7/site-packages/django/db/backends/util.py", line 34, in execute return self.cursor.execute(sql, params) File "/app/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 44, in execute return self.cursor.execute(query, args) django.db.utils.DatabaseError: relation "notecards_semester" already exists I have 3 models. Section, Semester, and Notecards. I've added one field to the Notecards model and I cannot get it added on Heroku. Thank you.

    Read the article

  • Trouble with a sequential search algorithm

    - by shinjuo
    I need to use this sequential search algorithm, but I am not really sure how. I need to use it with an array. Can someone point me in the correct direction or something on how to use this. bool seqSearch (int list[], int last, int target, int* locn){ int looker; looker = 0; while(looker < last && target != list[looker]){ looker++; } *locn = looker; return(target == list[looker]); }

    Read the article

  • Trouble passing a string as a SQLite ExecSQL command

    - by Hackbrew
    I keep getting the ERROR: near "PassWord": syntax error when trying to execute the ExecSQL() statement. The command looks good in the output of the text file. In fact, I copied & pasted the command directly into SQLite Database Browser and the commend executed properly. Here's the code that's producing the error: procedure TForm1.Button1Click(Sender: TObject); var i, iFieldSize: integer; sFieldName, sFieldType, sFieldList, sExecSQL: String; names: TStringList; f1: Textfile; begin //Open Source table - Table1 has 8 fields but has only two different field types ftString and Boolean Table1.TableName:= 'PWFile'; Table1.Open; //FDConnection1.ExecSQL('drop table PWFile'); sFieldList := ''; names := TStringList.Create; for i := 0 to Table1.FieldCount - 1 do begin sFieldName := Table1.FieldDefList.FieldDefs[i].Name; sFieldType := GetEnumName(TypeInfo(TFieldType),ord(Table1.FieldDefList.FieldDefs[i].DataType)); iFieldSize := Table1.FieldDefList.FieldDefs[i].Size; if sFieldType = 'ftString' then sFieldType := 'NVARCHAR' + '(' + IntToStr(iFieldSize) + ')'; if sFieldType = 'ftBoolean' then sFieldType := 'INTEGER'; names.Add(sFieldName + ' ' + sFieldType); if sFieldList = '' then sFieldList := sFieldName + ' ' + sFieldType else sFieldList := sFieldList + ', ' + sFieldName + ' ' + sFieldType; end; ListBox1.Items.Add(sFieldList); sExecSQL := 'create table IF NOT EXISTS PWFile (' + sFieldList + ')'; // 08/18/2014 - Entered this to log the SQLite FDConnection1.ExecSQL Command to a file AssignFile(f1, 'C:\Users\Test User\Documents\SQLite_Command.txt'); Rewrite(f1); Writeln(f1, sExecSQL); { insert code here that would require a Flush before closing the file } Flush(f1); { ensures that the text was actually written to file } CloseFile(f1); FDConnection1.ExecSQL(sFieldList); Table1.Close; end; Here's the actual command that gets executed: create table IF NOT EXISTS PWFile (PassWord NVARCHAR(10), PassName NVARCHAR(10), Dept NVARCHAR(10), Active NVARCHAR(1), Admin INTEGER, Shred INTEGER, Reports INTEGER, Maintain INTEGER)

    Read the article

  • having trouble with jpa, looks to be reading from cache when told to ignore

    - by jeff
    i'm using jpa and eclipselink. it says version 2.0.2.v20100323-r6872 for eclipselink. it's an SE application, small. local persistence unit. i am using a postgres database. i have some code the wakes up once per second and does a jpa query on a table. it's polling to see whether some fields on a given record change. but when i update a field in sql, it keeps showing the same value each time i query it. and this is after waiting, creating a new entitymanager, and giving a query hint. when i query the table from sql or python, i can see the changed field. but from within my jpa query, once i've read the value, it never changes in later executions of the query -- even though the entity manager has been recreated. i've tried telling it to not look in the cache. but it seems to ignore that. very puzzling, can you help please? here is the method. i call this once every 3 seconds. the tgt.getTrlDlrs() println shows me i get the same value for this field on every call of the method ("value won't change"). even if i change the field in the database. when i query the record from outside java, i see the change right away. also, if i stop the java program and restart it, i see the new value printed out immediately: public void exitChk(EntityManagerFactory emf, Main_1 mn){ // this will be a list of the trade close targets that are active List<Pairs01Tradeclosetgt> mn_res = new ArrayList<Pairs01Tradeclosetgt>(); //this is a list of the place number in the array list above //of positions to close ArrayList<Integer> idxsToCl = new ArrayList<Integer>(); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); em.clear(); String qryTxt = "SELECT p FROM Pairs01Tradeclosetgt p WHERE p.isClosed = :isClosed AND p.isFilled = :isFilled"; Query qMn = em.createQuery(qryTxt); qMn.setHint(QueryHints.CACHE_USAGE, CacheUsage.DoNotCheckCache); qMn.setParameter("isClosed", false); qMn.setParameter("isFilled", true); mn_res = (List<Pairs01Tradeclosetgt>) qMn.getResultList(); // are there any trade close targets we need to check for closing? if (mn_res!=null){ //if yes, see whether they've hit their target for (int i=0;i<mn_res.size();i++){ Pairs01Tradeclosetgt tgt = new Pairs01Tradeclosetgt(); tgt = mn_res.get(i); System.out.println("value won't change:" + tgt.getTrlDlrs()); here is my entity class (partial): @Entity @Table(name = "pairs01_tradeclosetgt", catalog = "blah", schema = "public") @NamedQueries({ @NamedQuery(name = "Pairs01Tradeclosetgt.findAll", query = "SELECT p FROM Pairs01Tradeclosetgt p"), @NamedQuery(name = "Pairs01Tradeclosetgt.findByClseRatio", query = "SELECT p FROM Pairs01Tradeclosetgt p WHERE p.clseRatio = :clseRatio")}) public class Pairs01Tradeclosetgt implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "id") @SequenceGenerator(name="pairs01_tradeclosetgt_id_seq", allocationSize=1) @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "pairs01_tradeclosetgt_id_seq") private Integer id; and my persitence unit: <?xml version="1.0" encoding="UTF-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="testpu" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>mourv02.Pairs01Quotes</class> <class>mourv02.Pairs01Pair</class> <class>mourv02.Pairs01Trderrs</class> <class>mourv02.Pairs01Tradereq</class> <class>mourv02.Pairs01Tradeclosetgt</class> <class>mourv02.Pairs01Orderstatus</class> <properties> <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://192.168.1.80:5432/blah"/> <property name="javax.persistence.jdbc.password" value="secret"/> <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/> <property name="javax.persistence.jdbc.user" value="noone"/> </properties> </persistence-unit> </persistence>

    Read the article

  • PyGTK: Trouble with size of ScrolledWindow

    - by canavanin
    Hi everyone! I am using PyGTK and the gtk.Assistant. On one page I have placed a treeview (one column, just strings) in a gtk.ScrolledWindow (I wanted the vertical scrollbar, since the list contains about 35 items). Everything is working fine; the only thing that bugs me is that I have not been able to figure out from the documentation how to set the size of the scrolled window. Currently only three items are displayed at a time; I would like to set this number to 10 or so. Below is the code. As you can see I have tried using a gtk.Adjustment to influence the scrolled window's size, but as - once more - I have been incompetent at retrieving the required info from the documentation, I don't actually know what values should be put into there. self.page7 = gtk.VBox() # The gtk.Adjustment: page_size = gtk.Adjustment(lower=10, page_size=100) # just used some arbitrary numbers here >_< scrolled_win = gtk.ScrolledWindow(page_size) scrolled_win.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) # only display scroll bars when required self.character_traits_treeview = gtk.TreeView() self.character_traits_treestore = gtk.TreeStore(str) self.character_traits_treeview.set_model(self.character_traits_treestore) tc = gtk.TreeViewColumn("Character traits") self.character_traits_treeview.append_column(tc) cr = gtk.CellRendererText() tc.pack_start(cr, True) tc.add_attribute(cr, "text", 0) self.character_trait_selection = self.character_traits_treeview.get_selection() self.character_trait_selection.connect('changed', self.check_number_of_character_trait_selections) self.character_trait_selection.set_mode(gtk.SELECTION_MULTIPLE) self.make_character_traits_treestore() # adding the treeview to the scrolled window: scrolled_win.add(self.character_traits_treeview) self.page7.pack_start(scrolled_win, False, False, 0) self.assistant.append_page(self.page7) self.assistant.set_page_title(self.page7, "Step 7: Select 2-3 character traits") self.assistant.set_page_type(self.page7, gtk.ASSISTANT_PAGE_CONTENT) self.assistant.set_page_complete(self.page7, False) def check_number_of_character_trait_selections(self, blah): # ... def make_character_traits_treestore(self): # ... I know I should RTFM, but as I can't make head or tail of it, and as further searching, too, has been to no avail, I'm just hoping that someone on here can give me a hint. Thanks a lot in advance! PS: Here are the links to: the gtk.ScrolledWindow documentation the gtk.Adjustment documentation

    Read the article

  • Trouble with Code First DatabaseGenerated Composite Primary Key

    - by Nick Fleetwood
    This is a tad complicated, and please, I know all the arguments against natural PK's, so we don't need to have that discussion. using VS2012/MVC4/C#/CodeFirst So, the PK is based on the date and a corresponding digit together. So, a few rows created today would be like this: 20131019 1 20131019 2 And one created tomorrow: 20131020 1 This has to be automatically generated using C# or as a trigger or whatever. The user wouldn't input this. I did come up with a solution, but I'm having problems with it, and I'm a little stuck, hence the question. So, I have a model: public class MainOne { //[Key] //public int ID { get; set; } [Key][Column(Order=1)] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string DocketDate { get; set; } [Key][Column(Order=2)] [DatabaseGenerated(DatabaseGeneratedOption.None)] public string DocketNumber { get; set; } [StringLength(3, ErrorMessage = "Corp Code must be three letters")] public string CorpCode { get; set; } [StringLength(4, ErrorMessage = "Corp Code must be four letters")] public string DocketStatus { get; set; } } After I finish the model, I create a new controller and views using VS2012 scaffolding. Then, what I'm doing is debugging to create the database, then adding the following instead of trigger after Code First creates the DB [I don't know if this is correct procedure]: CREATE TRIGGER AutoIncrement_Trigger ON [dbo].[MainOnes] instead OF INSERT AS BEGIN DECLARE @number INT SELECT @number=COUNT(*) FROM [dbo].[MainOnes] WHERE [DocketDate] = CONVERT(DATE, GETDATE()) INSERT INTO [dbo].[MainOnes] (DocketDate,DocketNumber,CorpCode,DocketStatus) SELECT (CONVERT(DATE, GETDATE ())),(@number+1),inserted.CorpCode,inserted.DocketStatus FROM inserted END And when I try to create a record, this is the error I'm getting: The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: The object state cannot be changed. This exception may result from one or more of the primary key properties being set to null. Non-Added objects cannot have null primary key values. See inner exception for details. Now, what's interesting to me, is that after I stop debugging and I start again, everything is perfect. The trigger fired perfectly, so the composite PK is unique and perfect, and the data in other columns is intact. My guess is that EF is confused by the fact that there is seemingly no value for the PK until AFTER an insert command is given. Also, appearing to back this theory, is that when I try to edit on of the rows, in debug, I get the following error: The number of primary key values passed must match number of primary key values defined on the entity. Same error occurs if I try to pull the 'Details' or 'Delete' function. Any solution or ideas on how to pull this off? I'm pretty open to anything, even creating a hidden int PK. But it would seem redundant. EDIT 21OCT13 [HttpPost] public ActionResult Create(MainOne mainone) { if (ModelState.IsValid) { var countId = db.MainOnes.Count(d => d.DocketDate == mainone.DocketNumber); //assuming that the date field already has a value mainone.DocketNumber = countId + 1; //Cannot implicitly convert type int to string db.MainOnes.Add(mainone); db.SaveChanges(); return RedirectToAction("Index"); } return View(mainone); } EDIT 21OCT2013 FINAL CODE SOLUTION For anyone like me, who is constantly searching for clear and complete solutions. if (ModelState.IsValid) { String udate = DateTime.UtcNow.ToString("yyyy-MM-dd"); mainone.DocketDate = udate; var ddate = db.MainOnes.Count(d => d.DocketDate == mainone.DocketDate); //assuming that the date field already has a value mainone.DocketNumber = ddate + 1; db.MainOnes.Add(mainone); db.SaveChanges(); return RedirectToAction("Index"); }

    Read the article

  • facebook authentication / login trouble

    - by salmane
    I have setup facebook authentication using php and it goes something like this first getting the authorization here : https://graph.facebook.com/oauth/authorize?client_id=<?= $facebook_app_id ?>&redirect_uri=http://www.example.com/facebook/oauth/&scope=user_about_me,publish_stream then getting the access Token here : $url = "https://graph.facebook.com/oauth/access_token?client_id=".$facebook_app_id."&redirect_uri=http://www.example.com/facebook/oauth/&client_secret=".$facebook_secret."&code=".$code;" function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } $access_token = get_string_between(file_get_contents($url), "access_token=", "&expires="); then getting user info : $facebook_user = file_get_contents('https://graph.facebook.com/me?access_token='.$access_token); $facebook_id = json_decode($facebook_user)->id; $first_name = json_decode($facebook_user)->first_name; $last_name = json_decode($facebook_user)->last_name; this is pretty ugly ( in my opinion ) but it works....how ever....the user is still not logged in...because i did not create or retrieve any session variables to confirm that the user is logged in to facebook... which means that after getting the authentication done the use still has to login .... first: is there a better way using php to do what i did above ? second: how do i set/ get session variable / cookies that ensure that the user doesnt have to click login thanks for your help

    Read the article

  • Trouble decoding JSON string with PHP

    - by Anthony
    I'm trying to send an array of objects from JS to PHP using JSON. I have an array of players as follows: var player; var players = new Array(); //loop for number of players player = new Object(); player.id = theID; players[i] = player; Then my AJAX call looks like this: JSONplayers = JSON.stringify(players); $.ajax({ type: "POST", url: "php/ajax_send_players.php", data: { "players" : JSONplayers } On the PHP side the decode function looks like this $players = $_REQUEST['players']; echo var_dump($players); $players = json_decode($players); echo 'players: ' .$players. '--'. $players[0] . '--'. $players[0]->id; Debugging in chrome, the JSON players var looks like this before it is sent: JSONplayers: "[{"id":"Percipient"},{"id":"4"}]" And when I vardump in PHP it looks OK, giving this: string(40) "[{\"id\":\"Percipient\"},{\"id\":\"4\"}]" But I can't access the PHP array, and the echo statement about starting with players: outputs this: players: ---- Nothing across the board...maybe it has something to do with the \'s in the array, I am new to this and might be missing something very simple. Any help would be greatly appreciated. note I've also tried json_decode($players, true) to get it as an assoc array but get similar results.

    Read the article

  • php error reporting - having trouble matching local & web server settings

    - by Andrew Heath
    I'm trying to add a custom error handler to my site, but in doing so have discovered that my webhost's PHP error reporting settings and those of my localhost (default XAMPP) vary considerably. While I thought I was programming to E_STRICT like a good little boy, adding the error handler to my webhost revealed craploads of Runtime Notices. Example: Runtime notice strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Chicago' for 'CST/-6.0/no DST' instead In /home/... Clearly this isn't a red-alert, showstopping error. But what bothers me is that it doesn't show up on my localhost. I'd certainly like to improve my code by addressing these sorts of issues if I could see them! I've looked through both php.ini files, and my webhost's setting is error_reporting = E_ALL & ~E_NOTICE whereas mine was error_reporting = E_STRICT, which I had thought was better. However, changing mine to match and rebooting the server doesn't seem to have accomplished anything. Could someone please point me in the right direction?

    Read the article

  • Having trouble hiding keyboard using invisible button which sits on top of uiscrollview

    - by phil
    I have 3 items in play... 1) UIView sits at the base of the hierarchy and contains the UIScrollview. 2) UIScrollview that is presenting a lengthy user form. 3) An invisible button on the UIScrollview that I'm using to provide "hide the keyboard" features. Notice in the code below that I'm registering to be notified when the keyboard is going to appear and again when it's going to disappear. These are working great. My problem is seemingly one of "layers". See below where I insert the button into the view atIndex:0. This causes the button to be activated and "stuffed" behind the scrollview so that when you click on it, the scrollview grabs the touch and the button is unaware. There is no way to "reach" the button and suppress the keyboard. However, if I insert atIndex:1, the button gets super imposed on top of the text entry fields and so any touch at all is acted upon by the button, which immediately suppresses the keyboard and then disappears. How do I insert the button on top of the UIScrollview but behind the UITextfields that sit there? other logistics: I have a -(void) hidekeyboard function that I have setup with the UIButtion as an IBAction(). And I have the UIButton connected to "files owner" via a ctrl-drag/drop. (Do I need both of those conventions?) This code in ViewDidLoad()... [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification object:nil queue:nil usingBlock:^(NSNotification *notification){ [self.view insertSubview:self.keyboardDismissalButton atIndex:0]; }];

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >