Daily Archives

Articles indexed Thursday September 13 2012

Page 3/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Problems with Ubuntu and AMD A10-4655M APU

    - by Robert Hanks
    I have a new HP Sleekbook 6z with AMD A10-4655M APU. I tried installing Ubuntu with wubi--the first attempt ended up with a 'AMD unsupported hardware' watermark that I wasn't able to remove (the appeared when I tried to update the drivers as Ubuntu suggested) On the second attempted install Ubuntu installed (I stayed away from the suggested drivers) but the performance was extremely poor----as in Windows Vista poor. I am not sure what the solution is--if I need to wait until there is a kernel update with Ubuntu or if there are other solutions--I realise this is a new APU for the market. I would love to have Ubuntu 12.04 up and running--Windows 7 does very well with this new processor so Ubuntu should, well, be lightening speed. The trial on the Sleekbook with Ubuntu 12.10 Alpha 2 release was a complete failure. I created a bootable USB. By using either the 'Try Ubuntu' or 'Install Ubuntu' options resulted in the usual purple Ubuntu splash screen, followed by nothing...as in a black screen without any hint of life. Interestingly one can hear the Ubuntu intro sound. In case you are wondering, this same USB was trialed subsequently on another computer with and Intel Atom Processor. Worked flawlessly. Lastly the second trial on the Sleekbook resulted in the same results as the first paragraph. Perhaps 12.10 Beta will overcome this issue, or the finalised 12.10 release in October. I don't have the expertise to know what the cause of the behaviour is-the issue could be something else entirely. Sadly, the Windows 7 performance is very good with this processor-very similar and in some instances better to the 2nd generation Intel i5 based computer I use at my workplace. Whatever the cause is for the performance with Ubuntu 12.04 or 12.10 Alpha 2, the situation doesn't bode well for Ubuntu. Ubuntu aside, the HP Sleekbook is a good performer for the price. I am certain once the Ubuntu issue is worked on and solutions arise, the Ubuntu performance will probably be better than ever.

    Read the article

  • mysql service do not launch

    - by ted
    Sorry for my English; I was trying to create db with rake in RoR application that has been configured for MySQL(gem installed, settings changed). After that attempt mysql-server broke: d@calister:~$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) mysqld is not running at all: d@calister:~$ ps aux | grep mysql d 3769 0.0 0.0 4368 832 pts/0 S+ 18:03 0:00 grep --color=auto mysql And also it doesn't seem it would like to run: d@calister:~$ sudo service mysql start start: Job failed to start Any suggestions? Thanks EDIT: d@calister:~$ sudo -u mysql mysqld 120520 18:45:11 [Note] Plugin 'FEDERATED' is disabled. mysqld: Table 'mysql.plugin' doesn't exist 120520 18:45:11 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 120520 18:45:11 InnoDB: The InnoDB memory heap is disabled 120520 18:45:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins 120520 18:45:11 InnoDB: Compressed tables use zlib 1.2.3.4 120520 18:45:11 InnoDB: Initializing buffer pool, size = 128.0M 120520 18:45:11 InnoDB: Completed initialization of buffer pool 120520 18:45:11 InnoDB: highest supported file format is Barracuda. 120520 18:45:12 InnoDB: Waiting for the background threads to start 120520 18:45:13 InnoDB: 1.1.8 started; log sequence number 1589459 120520 18:45:13 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

    Read the article

  • Mount - Unable to find suitable address

    - by Benny
    I am trying to mount my Windows share through my Ubuntu box (no xwindow), but I continue to get Unable to find suitable address I have tried using the raw IP address, I have checked the credentials, I have disabled the Windows firewall, but I cannot find anything wrong. benny@backup:~$ sudo mount -t cifs //my-desk/j -o username=me,password=s)mePasss /mnt/sync Unable to find suitable address. benny@backup:~$ ping my-desk PING my-desk (10.10.10.43) 56(84) bytes of data. ? --- my-desk ping statistics --- 2 packets transmitted, 0 received, 100% packet loss, time 1008ms benny@backup:~$ sudo mount -t cifs //10.10.10.43/j -o username=me,password=s)mePasss /mnt/sync Unable to find suitable address. Any help would be greatly appreciated!

    Read the article

  • Packaging a web application for deploying at customer site

    - by chitti
    I want to develop a django webapp that would get deployed at the customer site. The web app would run in a private cloud environment (ESX server here) of the customer. My web app would use a mysql database. The problem is I would not have direct access/control of the webapp. My question is, how to package such a web application with it's database and other entities so that it's easier to upgrade/update the app and it's database in future. Right now the idea I have is that I would provide a vm with the django app and database setup. The customer can just start the vm and he would have the webapp running. What are the other options I should consider?

    Read the article

  • Separating portion of website to its own server

    - by Brett
    So my job is to take the homepage (or maybe I should say "homesite" because it encompasses a few interrelated pages) and drag this onto its own Apache server. The problem I'm having right now is being able to weed out jumbled/bundled files (such as folders of js, css, and other files that i cant even identify) and knowing what is necessary to keep the homesite running. I'm new to this stuff (I'm an intern) so feel free to ask questions if I'm leaving vital information out. What I'm asking of you guys here is basically any pointers or tips you may be able to give me in order to get the job done. I could use some advice from people with a little more experience in web development. btw: This question may appear as though I have not completed any prior research and that is, for the most part, true. But the problem is I really am not sure how to research this. If you guys could throw me some keywords to play with that would really be helpful. Thanks!

    Read the article

  • Offset Forward vector of object based on Rotation

    - by Taylor
    I'm using the Bullet 3D physics engine in a iOS application running openGL ES 1.1 Currently I'm accepting info from the gyroscope to allow the user to "look around" a 3d world that follows a bouncing ball (note: it only takes in the yaw to look around 360 degrees). Im also accepting information from the accelerometer based on the tilt to push the ball. As of right now, to move forward, the user tilts the devise forward (using the accelerometer); to move to the right, the user tilts the devise to the right and so on. The forward vector is currently along it's local Z-axis. The problem is that I want to change the ball bounce based on where the user has changed the view. If I change the view, the ball bounces in the fixed direction. I want to change the forward facing direction so that when a user changes the view (say to the look at the right of the world, the user rotates the device), tilting the devise forward will result in a forward force in that direction. Basically, I want the forward vector to take the rotation into consideration. Sorry if I didn't explain the issue well enough, its kind of confusing to write down.

    Read the article

  • Does XNA 4 support 3D affine transformations for 2D images?

    - by Paul Baker Salt Shaker
    Looooong story short I'm essentially trying to code Mode 7 in XNA. Before I continue bashing my brains out in research and various failed matrix math equations; I just want to make sure that XNA supports this just out-of-the-box (so to speak). I'd prefer not to have to import other libraries, because I want to learn how it works myself that way I understand the whole thing better. However that's all for naught if it won't work at all. So no opengl, directx, etc if possible (will eventually do it just to optimize everything, but not for now). tl;dr: Can I has Mode 7 in XNA?

    Read the article

  • State / Screen management in Entity Component Systems

    - by David Lively
    My entity/component system is happily humming along and, despite some performance concerns I initially had, everything is working fine. However, I've realized that I missed a crucial point when starting this thing: how do you handle different screens? At the moment, I have a GameManager class which owns a component manager and entity manager. When I create an entity, the entity manager assigns it an ID and makes sure it's tracked. When I modify the components that are assigned to an entity. an UpdateEntity method is called, which alerts each of the systems that they may need to add or remove the entity from their respective entity lists. A problem with this is that the collection of entities operated on by each system is determined solely by the individual Systems, typically based on a "required component" filter. (An entity has to have a Renderable component to be rendered, for instance.) In this situation, I can't just keep collections of entities per screen and only Update/Draw those collections. They'd have to either be added and removed depending on their applicability to the current screen, which would cause their associated components to be removed, or enable/disable entities in a group per screen to hide what's not supposed to be visible. These approaches seem like really, really crappy kludges. What's a good way to handle this? A pretty straightforward way that comes to mind is to create a separate GameManager (which in my implementation owns all of the systems, entities, etc.) per screen, which means that everything outside of the device context would be duplicated. That's bothersome because some things are always visible, or I might want to continue to display the game under a translucent menu window. Another option would be to add a "layer" key to the GameManager class, which could be checked against a displayable layer stack held by the game manager. *System.Draw() would be called for each active layer, in the required order as determined by the stack. When the systems request an iterator for their respective entity collections, it would be pre-filtered to a (cached) set of those entities that participate in the active layer. Those collections could be updated from the same UpdateEntity event that's already used to maintain each system's entity collections. Still, kinda feels like a hack. If I've coded myself into a corner, feel free to throw tomatoes as long as they're labeled with a helpful suggestion. Hooray for learning curves.

    Read the article

  • GetContactList stops reporting collisions on welded bodies

    - by Henrique Jung
    I have some strange problem with my game which uses Box2D as physics engine and I'm out of ideas on what I can do to solve it. My game is a class assignment where I need to build a simple game where the main character moves in a 2D environment while square blocks comes from below him. Each time a collision occurs, that block is attached to the character using a weld joint, when three blocks of the same colors are together, they annihilate themselves(an effect similar to Bejeweled). I'm using a recursive function to iterate through all the attached blocks of a given block to see if there are enough blocks for them to be deleted. I'm using GetContactList function to iterate through the list of contacts to see which blocks are adjacent to each other. The results are quite disappointing, the blocks only get annihilated in few cases. After a lot of debugging, I found the issue, but I still don't know how to solve. My issue is: after some time, GetContactList STOPS returning contacts (return NULL) to blocks that were already attached for some time. I spent some time reading the Box2D manual as well as some tutorials and still didn't find any clue of what is happening. Below there's some simplified version of the code that I wrote. for(int a = 0; a < blocksList.size(); a++) { blocksList[a].BuildConnections(); } And on BuildConnections b2ContactEdge* edge = body->GetContactList(); while(edge != NULL) { if (long_check_to_see_if_there's_a_block_nearby) { // add itself to the list to be anihilated globalList.push_back(this); //if there's, call BuildConnections again on the adjacent block adjacentBody->GetUserData()->BuildConnections; } edge = edge->next; } I know that there's another issue related to circular inclusions, but I fairly sure that this problem isn't causing the problem with the collisions. You can download my entire code from this page if you'd like http://code.google.com/p/fellz/source/list

    Read the article

  • Simple OpenGL program major slow down at high resolution

    - by Grieverheart
    I have created a small OpenGL 3.3 (Core) program using freeglut. The whole geometry is two boxes and one plane with some textures. I can move around like in an FPS and that's it. The problem is I face a big slow down of fps when I make my window large (i.e. above 1920x1080). I have monitors GPU usage when in full-screen and it shows GPU load of nearly 100% and Memory Controller load of ~85%. When at 600x600, these numbers are at about 45%, my CPU is also at full load. I use deferred rendering at the moment but even when forward rendering, the slow down was nearly as severe. I can't imagine my GPU is not powerful enough for something this simple when I play many games at 1080p (I have a GeForce GT 120M btw). Below are my shaders, First Pass #VS #version 330 core uniform mat4 ModelViewMatrix; uniform mat3 NormalMatrix; uniform mat4 MVPMatrix; uniform float scale; layout(location = 0) in vec3 in_Position; layout(location = 1) in vec3 in_Normal; layout(location = 2) in vec2 in_TexCoord; smooth out vec3 pass_Normal; smooth out vec3 pass_Position; smooth out vec2 TexCoord; void main(void){ pass_Position = (ModelViewMatrix * vec4(scale * in_Position, 1.0)).xyz; pass_Normal = NormalMatrix * in_Normal; TexCoord = in_TexCoord; gl_Position = MVPMatrix * vec4(scale * in_Position, 1.0); } #FS #version 330 core uniform sampler2D inSampler; smooth in vec3 pass_Normal; smooth in vec3 pass_Position; smooth in vec2 TexCoord; layout(location = 0) out vec3 outPosition; layout(location = 1) out vec3 outDiffuse; layout(location = 2) out vec3 outNormal; void main(void){ outPosition = pass_Position; outDiffuse = texture(inSampler, TexCoord).xyz; outNormal = pass_Normal; } Second Pass #VS #version 330 core uniform float scale; layout(location = 0) in vec3 in_Position; void main(void){ gl_Position = mat4(1.0) * vec4(scale * in_Position, 1.0); } #FS #version 330 core struct Light{ vec3 direction; }; uniform ivec2 ScreenSize; uniform Light light; uniform sampler2D PositionMap; uniform sampler2D ColorMap; uniform sampler2D NormalMap; out vec4 out_Color; vec2 CalcTexCoord(void){ return gl_FragCoord.xy / ScreenSize; } vec4 CalcLight(vec3 position, vec3 normal){ vec4 DiffuseColor = vec4(0.0); vec4 SpecularColor = vec4(0.0); vec3 light_Direction = -normalize(light.direction); float diffuse = max(0.0, dot(normal, light_Direction)); if(diffuse 0.0){ DiffuseColor = diffuse * vec4(1.0); vec3 camera_Direction = normalize(-position); vec3 half_vector = normalize(camera_Direction + light_Direction); float specular = max(0.0, dot(normal, half_vector)); float fspecular = pow(specular, 128.0); SpecularColor = fspecular * vec4(1.0); } return DiffuseColor + SpecularColor + vec4(0.1); } void main(void){ vec2 TexCoord = CalcTexCoord(); vec3 Position = texture(PositionMap, TexCoord).xyz; vec3 Color = texture(ColorMap, TexCoord).xyz; vec3 Normal = normalize(texture(NormalMap, TexCoord).xyz); out_Color = vec4(Color, 1.0) * CalcLight(Position, Normal); } Is it normal for the GPU to be used that much under the described circumstances? Is it due to poor performance of freeglut? I understand that the problem could be specific to my code, but I can't paste the whole code here, if you need more info, please tell me.

    Read the article

  • JPA2 Criteria API creates invalid SQL when using groupBy

    - by Stephan
    JPA2 with the Criteria API seems to generate invalid SQL for PostgreSQL. For this code: Root<DBObjectAccessCounter> from = query.from(DBObjectAccessCounter.class); Path<DBObject> object = from.get(DBObjectAccessCounter_.object); Expression<Long> sum = builder.sumAsLong(from.get(DBObjectAccessCounter_.count)); query.multiselect(object, sum).groupBy(object); I get the following exception: ERROR: column "dbobject1_.id" must appear in the GROUP BY clause or be used in an aggregate function The generated SQL is: select dbobjectac0_.object_id as col_0_0_, sum(dbobjectac0_.count) as col_1_0_, dbobject1_.id as id1001_, dbobject1_.name as name1013_, dbobject1_.lastChanged as lastChan2_1013_, dbobject1_.type_id as type3_1013_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobjectac0_.object_id Obviously, the first item of the select statement (dbobjectac0_.object_id) does not match the group by clause. Simplified example It does not even work for this simple example: Root<DBObjectAccessCounter> from = query.from(DBObjectAccessCounter.class); Path<DBObject> object = from.get(DBObjectAccessCounter_.object); query.select(object).groupBy(object); which returns select dbobject1_.id as id924_, dbobject1_.name as name933_, dbobject1_.lastChanged as lastChan2_933_, dbobject1_.type_id as type3_933_ from DBObjectAccessCounter dbobjectac0_ inner join DBObject dbobject1_ on dbobjectac0_.object_id=dbobject1_.id group by dbobjectac0_.object_id Does anyone know how to fix this?

    Read the article

  • Copied App.config to (Assembly).exe.config but from folder debug application doesn't run

    - by uugan
    Gives error: "The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid" App.config looks like and it's same as (Assembly.exe.config) config file for output: <?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="Entities1" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string='data source=localhost;initial catalog=DatabaseName;integrated security=True;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" /> </connectionStrings> </configuration> How to run exe with it's configuration file? I tried to change '' to quot but nothing has changed.

    Read the article

  • Getting Top (starting no , Ending no) rows from sqlserver

    - by Krishna Thota
    I'm using Grid view in my asp.net page and I'm fetching data from SQL Server and placing in my grid view. Now my problem is, I'm using paging and placing 50 rows per page in Grid view. I would like to fetch top 50 rows from database in the start up and bind to the Grid View and when i click on next page, then again go to the database and fetch Second Top 50 rows and bind to GV. and this process hasto continue until last row is fetched from Database. Can you tell me How to write Query in achieving this??

    Read the article

  • Spring MVC managing multiple views with single controller

    - by Sudhir
    I am trying to implement order management module. There are different order types (approximately about 15). Each order has a seperate view. But the actions performed on UI are same irrespective of order type. Below is the structure of my DTO abstract class Order abstract class SecurityOrder extends Order abstract class TermDepositOrder extends Order ..... ..... ..... I am trying to implement a single controller capable of managing all views. Something similar to the one below: @Controller public class OrderController<F extends Order> { public F validate(F order) { } public F insert(F order) { } } I am not sure how spring mvc would be able to map request parameters properly to the order instance as it doesn't know which order instance to populate. Is it possible to achieve this with single controller or should I go with a controller for each order type and duplicate same code across all controllers?

    Read the article

  • NO able to use Xlrd module in python

    - by user1065102
    Question: i M not able to use xlrd module though i have installed the same??? Error obtained : Traceback (most recent call last): File "D:\xlrd_1.py", line 1, in import xlrd File "D:\Python31\lib\xlrd__init__.py", line 345 u"Consolidate_Area": u"\x00", ^ SyntaxError: invalid syntax Code : import xlrd print ("hi") Some more description: 1)i m using python 3.1, 2)i have installed xlrd-0.7.1.win32.exe (md5) taken from http://pypi.python.org/pypi/xlrd/0.7.1. 3)able to see the xlrd package in python\Lib\Site-packages 4)tried copying to include file also which didnt work. Need help on this..searched stackoverflow for the same problem as well as else where i didnt find answer so posting the same Appreciate for any help on the same

    Read the article

  • Building a dll with .lib files

    - by Manish Shukla
    I have a C++ project which is build via bjam. With 'install' rule in Jamroot i am able to create statically linked libraries (.lib files) for my project. My question is, how i can build a load-time DLL (or run-time DLL is also fine) with these .lib files? More Info: I am building my project with bjam in windows using msvc. When i tried compiling my project under visual C++ 2008, it complied and linked just fine but when i used bjam with msvc for compilation, it started giving linking errors and showing dependency from other project folders. Why was this behavior via bjam but not shown in vc++ UI.

    Read the article

  • Android webview doesn't playing mp4 video in same page

    - by user1668105
    I'm trying to show one local html file contains code for playing video and try to show that html file in android webview. I've used following code to for playing video: WebViewLoadVideoActivity.java //DECLARE webview variable outside of onCreate function so we can access it in other functions (menu) @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WebView webView = (WebView) findViewById(R.id.webView1); WebSettings webSettings = webView.getSettings(); // Fetches the // WebSettings // import WebViewClient webViewClient = new WebViewClient(); webView.setWebViewClient(webViewClient); // Enabling mp4 webSettings.setPluginsEnabled(true); // Allows plugins to run which are // normally disabled in webView webView.getSettings().setBuiltInZoomControls(true); // Allows the // Android built in // zoom control webView.getSettings().setSaveFormData(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setPluginsEnabled(true); webView.getSettings().setLoadsImagesAutomatically(true); webView.getSettings().setSupportMultipleWindows(true); webView.getSettings().setPluginsEnabled(true); webView.getSettings().setLightTouchEnabled(true); webView.getSettings().setAllowFileAccess(true); // To allow file // downloads/streams // such as mp4, mpeg, // and 3gp files webView.getSettings().setJavaScriptEnabled(true); // Enables HTML // Javascript to run // in webview webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); webView.getSettings().setSupportZoom(true); // Support the zoom feature webView.getSettings().setSavePassword(true); // Allow users to save passwords in forms webView.setWebViewClient(new WebViewClient() { // Opens web links clicked by user in the webview @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Handle the error } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); webView.loadUrl("file:///android_asset/test.html"); // test.html file from assets folder //... Rest of activity code... test.html <!DOCTYPE html> <html> <body> <video width="320" height="240" controls="controls"> <source src="http://www.w3schools.com/html/movie.mp4" type="video/mp4" /> Your browser does not support the video tag. </video> </body> </html> Problem Area : Android webview or Android Default Browser shows the video content in another video view when we click play button, My requirement is that video should be opened in same html page inline, so user can navigate to other page of webpage during video is playing or buffering. Research Area : I tried many other ways like, video tag of HTML5 embed tag of HTML object tag of HTML Other way of video player integration i checked so far but not worked in my requirement, Flare Video jplayer Please suggest me any way that can be suitable for my requirement, And my requirement is very simple as, I want to play video in html file as inline in webview widget of android. Thanks in Advance.

    Read the article

  • Detect what is selected (highlighted) or clicked within an element on a page?

    - by Fog Cook
    How would one go about detecting what has been selected on a page in a browser? Example: Click, hold, select 3 words and 1 image on a page, release. Sub-question: How to detect what letter someone clicked on? Without using: A span injector breaking everything up OR a WYSIWYG plugin I'm hoping this isn't just a type of browser interaction you can't detect. There could be many uses, but my goal is a simple 'live' page editor, or at least a way to know what someone is clicking on/selecting aside from just the id of an element.

    Read the article

  • __declspec(dllimport) causes compiler crash on MSVC 2010

    - by Zero
    In a *.cpp file, trying to use a third party lib: #define DLL_IMPORT #include <thirdParty.h> // Third party header has code like: // #ifdef DLL_IMPORT // #define DLL_DECL __declspec(dllimport) // fatal error C1001: An internal error has occurred in the compiler. Alternative: #define NO_DLL #include <thirdParty.h> // Third party header has code like: // #elif defined(NO_DLL) // #define DLL_DECL // Compiles fine, but linker errors as can't find DLL functions // I can reproduce results by remove macros and #define all together and manually editing the third party files to have __declspec(dllimport) or not Has anyone come across anything similar, or can hint at the cause? (which is created using CMake). Above is actual example of 2 line *.cpp that crashes so it's narrowed down to something in the #include. The following also work fine: Compile the examples provided by the third party (they provide a *.sln) that use dllimport/export so it doesn't appear to be the fault of the library Compile the third party lib as part of the production project (so dllexport works fine) I've trawled the project settings pages of the two projects to try and spot differences, but have come up blank. Of course, it's possible I'm missing something as those settings pages are not the easiest to navigate. I'll get access to VS2008 in a day or so, so can compare with that. The third party library is MySql++.

    Read the article

  • Conversion Fahrenheit to celsius programmatically

    - by Doom
    In my project, want to show the weather in fahrenheit first, then if the user wants clickes on conversion, needs to show the weather in celsius. My code is NSNumber *metric = [[NSUserDefaults standardUserDefaults] objectForKey:@"metric"]; NSLog(@"Metric is %@", metric); CGFloat aFloat = [speed floatValue]; CGFloat tFloat = [temperature floatValue]; CGFloat tempFloat = (tFloat-30)/2; NSNumber * p_Number = [NSNumber numberWithFloat:tempFloat]; //Convert mph to kmph if ([metric boolValue]) { [windValueLabel setText:[NSString stringWithFormat:@"%.2f kmph", aFloat * 1.6] ]; temperatureLabel.text = [NSString stringWithFormat:@"%@", p_Number]; } else{ [windValueLabel setText:[NSString stringWithFormat:@"%.2f mph", aFloat / 1.6]]; temperatureLabel.text = [NSString stringWithFormat:@"%@", temperature]; } When u start the app, its working and showing temperature in fahrenheit, but crashes at celsius man... is that the current conversion. help me out guys

    Read the article

  • Replace field value(s) in a String

    - by xybrek
    Using Google Guava is there String utility to easily replace string field inside like this: String query = mydb..sp_mySP ${userId}, ${groupId}, ${someOtherField} Where I can do something like this: StringUtil.setString(query) .setField("userId", "123") .setField("groupId", "456") .setField("someOtherField", "12-12-12"); Then the resulting String would be: mydb..sp_mySP 123, 456, 12-12-12 Of course, setting the String field patter like ${<field>} before the operation... Anyway, this is my approach: public class StringUtil { public class FieldModifier { private String s; public FieldModifier(String s){ this.s = s; } public FieldModifier setField(String fieldName, Object fieldValue){ String value = String.valueOf(fieldValue); s = modifyField(s, fieldName, value); return new FieldModifier(s); } private String modifyField(String s, String fieldName, String fieldValue){ String modified = ""; return modified; } } public FieldModifier parse(String s){ FieldModifier fm = new FieldModifier(s); return fm; } } So in this case, I just need to put the actual code in the modifyField function that will modify the string in a straightforward way. Also if there's a way so the parse function be static so I can just do StringUtil.parse(...) without doing new StringUtil().parse(...) which really doesn't look good.

    Read the article

  • Excel, Pivot Calculated formula: SUM(Field1)/AVG(Field2)

    - by Bas
    I've a simple table with some amount and interval in sec by date and product name. Month | Product | Amount | Interval in sec ------------------------------------------ 05-'12| Prod A | 10 | 5 05-'12| Prod A | 3 | 5 05-'12| Prod B | 4 | 5 05-'12| Prod C | 13 | 5 05-'12| Prod C | 5 | 5 From this table I've derived a Pivot table with SUM(Amount), AVERAGE(Interval in sec) by Month and Product. Month | Product | SUM of Amount | AVG of Interval in sec -------------------------------------------------------- 05-'12| Prod A | 13 | 5 05-'12| Prod B | 4 | 5 05-'12| Prod C | 18 | 5 So far So good... Now i want to add and extra column to my Pivot table with gives me the outcome of SUM of Amount / AVG of Interval in sec Adding a calculated value =SUM(Amount)/AVERAGE(Interval) is not giving me the right values. Exel gives me. Month | Product | SUM of Amount | AVG of Interval in sec | Amount per sec ------------------------------------------------------------------------- 05-'12| Prod A | 13 | 5 | 1.3 05-'12| Prod B | 4 | 5 | 0.8 05-'12| Prod C | 18 | 5 | 1.8 What it actually is doing is =SUM(Amount)/SUM(Interval in sec) for every Month and Product based on the values in the first table... But I'm looking for Month | Product | SUM of Amount | AVG of Interval in sec | Amount per sec ------------------------------------------------------------------------- 05-'12| Prod A | 13 | 5 | 2.6 05-'12| Prod B | 4 | 5 | 0.8 05-'12| Prod C | 18 | 5 | 3.6 So litterly devide pivot field 'Sum of Amount' by pivot field 'AVG of Interval in sec' How to achieve this? Thank you in advanced

    Read the article

  • jquery datepicker predefined date

    - by r3try
    This might seem like a stupid easy question to some of you, but i'm new to jquery and can't get my datepicker to work like it should. This is my textbox where the datepicker is attached to: <asp:TextBox runat="server" ID="StartMonth" AutoPostBack="true" class="month-picker" /> and here is how i attach the datepicker. (I have multiple TextBoxes where the datepicker should be attached to, so i used the class attribute instead of the id.) $(".month-picker").datepicker({ dateFormat: 'MM yy', changeYear: true, yearRange: '-9:+9' }); What i want to archive is when i click into the textbox where the text is "August 2012" it should set the pre-selected date of the datepicker to this date. Can anyone help? Kind regards.

    Read the article

  • How to set Tabbar integration in iPhone?

    - by Minu
    I am working on an iPhone app, using UITabBar to develop it. Only the tabbar background is visible, but it is not showing the title inside, how to fix this? please help me, Thanks in Advance. below is the source code for your reference. UITabBar *tab =[[UITabBar alloc]initWithFrame:CGRectMake(0, 300, 320, 44)]; [self.tabBarItem initWithTitle:@"1" image:nil tag:11]; [self.tabBarItem initWithTitle:@"2" image:nil tag:11]; [self.tabBarItem initWithTitle:@"3" image:nil tag:11]; [self.view addSubview:tab];

    Read the article

  • jQuery Validation plugin: prompt for override

    - by Sam Carleton
    I have a jQuery form that has validation of a sort. It is a data entry screen with two 'recommend ranges', one is 36-84, the other 50-300. The business rules call for the values to be either blank or greater than zero, but to prompt for confirmation if the values are outside of the range listed above. I have seen some other threads that talk about setting the class="cancel" on the submit button. From what I can tell, this will simply disable the validation. I need to prompt for a "do you want to continue, yes or no?" and if no stop the submit, if yes, continue. Below is an example from the book Pro jQuery. By default the top row needs to be between 10 and 20 to submit. How would you change it so that it prompts you and if you say Yes it submits, no prevents the submit: <!DOCTYPE html> <html> <head> <title>Example</title> <script src="jquery-1.7.js" type="text/javascript"></script> <script src="jquery.tmpl.js" type="text/javascript"></script> <script src="jquery.validate.js" type="text/javascript"></script> <style type="text/css"> h1 { min-width: 70px; border: thick double black; margin-left: auto; margin-right: auto; text-align: center; font-size: x-large; padding: .5em; color: darkgreen; background-image: url("border.png"); background-size: contain; margin-top: 0; } .dtable {display: table;} .drow {display: table-row;} .dcell {display: table-cell; padding: 10px;} .dcell > * {vertical-align: middle} input {width: 2em; text-align: right; border: thin solid black; padding: 2px;} label {width: 5em; padding-left: .5em; display: inline-block;} #buttonDiv {text-align: center;} #oblock {display: block; margin-left: auto; margin-right: auto; min-width: 700px; } div.errorMsg {color: red} .invalidElem {border: medium solid red} </style> <script type="text/javascript"> $(document).ready(function() { var data = [ { name: "Astor", product: "astor", stocklevel: "10", price: "2.99"}, { name: "Daffodil", product: "daffodil", stocklevel: "12", price: "1.99"}, { name: "Rose", product: "rose", stocklevel: "2", price: "4.99"}, { name: "Peony", product: "peony", stocklevel: "0", price: "1.50"}, { name: "Primula", product: "primula", stocklevel: "1", price: "3.12"}, { name: "Snowdrop", product: "snowdrop", stocklevel: "15", price: "0.99"}, ]; var templResult = $('#flowerTmpl').tmpl(data); templResult.slice(0, 3).appendTo('#row1'); templResult.slice(3).appendTo("#row2"); $('form').validate({ highlight: function(element, errorClass) { $(element).add($(element).parent()).addClass("invalidElem"); }, unhighlight: function(element, errorClass) { $(element).add($(element).parent()).removeClass("invalidElem"); }, errorElement: "div", errorClass: "errorMsg" }); $.validator.addClassRules({ flowerValidation: { required: true, min: 0, max: 100, digits: true, } }) $('#row1 input').each(function(index, elem) { $(elem).rules("add", { min: 10, max: 20 }) }); $('input').addClass("flowerValidation").change(function(e) { $('form').validate().element($(e.target)); }); }); </script> <script id="flowerTmpl" type="text/x-jquery-tmpl"> <div class="dcell"> <img src="${product}.png"/> <label for="${product}">${name}: </label> <input name="${product}" value="0" required /> </div> </script> </head> <body> <h1>Jacqui's Flower Shop</h1> <form method="post" action="http://node.jacquisflowershop.com/order"> <div id="oblock"> <div class="dtable"> <div id="row1" class="drow"> </div> <div id="row2"class="drow"> </div> </div> </div> <div id="buttonDiv"><button type="submit">Place Order</button></div> </form> </body> </html>

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >